summaryrefslogtreecommitdiff
path: root/9agents/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-22 10:30:02 -0300
committerGabriel Schneider <[email protected]>2026-09-25 17:52:33 -0300
commitdf20863879fe2d83077534f4726a985ffc239def (patch)
tree3f13dfc786509d1e2c599894a8beea48695e253c /9agents/build.zig
parenteb1a104f385f375a74319695e1a59f6f82e6384e (diff)
downloadcloud9-df20863879fe2d83077534f4726a985ffc239def.tar.gz
cloud9-df20863879fe2d83077534f4726a985ffc239def.zip
Rename 9harness to 9agents; README, file-backed qids, worded errors
- 9harness/ becomes 9agents/ (build option -D9agents, package paths). - 9agents serves /README, reports qid paths from the file's (dev, ino) and qid versions that move with the file, and names its refusals.
Diffstat (limited to '9agents/build.zig')
-rw-r--r--9agents/build.zig54
1 files changed, 54 insertions, 0 deletions
diff --git a/9agents/build.zig b/9agents/build.zig
new file mode 100644
index 0000000..0a63d9b
--- /dev/null
+++ b/9agents/build.zig
@@ -0,0 +1,54 @@
+//! Build fragment for 9agents: the coding-agents fs daemon (binary `9agents`),
+//! a read-only fresh-from-disk 9P2000 view of every harness's state,
+//! posted by default under the name `agents`. It is `@import`ed by the
+//! root build.zig and called with the root builder, so every `b.path(...)`
+//! here is relative to the cloud9 root (hence the `9agents/` prefix),
+//! every option is defined by the root and every step it registers lands
+//! in the root's step list under the `9agents` prefix.
+//!
+//! Steps: 9agents, 9agents-test, 9agents-itest.
+const std = @import("std");
+
+pub const Context = struct {
+ target: std.Build.ResolvedTarget,
+ optimize: std.builtin.OptimizeMode,
+ cloud9: *std.Build.Module,
+ /// The 9ns binary, for the --mntgen money shot in the integration
+ /// suite; null when 9ns is disabled, in which case the mntgen
+ /// section of the suite is skipped.
+ ns: ?*std.Build.Step.Compile,
+};
+
+pub const Artifacts = struct {
+ exe: *std.Build.Step.Compile,
+ /// `9agents-test`: the tree's unit tests (exclusions, path safety,
+ /// node ids, vanishing files — all against a fake HOME).
+ test_step: *std.Build.Step,
+ /// `9agents-itest`: test/e2e.sh (fixture roots + scratch registry,
+ /// plus the real-registry end-to-end when the `agents` name is free).
+ itest_step: *std.Build.Step,
+};
+
+pub fn add(b: *std.Build, ctx: Context) Artifacts {
+ const mod = b.createModule(.{
+ .root_source_file = b.path("9agents/src/main.zig"),
+ .target = ctx.target,
+ .optimize = ctx.optimize,
+ .imports = &.{.{ .name = "cloud9", .module = ctx.cloud9 }},
+ });
+ const exe = b.addExecutable(.{ .name = "9agents", .root_module = mod });
+ const install = b.addInstallArtifact(exe, .{});
+ b.getInstallStep().dependOn(&install.step);
+ b.step("9agents", "Build and install only the coding-agents fs daemon").dependOn(&install.step);
+
+ const test_step = b.step("9agents-test", "Run the 9agents tree's unit tests (fake HOME; never the live roots)");
+ test_step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = mod })).step);
+
+ const itest_step = b.step("9agents-itest", "Run 9agents/test/e2e.sh (posted name, reads, cmp of a transcript, mntgen mount, exclusions, live appends)");
+ const run = b.addSystemCommand(&.{"bash"});
+ run.addFileArg(b.path("9agents/test/e2e.sh"));
+ run.addArtifactArg(exe);
+ if (ctx.ns) |ns| run.addArtifactArg(ns);
+ itest_step.dependOn(&run.step);
+ return .{ .exe = exe, .test_step = test_step, .itest_step = itest_step };
+}