From 7a1c66f1a15911763db42d890e9e8172fe404170 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 17 Nov 2026 13:35:31 -0300 Subject: build: the core named once (core.module), the window's pieces made once build/core.zig's module() makes every core: the shell, the core, the core without the terminal (core-test), pardes-isolate, the static, the bare build's window, the syntax module's (syntax-test) and the 9P test roots; each import and library a core takes is written there once, in the order the fold over core_mods and wireCore gave them, so every compile keeps its inputs. Parts holds what a core is made of, Core the few ways the products differ. Tracy's client and BSD libutil stay where they were (Tracy: the shell and the core; libutil: the shell), now said by a field. Gone: the core_mods fold and its buffers, wireCore and its eleven optional fields, the 9P roots' copies of core_module's import table and link objects. The editor library's and pardes-syntax's import lists are written out in full (editorModule, library.zig); TreeSitter.wire adds the grammars; ShellConfig has defaults, so the library's two literals are one. build/gui.zig's make() builds SDL, gui_c, sketchbook's renderer, HarfBuzz and the renderer's and atlas's tests once, and Window.wire links them into each window shell. One pardes-lspmock (tests and process-test shared it twice from one root); tools.program() makes the eleven uniform runner programs in a line each. The pdf benches (tools.pdfBenches) are made once the core is. Gates: zig build -l and -h byte-identical to the base over the matrix (bare, tui, gui, macos, ReleaseFast, -Dpdf=false, -Dtree-sitter=minimal, musl, -Dtracy), test/lib's configuration byte-identical. Warm rebuild of install addons and core-test shell-test unit-test process-test on the base's cache: tui every compile cached (0 rebuilt), 2339/2486 tests passed with the base's 4 known failures, the same counts as the base; gui one change: SDL3 had -DSDL_DISABLE_STB=1 added once per window shell (twice with -Dplatform=gui), now once, so libSDL3.a's cache path moves and pardes-gui and the shell-test root relink (their argv differ in that one path, nothing else); tests 2398/2545, as the base. Installed bin/pardes, image.so and pdf.so cmp-identical on tui; image.so and pdf.so identical on gui, pardes-gui differs by the relinked SDL3 (size 398,737,210 -> 398,733,114). zig build syntax-test, which did not compile on main, now compiles and passes (40/40). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- build/library.zig | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'build/library.zig') diff --git a/build/library.zig b/build/library.zig index dcbb8938..7bcd6c5c 100644 --- a/build/library.zig +++ b/build/library.zig @@ -22,25 +22,14 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("src/lib_syntax.zig"), .link_libc = true, }); - mod.addOptions("pardes_config", core.shellOptions(b, .{ - .tree_sitter_grammars = tree_sitter_grammars, - .tracy = false, - .workspace_tag = null, - .prebuilt_shaders = false, - .embed_sources = false, - .commit = null, - .change = null, - .built = null, - }, .tui)); + // A library's options: its grammars, nothing stamped, no window. + const cfg: core.ShellConfig = .{ .tree_sitter_grammars = tree_sitter_grammars }; + mod.addOptions("pardes_config", core.shellOptions(b, cfg, .tui)); const ts = core.treeSitter(b, io, target, if (optimize == .debug) .fast else optimize, tree_sitter_grammars); const themes = core.generatedThemes(b, io, target, optimize); - core.wireCore(mod, .{ - .themes = themes, - .tree_sitter = ts.mod, - .ts_libs = ts.libs.items, - .ts_queries = ts.queries, - .c_heap = b.createModule(.{ .target = target, .optimize = optimize, .root_source_file = b.path("src/c_heap.zig") }), - }); + mod.addImport("generated_themes", themes); + ts.wire(mod); + mod.addImport("c_heap", b.createModule(.{ .target = target, .optimize = optimize, .root_source_file = b.path("src/c_heap.zig") })); // The editor, `pardes-editor`, to a package that asks for it: uucode, // mvzr and vaxis (with what its build names) are fetched then and only // then. Of vaxis it takes the grapheme width, which uucode alone feeds. @@ -56,14 +45,5 @@ pub fn build(b: *std.Build) void { .root_source_file = width.add("vaxis.zig", "pub const gwidth = @import(\"gwidth.zig\");\n"), .imports = &.{.{ .name = "uucode", .module = uucode }}, }); - _ = core.editorModule(b, "pardes-editor", target, optimize, .{ - .tree_sitter_grammars = tree_sitter_grammars, - .tracy = false, - .workspace_tag = null, - .prebuilt_shaders = false, - .embed_sources = false, - .commit = null, - .change = null, - .built = null, - }, .{ .themes = themes, .tree_sitter = ts.mod, .ts_libs = ts.libs.items, .ts_queries = ts.queries, .uucode = uucode, .mvzr = mvzr, .vaxis = vaxis }); + _ = core.editorModule(b, "pardes-editor", target, optimize, cfg, .{ .themes = themes, .ts = ts, .uucode = uucode, .mvzr = mvzr, .vaxis = vaxis }); } -- cgit v1.3