Move examples/*.sx and their expected/ snapshots into per-category subfolders (examples/<category>/...). Folder = leading filename token, with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus runner and LSP sweep now discover each category's expected/ dir, while issues/ stays flat. Example 1058's repo-root-relative companion import is made file-relative. Path strings embedded in 164 snapshots were regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
33 lines
1.2 KiB
Plaintext
33 lines
1.2 KiB
Plaintext
#import "modules/std.sx";
|
|
#import "modules/build.sx";
|
|
#import "modules/compiler.sx";
|
|
|
|
// P5.4 — the build-pipeline query primitives on the comptime VM. A custom
|
|
// `on_build` override inspects the build metadata (`c_object_paths` returns the
|
|
// VM-built `List(string)` of C companion objects), then DELEGATES to the stdlib
|
|
// `default_pipeline` for the real emit + link. The `#import c` source compiles to
|
|
// one object, so `c_object_paths()` must be a one-element list of a non-empty
|
|
// path. AOT runs the produced binary → "runtime main: 42".
|
|
|
|
#import c {
|
|
#source "1662-platform-build-pipeline-queries.c";
|
|
};
|
|
|
|
c_marker :: () -> i64 extern;
|
|
|
|
build :: (opt: BuildOptions) -> bool abi(.compiler) {
|
|
objs := c_object_paths();
|
|
if objs.len != 1 { return false; }
|
|
if objs.items[0].len == 0 { return false; }
|
|
// link_libraries must be a well-formed (possibly empty) list — touch each.
|
|
libs := link_libraries();
|
|
sum : i64 = 0;
|
|
i : i64 = 0;
|
|
while i < libs.len { sum += libs.items[i].len; i += 1; }
|
|
if sum < 0 { return false; }
|
|
return default_pipeline(opt); // the real emit + link
|
|
}
|
|
#run on_build(build);
|
|
|
|
main :: () { print("runtime main: {}\n", c_marker()); }
|