summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig72
1 files changed, 68 insertions, 4 deletions
diff --git a/build.zig b/build.zig
index dd2d64bf..f94a4bcf 100644
--- a/build.zig
+++ b/build.zig
@@ -1200,16 +1200,18 @@ pub fn build(b: *std.Build) void {
"Metal",
});
- // The icon is generated, not committed: the mark is drawn out of
- // the same palette PardesView.swift renders cells with, so a colour
- // that moves there moves here on the next build instead of a binary
- // blob quietly disagreeing with the app it ships in. Compiled alone
+ // The ICNS is generated, not committed: it is a ten-size container
+ // macOS reads, and a binary blob in the tree is one nobody can
+ // review. What IS committed is src/macos/icon.png, the drawing it
+ // is cut from — passed as a file arg so a new picture invalidates
+ // the cached icon instead of shipping the old one. Compiled alone
// because the file is top-level code — one file, one module.
const icon_build = b.addSystemCommand(&.{ "swiftc", "-O", "-target", triple, "-o" });
const icon_bin = icon_build.addOutputFileArg("pardes-icon");
icon_build.addFileArg(b.path("src/macos/icon.swift"));
const icon_run = std.Build.Step.Run.create(b, "pardes-icon");
icon_run.addFileArg(icon_bin);
+ icon_run.addFileArg(b.path("src/macos/icon.png"));
const icon_dir = icon_run.addOutputDirectoryArg("Resources");
// One version, two consumers: LSMinimumSystemVersion is stamped
@@ -1601,6 +1603,68 @@ pub fn build(b: *std.Build) void {
.link_libc = true,
}) });
unit_step.dependOn(&b.addRunArtifact(nested_test).step);
+ // The LSP protocol client. Its own module for the reason its
+ // neighbours have, and it earned the comment above the hard way: the
+ // core DOES import src/lsp/lsp.zig, which imports this file, and that
+ // is not enough — zig collects tests from a module's ROOT SOURCE FILE
+ // only, so every test in src/lsp/ compiled and none of them ran. What
+ // went unnoticed behind that is the whole reason this entry exists: the
+ // transport asked for SOCK_CLOEXEC, which darwin's socketpair(2)
+ // rejects, so no language server had ever spawned on macOS. The
+ // end-to-end cover (test/snapshots/lsp-client.snap) could not catch it
+ // either — `snap` runs the x86_64-linux target, where the flag is real.
+ //
+ // `pardes_config` and `zls` are attached because lsp.zig's `backends`
+ // names the in-process analyser; this test module compiles the same
+ // graph the shells do rather than a second, luckier one.
+ const lsp_client_test = b.addTest(.{ .root_module = blk: {
+ const m = b.createModule(.{
+ .target = target,
+ .optimize = optimize,
+ .root_source_file = b.path("src/lsp/lsp_client.zig"),
+ .link_libc = true,
+ });
+ m.addOptions("pardes_config", opts);
+ if (zls_mod) |x| m.addImport("zls", x);
+ break :blk m;
+ } });
+ unit_step.dependOn(&b.addRunArtifact(lsp_client_test).step);
+ // The shared LSP host worker. Rooted here for the reason every module
+ // above it is: zig collects tests from a module's ROOT FILE only, and
+ // this one is reached through src/pardes.zig by three shells that would
+ // each have compiled its tests and run none of them. It needs the whole
+ // core graph because it imports the core — the same wiring hx_core_mod
+ // gets, in one call, so a dependency added there is not missed here.
+ const lsp_host_test = b.addTest(.{ .root_module = blk: {
+ const m = b.createModule(.{
+ .target = target,
+ .optimize = optimize,
+ .root_source_file = b.path("src/lsp_host.zig"),
+ .link_libc = true,
+ });
+ m.addOptions("pardes_config", opts);
+ m.addOptions("pardes_isolation", iso_off);
+ wireCore(m, .{
+ .themes = themes_mod,
+ .zls = zls_mod,
+ .tree_sitter = ts_mod,
+ .ts_libs = ts_libs.items,
+ .ts_queries = ts_queries_opts,
+ .zstbi = zstbi_mod,
+ .mvzr = mvzr_mod,
+ .mupdf = mupdf_core_mod,
+ .ghostty_vt = ghostty_core_vt,
+ .vaxis = vaxis_mod,
+ .uucode = uucode_mod,
+ });
+ // src/source_manifest.zig embeds these two by name; every core
+ // compilation gets them beside `pardes_config` (see the core_mods
+ // loop), and a module rooted inside the core needs them too.
+ m.addAnonymousImport("root-build.zig", .{ .root_source_file = b.path("build.zig") });
+ m.addAnonymousImport("root-build.zig.zon", .{ .root_source_file = b.path("build.zig.zon") });
+ break :blk m;
+ } });
+ unit_step.dependOn(&b.addRunArtifact(lsp_host_test).step);
// The 9P2000 codec and its sans-io server. Its own module for the
// reason spelled out above rather than as a convention, and a stronger
// one than its neighbours have: 9p.zig is FREESTANDING — it imports