build: pass direct exports to package compilers

This commit is contained in:
2026-08-12 18:42:22 +09:00
parent b373c445bd
commit edd3f4ee83
13 changed files with 678 additions and 611 deletions

View File

@@ -88,25 +88,22 @@ fn samefile(a: str, b: str, why: str) void = {
let cwork: str = strings.concat(stems[0], ".sepwork/");
let cwork2: str = strings.concat(stems[1], ".sepwork/");
let wwork: str = strings.concat(stems[2], ".sepwork/");
let bariface: str = testenv.readfile(strings.concat(cwork, "example.bar.wwi"));
let fooiface: str = testenv.readfile(strings.concat(cwork, "example.foo.wwi"));
let foounit: str = testenv.readfile(strings.concat(cwork,
"example.foo.unit.ww"));
let wantfoo: str = strings.concat("//ww:module example.bar\n", bariface,
"\n//ww:module-reset example.foo\n", afoosrc,
let wantfoo: str = strings.concat("//ww:module-reset example.foo\n", afoosrc,
"\n//ww:module-reset example.foo\n", zfoosrc, "\n");
if (!testenv.same(foounit, wantfoo)
|| testenv.has(foounit, "DECOY_FILE")) {
fail("foo unit is not its sorted, owned source set plus direct bar export");
|| testenv.has(foounit, "DECOY_FILE")
|| testenv.has(foounit, "//ww:module ")) {
fail("foo unit is not exactly its sorted, owned source set");
};
let wantroot: str = strings.concat("//ww:module example.foo\n", fooiface,
"\n//ww:module-reset\n", appsrc, "\n");
let wantroot: str = strings.concat("//ww:module-reset\n", appsrc, "\n");
if (!testenv.same(wantroot, testenv.readfile(strings.concat(cwork,
"__root.unit.ww")))) {
fail("root unit is not direct-foo-only");
fail("root unit is not exactly its owned source");
};
let keys: []str = ["example.base", "example.bar", "example.foo"];
let suffixes: []str = [".wwi", ".a"];
let suffixes: []str = [".unit.ww", ".wwi", ".a"];
i = 0;
for (i < keys.len) {
let j: i32 = 0;
@@ -120,6 +117,10 @@ fn samefile(a: str, b: str, why: str) void = {
};
i += 1;
};
samefile(strings.concat(cwork, "__root.unit.ww"), strings.concat(cwork2,
"__root.unit.ww"), "root unit changed across clean C builds");
samefile(strings.concat(cwork, "__root.unit.ww"), strings.concat(wwork,
"__root.unit.ww"), "root unit differs between stages");
samefile(stems[0], stems[1], "C executables are not deterministic");
samefile(stems[0], stems[2], "C/WW executables differ");