summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 02:31:55 -0300
committerGabriel Schneider <[email protected]>2026-11-06 04:04:25 -0300
commit1b87e20543ca4577b855b3abf705561e9b45add8 (patch)
tree3ac89cb20ce76090639c08eaacbf454fcf733e50 /build.zig
parent9c66cdc9049b49f128336dcf5046e2bb1321e281 (diff)
downloadpardes-1b87e20543ca4577b855b3abf705561e9b45add8.tar.gz
pardes-1b87e20543ca4577b855b3abf705561e9b45add8.zip
kinds #6, the snake: addons/snake/snake.c (153 lines) against ABI 2 steps only while its pane has the keyboard and asks for nothing otherwise (19 lines of boilerplate, 13 by §16.7's measure: the head, word and ops literal, the api kept, an alloc check and two of prefix; the body pair and open's unused arguments are the rest), built by the build with -Wall -Wextra -Werror and not installed, and addon-test runs it against addons/snake/snake.out: its moves, h j k l turns and no turning back, food, the ctl read and body, blur with settle asking for no ticks and the snake still, focus resuming, a dump into a fresh pane, death on the wall and a restart
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/build.zig b/build.zig
index 90a7aa9e..d83b7139 100644
--- a/build.zig
+++ b/build.zig
@@ -1561,9 +1561,13 @@ pub fn build(b: *std.Build) void {
const behaviour_test_step = b.step("behaviour-test", "run the behavioural tests, through the 9P tree alone (test/behaviour/)");
_ = units.add(b, behaviour_tests, behaviour_test_step);
// An addon's own test: `--addon-test` over the fake (the template)
+ // and the snake (a shipped example, built but not installed), each
// with its script, compared with what it printed when written.
- const addon_test_step = b.step("addon-test", "pardes --addon-test over the fake addon, against addons/fake/fake.out");
- for ([_]struct { *std.Build.Step.Compile, []const u8 }{.{ fake_addon_lib.?, "addons/fake/fake" }}) |t| {
+ const addon_test_step = b.step("addon-test", "pardes --addon-test over the fake and snake addons, against addons/*/*.out");
+ const snake_lib = b.addLibrary(.{ .name = "snake", .linkage = .dynamic, .root_module = b.createModule(.{ .target = target, .optimize = optimize, .link_libc = true }) });
+ snake_lib.root_module.addIncludePath(b.path("src/kinds"));
+ snake_lib.root_module.addCSourceFile(.{ .file = b.path("addons/snake/snake.c"), .flags = &.{ "-std=c11", "-Wall", "-Wextra", "-Werror" } });
+ for ([_]struct { *std.Build.Step.Compile, []const u8 }{ .{ fake_addon_lib.?, "addons/fake/fake" }, .{ snake_lib, "addons/snake/snake" } }) |t| {
const run_addon_test = b.addRunArtifact(exe);
run_addon_test.addArg("--addon-test");
run_addon_test.addArtifactArg(t[0]);