diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -254,7 +254,11 @@ pub fn build(b: *std.Build) void { // `b.dependency` below would end the configure to fetch its own alone. const ts = treeSitter(b, io, target, c_optimize, tree_sitter_grammars); inline for (.{ "cloud9", "vaxis", "ghostty", "uucode", "zstbi", "mvzr", "zstd", "xitdb" }) |name| { - if (!std.Build.package_map.get(@field(zon.dependencies, name).hash).?.available) _ = b.lazyDependency(name, .{}); + // One by path (cloud9, until its pin returns) is there already. + const dep = @field(zon.dependencies, name); + if (@hasField(@TypeOf(dep), "hash")) if (!std.Build.package_map.get(dep.hash).?.available) { + _ = b.lazyDependency(name, .{}); + }; } const cloud9 = b.dependency("cloud9", .{ .target = target, .optimize = optimize }).module("cloud9"); for (core_mods) |mod| mod.addImport("cloud9", cloud9); @@ -803,7 +807,7 @@ pub fn build(b: *std.Build) void { // `typst compile` reads it too; a unit test fails when it is stale. // A terminal build writes builtins-tui.json and a window build // builtins-gui.json; style.typ merges the two into one glossary. - const builtins_json_step = b.step("builtins-json", "rewrite docs/typ/builtins-<tui|gui>.json from the builtin registry (-Dplatform=tui or gui)"); + const builtins_json_step = b.step("builtins-json", "rewrite docs/typ/builtins-<tui|gui>.json from the builtin registry, and with tui docs/typ/command-line.txt from pardes help --all (-Dplatform=tui or gui)"); if (requested_platform == .tui or requested_platform == .gui) { const gen = b.addExecutable(.{ .name = "pardes-gen-builtins-json", .root_module = b.createModule(.{ .target = target, @@ -1140,6 +1144,19 @@ pub fn build(b: *std.Build) void { .root_module = root_mod, }); installHome(b, exe, home_bin); + // docs/typ/command-line.txt: `pardes help --all`, the commands' + // help and the tree's README as this build prints them (never a + // session's), which the reference's "The pardes command" shows; + // main.zig's test fails when it is stale. The terminal's build + // writes it, the window's prints the same. + if (requested_platform == .tui) { + const run_help = b.addRunArtifact(exe); + run_help.addArgs(&.{ "help", "--all" }); + const update = b.addUpdateSourceFiles(); + update.addCopyFileToSource(run_help.captureStdOut(.{}), "docs/typ/command-line.txt"); + builtins_json_step.dependOn(&update.step); + for (doc_renders) |r| if (r) |run| run.step.dependOn(&update.step); + } // The addons, a step each: the default install is the binaries // alone, and `zig build image pdf` (or `addons`) puts the libraries // where the start scan finds them, <prefix>/lib/pardes/addons (and |
