diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 23:07:14 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 00:24:42 -0300 |
| commit | a481de9feea08de7b5b82c2471de70abd70d7462 (patch) | |
| tree | 49dce2c2d511be4a47b0e92450046669ad7df0e4 | |
| parent | 55a5f91305df47cd56d7776f4193b6198208e891 (diff) | |
| download | pardes-a481de9feea08de7b5b82c2471de70abd70d7462.tar.gz pardes-a481de9feea08de7b5b82c2471de70abd70d7462.zip | |
build: one options module a module set, `pardes_options`, and `build_info` beside it (the start design's step 2, pardes-build-options change 2): `core.module` makes the set's options from the build's `ShellConfig` and the set's `Core` (the platform, now a `Core` field in place of a module handed in; the grammar set; the terminal; pardes-isolate's `isolated`; the addons compiled in and the pdf one with them, `builtin_addons` and `builtin_pdf`; tracy; the workspace tag; embedded sources; the library's `lib`), one module shared by the set's five as `pardes_config` was, and `build_info` (version, commit, change, built, deps) made once in `assemble` and given to every set; the three one-value modules made in both values (`term_options`, `pardes_isolation`, `builtin_addons`), `shellOptions`, the six `Parts` fields that held them, `Parts.tracy` and `Parts.embed_sources` (the `ShellConfig` in `Parts` holds both) and the assembly's two options (`opts`, `gui_opts`) go; the library's `pardes-syntax` and the editor (the library's and hxlib's) get `pardes_options` with no terminal, the editor's with `lib` as before; the sources' imports follow, one identifier a line (abi/wire.zig and core/Output.zig import both, the hash's and the Build pane's lines reading the version, commit and dependencies from `build_info`); test programs see it as before, through the core module's import table (pane-test, behaviour-test); `pardes version`'s semantics line did not move on any product (38b5ae573b965550; d41689a1f97605b8 with -Dtree-sitter=minimal); build.zig and build/ 2,992 -> 2,960 lines (3,005 at the base); every shape configures and builds as on the base, pardes-isolate and -Dtree-sitter=disabled failing with the base's same errors (pardes-isolate reaching them through its own options module); tui core-test 848/991 (143 skipped), shell-test 1027/1030, pane-test 183/184, behaviour-test 275/275 (and -- --replay), term-test 15/15, kitty-test 45/45, lib-test (11/11 in the consumer), hxlib 538 cases 0 mismatches, process-test 2 of 144 failed (lspcomplete and lspcompletemoved, the base's), gui unit-test 1625/1629 (the perf check's BaselineHarnessMismatch, the base's); the test names of every suite equal the base's (ledger); the frame and perf gate (gpu/bo-s2 against tree1) PASS: 77/77 frames byte-identical in Debug, the alternated window corpus2x -0.104% (pictures identical in all 10 runs), the 97 per-operation counts within 0.1% (largest image-frame +0.0345%; against the coordinator's pardes-merge22 gate m22-g, 90 within 5 ppm, deep-sel 8-10 ppm, image-frame up to 85 ppm, its known noise); load 5-25 on 16 cores
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
| -rw-r--r-- | abi/wire.zig | 13 | ||||
| -rw-r--r-- | build.zig | 13 | ||||
| -rw-r--r-- | build/core.zig | 115 | ||||
| -rw-r--r-- | build/library.zig | 2 | ||||
| -rw-r--r-- | build/tests.zig | 4 | ||||
| -rw-r--r-- | core/Addon.zig | 4 | ||||
| -rw-r--r-- | core/Editor.zig | 2 | ||||
| -rw-r--r-- | core/Output.zig | 15 | ||||
| -rw-r--r-- | core/Term.zig | 2 | ||||
| -rw-r--r-- | core/Text.zig | 2 | ||||
| -rw-r--r-- | core/config.zig | 2 | ||||
| -rw-r--r-- | core/lib_editor.zig | 2 | ||||
| -rw-r--r-- | core/memory.zig | 2 | ||||
| -rw-r--r-- | core/root.zig | 10 | ||||
| -rw-r--r-- | core/syntax.zig | 2 | ||||
| -rw-r--r-- | core/tracy.zig | 2 | ||||
| -rw-r--r-- | dev/root.zig | 6 | ||||
| -rw-r--r-- | docs/next-editor.md | 2 | ||||
| -rw-r--r-- | docs/next-terminal.md | 4 | ||||
| -rw-r--r-- | runtime/macos.zig | 2 | ||||
| -rw-r--r-- | runtime/root.zig | 4 | ||||
| -rw-r--r-- | test/behaviour/panes.zig | 2 | ||||
| -rw-r--r-- | test/behaviour/settings.zig | 8 | ||||
| -rw-r--r-- | test/output.zig | 2 |
24 files changed, 96 insertions, 126 deletions
diff --git a/abi/wire.zig b/abi/wire.zig index 26a7131e..1f7d02d2 100644 --- a/abi/wire.zig +++ b/abi/wire.zig @@ -7,7 +7,8 @@ const std = @import("std"); const builtin = @import("builtin"); const pardes = @import("core"); -const config = @import("pardes_config"); +const config = @import("pardes_options"); +const build_info = @import("build_info"); /// 23: a pane of a kind's frame names its rasters by key, their pixels /// crossing before it as strips of 4 MiB at most over the rows it shows @@ -70,12 +71,12 @@ pub const semantics: u64 = blk: { break :blk std.hash.Wyhash.hash(0, std.fmt.comptimePrint( "wire {d}\npardes {s} {s}\n{s} grammars {} {} {} {} workspace_tag {} sources {}\nusize {d} {t}\n", .{ - version, config.version, config.commit orelse "unstamped", - family, g != .disabled, g != .disabled, - g == .minimal or g == .full, g == .full, config.workspace_tag, - config.embed_sources, @sizeOf(usize), builtin.cpu.arch.endian(), + version, build_info.version, build_info.commit orelse "unstamped", + family, g != .disabled, g != .disabled, + g == .minimal or g == .full, g == .full, config.workspace_tag, + config.embed_sources, @sizeOf(usize), builtin.cpu.arch.endian(), }, - ) ++ config.deps ++ "\n" ++ pardes.tape.shape); + ) ++ build_info.deps ++ "\n" ++ pardes.tape.shape); }; /// EndOfStream: the message ends early; WriteFailed: no room for it. @@ -166,7 +166,6 @@ pub fn build(b: *std.Build) void { .pdf_scroll_bench_step = pdf_scroll_bench_step, }); const parts = a.parts; - const opts = a.opts; // Off Linux, whose memfd Addon.zig's loader needs, every core has the // addons compiled in. const compiled_in = target.result.os.tag != .linux; @@ -174,28 +173,28 @@ pub fn build(b: *std.Build) void { // its own flat C ABI instead of runtime/main.zig. Tracy's client and BSD // libutil go to the shell (and Tracy's to the core) alone, as before // core.module. - const root_set = core.module(b, parts, .{ .root = if (platform == .macos) "runtime/macos.zig" else "runtime/main.zig", .config = opts, .builtin_addons = compiled_in, .tracy = true, .util = true }); + const root_set = core.module(b, parts, .{ .root = if (platform == .macos) "runtime/macos.zig" else "runtime/main.zig", .platform = platform, .builtin_addons = compiled_in, .tracy = true, .util = true }); const root_mod = root_set.root; // hxdiff's headless core and pardes-isolate are the primary shell's // configuration compiled two more ways, not two more frontends. - const core_cfg: core.Core = .{ .root = "core/root.zig", .config = opts, .builtin_addons = compiled_in, .tracy = true }; + const core_cfg: core.Core = .{ .root = "core/root.zig", .platform = platform, .builtin_addons = compiled_in, .tracy = true }; const core_set = core.module(b, parts, core_cfg); const core_module = core_set.root; // The core without the terminal module (docs/next-terminal.md, Phase 1): // what core-test is compiled from. No ghostty-vt, wuffs, zstbi or C++; // a shell boot is a scratch pane, a test that needs a terminal skips, // and shell-test runs them all with one. - const lean_cfg: core.Core = .{ .root = "core/root.zig", .config = opts, .builtin_addons = compiled_in, .terminal = false }; + const lean_cfg: core.Core = .{ .root = "core/root.zig", .platform = platform, .builtin_addons = compiled_in, .terminal = false }; const core_lean = core.module(b, parts, lean_cfg); - const isolated_mod: ?*std.Build.Module = if (platform == .tui) core.module(b, parts, .{ .root = "runtime/main.zig", .config = opts, .builtin_addons = compiled_in, .isolated = true }).root else null; + const isolated_mod: ?*std.Build.Module = if (platform == .tui) core.module(b, parts, .{ .root = "runtime/main.zig", .platform = platform, .builtin_addons = compiled_in, .isolated = true }).root else null; // `zig build static`'s: the addons compiled in (Addon.zig). Linked // statically on musl alone, as glibc links only dynamically; the gui's // is dynamic (SDL and the GPU need the display's libraries) with the // addons in it all the same. const static_linkage: ?std.builtin.LinkMode = if (target.result.isMuslLibC()) .static else null; - const static_set: ?core.Modules = if ((platform == .tui and static_linkage != null) or platform == .gui) core.module(b, parts, .{ .root = "runtime/main.zig", .config = opts, .builtin_addons = true }) else null; + const static_set: ?core.Modules = if ((platform == .tui and static_linkage != null) or platform == .gui) core.module(b, parts, .{ .root = "runtime/main.zig", .platform = platform, .builtin_addons = true }) else null; const static_mod: ?*std.Build.Module = if (static_set) |s| s.root else null; - const gui_set: ?core.Modules = if (also_gui) core.module(b, parts, .{ .root = "runtime/main.zig", .config = a.gui_opts.?, .builtin_addons = compiled_in }) else null; + const gui_set: ?core.Modules = if (also_gui) core.module(b, parts, .{ .root = "runtime/main.zig", .platform = .gui, .builtin_addons = compiled_in }) else null; const gui_mod: ?*std.Build.Module = if (gui_set) |s| s.root else null; if (a.pdf.lib) |lib| tools.pdfBenches(b, target, optimize, core_module, lib, pdf_pointer_bench_step, pdf_scroll_bench_step); diff --git a/build/core.zig b/build/core.zig index b35c066b..4e4a748b 100644 --- a/build/core.zig +++ b/build/core.zig @@ -5,7 +5,7 @@ const grammar_manifest = @import("../core/grammar_manifest.zig"); const addons = @import("addons.zig"); const patches = @import("patches.zig"); /// The package manifest, imported UNTYPED on purpose — see the `version` -/// option in `shellOptions` for why that word is load-bearing. +/// option in `buildInfo` for why that word is load-bearing. const zon = @import("../build.zig.zon"); /// Releases are numbered 0.N; the zon holds "0.N.0" because it must be semver, /// and what a user sees drops that ".0". @@ -76,21 +76,34 @@ pub const ShellConfig = struct { lib: bool = false, }; -pub fn shellOptions(b: *std.Build, cfg: ShellConfig, platform: Platform) *std.Build.Step.Options { +/// `pardes_options`: what a module set varies at compile time, one module +/// a configuration, which `module` makes and the set's modules share. +pub fn options(b: *std.Build, cfg: ShellConfig, c: Core, pdf: bool) *std.Build.Step.Options { const o = b.addOptions(); - o.addOption(Platform, "platform", platform); + o.addOption(Platform, "platform", c.platform); o.addOption(TreeSitterGrammars, "grammars", cfg.tree_sitter_grammars); + o.addOption(bool, "terminal", c.terminal); + o.addOption(bool, "isolated", c.isolated); + o.addOption(bool, "builtin_addons", c.builtin_addons); + // ...the pdf one only when it is built (-Dpdf=false leaves it out). + o.addOption(bool, "builtin_pdf", c.builtin_addons and pdf); o.addOption(bool, "enable_tracy", cfg.tracy != null); - o.addOption(bool, "workspace_tag", cfg.workspace_tag orelse (platform != .macos)); + o.addOption(bool, "workspace_tag", cfg.workspace_tag orelse (c.platform != .macos)); o.addOption(bool, "embed_sources", cfg.embed_sources); + o.addOption(bool, "lib", cfg.lib); + return o; +} + +/// `build_info`: the version, and the commit, change and time a stamped +/// build was made from (see `stamp_commit`, read at configure time), and +/// every dependency's hash. +pub fn buildInfo(b: *std.Build, cfg: ShellConfig) *std.Build.Step.Options { + const o = b.addOptions(); o.addOption([]const u8, "version", display_version); - // ...and the commit it was built from, when there is one and the build - // is stamped at all (see `stamp_commit`). Read at configure time. o.addOption(?[]const u8, "commit", cfg.commit); o.addOption(?[]const u8, "change", cfg.change); o.addOption(?[]const u8, "built", cfg.built); o.addOption([]const u8, "deps", deps_text); - o.addOption(bool, "lib", cfg.lib); return o; } @@ -237,16 +250,16 @@ pub fn editorModule(b: *std.Build, name: ?[]const u8, target: std.Build.Resolved /// cell's width for j and k's goal column. vaxis: *std.Build.Module, }) *std.Build.Module { - const options: std.Build.Module.CreateOptions = .{ + const create: std.Build.Module.CreateOptions = .{ .target = target, .optimize = optimize, .root_source_file = b.path("core/lib_editor.zig"), .link_libc = true, }; - const m = if (name) |n| b.addModule(n, options) else b.createModule(options); + const m = if (name) |n| b.addModule(n, create) else b.createModule(create); var lib_cfg = cfg; lib_cfg.lib = true; - m.addOptions("pardes_config", shellOptions(b, lib_cfg, .tui)); + m.addOptions("pardes_options", options(b, lib_cfg, .{ .root = "core/lib_editor.zig", .platform = .tui, .terminal = false }, false)); m.addImport("plain", b.createModule(.{ .target = target, .optimize = optimize, .root_source_file = b.path("abi/plain.zig") })); m.addImport("generated_themes", d.themes); d.ts.wire(m); @@ -262,8 +275,10 @@ pub const Parts = struct { target: std.Build.ResolvedTarget, optimize: std.lang.Optimize, cloud9: *std.Build.Module, - /// -Dtracy's checkout, whose client a core that asks compiles in. - tracy: ?[]const u8, + /// The build's options (-Dtracy's checkout, -Dembed-sources...). + cfg: ShellConfig, + /// `build_info`, the same for every set. + info: *std.Build.Step.Options, zstd: *std.Build.Step.Compile, /// The addons, for a core that has them compiled in (Addon.zig); the /// pdf one only when it is built (-Dpdf=false leaves it out). @@ -281,16 +296,6 @@ pub const Parts = struct { uucode: *std.Build.Module, xitdb: *std.Build.Module, doc_typ: *std.Build.Step.Options, - /// -Dembed-sources: the core embeds its sources for /src. - embed_sources: bool, - /// One options module for each value of `terminal`, `isolated` and - /// `on`, shared by every core. - term_on: *std.Build.Step.Options, - term_off: *std.Build.Step.Options, - iso_on: *std.Build.Step.Options, - iso_off: *std.Build.Step.Options, - builtin_on: *std.Build.Step.Options, - builtin_off: *std.Build.Step.Options, }; /// Which core: its root and the few ways the products differ. @@ -299,9 +304,8 @@ pub const Core = struct { /// library), core/root.zig for the core, runtime/root.zig for the /// runtime, or a core file whose tests run on the core's imports. root: []const u8, - /// The shell's options (`pardes_config`): this build's, or the window's - /// in the bare build. - config: *std.Build.Step.Options, + /// This build's, or the window's in the bare build. + platform: Platform, /// The terminal module; without it (core-test) a shell boot is a scratch pane. terminal: bool = true, /// pardes-isolate's: no host but the terminal. @@ -336,7 +340,7 @@ pub fn module(b: *std.Build, p: Parts, c: Core) Modules { // forkpty: in libc proper on glibc>=2.34 and darwin; the BSDs keep it in libutil if (c.util and (p.target.result.os.tag == .freebsd or p.target.result.os.tag == .netbsd or p.target.result.os.tag == .openbsd)) m.linkSystemLibrary("util", .{}); - if (c.tracy) if (p.tracy) |tracy_path| { + if (c.tracy) if (p.cfg.tracy) |tracy_path| { m.addIncludePath(.{ .cwd_relative = tracy_path }); m.addCSourceFile(.{ .file = .{ .cwd_relative = b.pathJoin(&.{ tracy_path, "public", "TracyClient.cpp" }) }, @@ -356,7 +360,7 @@ pub fn module(b: *std.Build, p: Parts, c: Core) Modules { for (p.ts.libs.items) |lib| m.linkLibrary(lib); // The /src tree's files that live outside the core's directory // (fs.zig embeds them under the names they had there). - if (p.embed_sources) for ([_][]const u8{ "runtime/9p.zig", "runtime/9p_io.zig", "runtime/main.zig", "dev/host_io.zig" }) |f| + if (p.cfg.embed_sources) for ([_][]const u8{ "runtime/9p.zig", "runtime/9p_io.zig", "runtime/main.zig", "dev/host_io.zig" }) |f| m.addAnonymousImport(f, .{ .root_source_file = b.path(f) }); const runtime = b.createModule(.{ .target = p.target, .optimize = p.optimize, .root_source_file = b.path("runtime/root.zig"), .link_libc = true }); const dev = b.createModule(.{ .target = p.target, .optimize = p.optimize, .root_source_file = b.path("dev/root.zig"), .link_libc = true }); @@ -364,18 +368,15 @@ pub fn module(b: *std.Build, p: Parts, c: Core) Modules { const root = if (!in_runtime) m else if (std.mem.eql(u8, c.root, "runtime/root.zig")) runtime else b.createModule(.{ .target = p.target, .optimize = p.optimize, .root_source_file = b.path(c.root), .link_libc = true }); // Each options module once, so that the modules share it: a file is in // one module of a compilation. - const term_options = (if (c.terminal) p.term_on else p.term_off).createModule(); const ts_queries = if (p.ts.queries) |q| q.createModule() else null; const doc_typ = p.doc_typ.createModule(); - const pardes_config = c.config.createModule(); - const pardes_isolation = (if (c.isolated) p.iso_on else p.iso_off).createModule(); - const builtin_addons = (if (c.builtin_addons) p.builtin_on else p.builtin_off).createModule(); + const pardes_options = options(b, p.cfg, c, p.pdf != null).createModule(); + const build_info = p.info.createModule(); for ([_]*std.Build.Module{ m, dev, runtime, wire, root }) |x| { x.addImport("cloud9", p.cloud9); if (c.builtin_addons) if (p.pdf) |pdf| x.addImport("pdf_addon", pdf); if (c.builtin_addons) x.addImport("image_addon", p.image); if (c.terminal) x.addImport("term", p.term); - x.addImport("term_options", term_options); x.addImport("plain", p.plain); x.addImport("pardes_addon", p.kind); x.addImport("generated_themes", p.themes); @@ -388,9 +389,8 @@ pub fn module(b: *std.Build, p: Parts, c: Core) Modules { x.addImport("xitdb", p.xitdb); // config.zig's test checks the words and keys docs/typ names exist. x.addImport("doc_typ", doc_typ); - x.addImport("pardes_config", pardes_config); - x.addImport("pardes_isolation", pardes_isolation); - x.addImport("builtin_addons", builtin_addons); + x.addImport("pardes_options", pardes_options); + x.addImport("build_info", build_info); x.addImport("core", m); x.addImport("dev", dev); x.addImport("runtime", runtime); @@ -399,13 +399,9 @@ pub fn module(b: *std.Build, p: Parts, c: Core) Modules { return .{ .root = root, .core = m, .dev = dev, .runtime = runtime, .wire = wire }; } -/// What `assemble` makes besides the parts: the shells' options, the -/// addons, and the terminal's pieces the tests and harnesses name. +/// What `assemble` makes besides the parts: the addons, and the terminal's pieces the tests and harnesses name. pub const Assembly = struct { parts: Parts, - /// The shell's options (`pardes_config`), and the window's in the bare build. - opts: *std.Build.Step.Options, - gui_opts: ?*std.Build.Step.Options, /// What an addon in Zig imports (abi/addon.zig). addon_mod: *std.Build.Module, pdf: addons.Pdf, @@ -418,10 +414,10 @@ pub const Assembly = struct { ghostty_simd: bool, }; -/// Every core's parts, the shells' options and the addons, made once and -/// in this order (the configuration numbers what it generates by it): the -/// one-round lazy fetch, tree-sitter and the themes, the patched packages, -/// zstd, the terminal, and the options modules the cores choose between. +/// Every core's parts and the addons, made once and in this order (the +/// configuration numbers what it generates by it): the one-round lazy +/// fetch, tree-sitter and the themes, the patched packages, zstd, the +/// terminal. pub fn assemble(b: *std.Build, c: struct { target: std.Build.ResolvedTarget, optimize: std.lang.Optimize, @@ -463,9 +459,6 @@ pub fn assemble(b: *std.Build, c: struct { const themes_mod = generatedThemes(b, io, target, optimize); - const opts = shellOptions(b, c.shell_cfg, c.platform); - const gui_opts: ?*std.Build.Step.Options = if (c.also_gui) shellOptions(b, c.shell_cfg, .gui) else null; - const zstbi_dep = b.dependency("zstbi", .{ .target = target, .optimize = c_optimize }); const zstbi_mod = zstbi_dep.module("root"); // vaxis, ghostty, mvzr and zstbi are patched as they are fetched @@ -597,28 +590,13 @@ pub fn assemble(b: *std.Build, c: struct { if (ghostty_vt_for_tests) |x| term_mod.addImport("ghostty-vt", x); if (wuffs_mod) |x| term_mod.addImport("wuffs", x); term_mod.addImport("zstbi", zstbi_mod); - - // One options module for each value a core chooses (`module`). - const term_on = b.addOptions(); - term_on.addOption(bool, "terminal", true); - const term_off = b.addOptions(); - term_off.addOption(bool, "terminal", false); - const iso_off = b.addOptions(); - iso_off.addOption(bool, "isolated", false); - const iso_on = b.addOptions(); - iso_on.addOption(bool, "isolated", true); - const builtin_off = b.addOptions(); - builtin_off.addOption(bool, "on", false); - const builtin_on = b.addOptions(); - builtin_on.addOption(bool, "on", true); - // ...the pdf one only when it is built (-Dpdf=false leaves it out). - builtin_on.addOption(bool, "pdf", pdf_built.lib != null); return .{ .parts = .{ .target = target, .optimize = optimize, .cloud9 = cloud9, - .tracy = c.shell_cfg.tracy, + .cfg = c.shell_cfg, + .info = buildInfo(b, c.shell_cfg), .zstd = zstd, .image = image_addon.root_module, .pdf = pdf_built.module, @@ -633,16 +611,7 @@ pub fn assemble(b: *std.Build, c: struct { .uucode = uucode_mod, .xitdb = xitdb_mod, .doc_typ = c.doc_typ, - .embed_sources = c.shell_cfg.embed_sources, - .term_on = term_on, - .term_off = term_off, - .iso_on = iso_on, - .iso_off = iso_off, - .builtin_on = builtin_on, - .builtin_off = builtin_off, }, - .opts = opts, - .gui_opts = gui_opts, .addon_mod = addon_mod, .pdf = pdf_built, .image_addon = image_addon, diff --git a/build/library.zig b/build/library.zig index ebfd8596..8a23debc 100644 --- a/build/library.zig +++ b/build/library.zig @@ -24,7 +24,7 @@ pub fn build(b: *std.Build) void { }); // 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)); + mod.addOptions("pardes_options", core.options(b, cfg, .{ .root = "core/lib_syntax.zig", .platform = .tui, .terminal = false }, false)); const ts = core.treeSitter(b, io, target, if (optimize == .debug) .fast else optimize, tree_sitter_grammars); const themes = core.generatedThemes(b, io, target, optimize); mod.addImport("generated_themes", themes); diff --git a/build/tests.zig b/build/tests.zig index 50d3dd02..741eb24a 100644 --- a/build/tests.zig +++ b/build/tests.zig @@ -84,7 +84,7 @@ pub fn add(b: *std.Build, c: struct { if (c.ghostty_vt_for_tests) |x| pane_tests.root_module.addImport("ghostty-vt", x); // The core's own options module, not another over the same file: // a file is in one module of a compilation. - pane_tests.root_module.addImport("pardes_config", c.core_module.import_table.get("pardes_config").?); + pane_tests.root_module.addImport("pardes_options", c.core_module.import_table.get("pardes_options").?); const test_addons = b.addOptions(); test_addons.addOptionPath("image", c.image_addon.getEmittedBin()); test_addons.addOption(bool, "has_pdf", c.pdf_addon != null); @@ -129,7 +129,7 @@ pub fn add(b: *std.Build, c: struct { session_module.addOptions("session_options", session_options); // The build's options alone (platform), never the core: a test of a // window's word knows which build it runs in. - const behaviour_tests = units.root(b, "test/behaviour.zig", true, &.{ .{ .name = "session", .module = session_module }, .{ .name = "pardes_config", .module = c.core_module.import_table.get("pardes_config").? } }); + const behaviour_tests = units.root(b, "test/behaviour.zig", true, &.{ .{ .name = "session", .module = session_module }, .{ .name = "pardes_options", .module = c.core_module.import_table.get("pardes_options").? } }); const behaviour_test_step = b.step("behaviour-test", "run the behavioural tests, through the 9P tree alone (test/behaviour/), and the T1 runner (-- [--seed N]... | --monkey <seeds> | --replay)"); _ = units.add(b, behaviour_tests, behaviour_test_step); // An addon's own test: `--addon-test` over the fake (the template) diff --git a/core/Addon.zig b/core/Addon.zig index ec2f796a..c542e1f1 100644 --- a/core/Addon.zig +++ b/core/Addon.zig @@ -236,9 +236,9 @@ fn fileOf(fd: c_int) ?[5]i64 { /// library exports. A static binary cannot dlopen, and the loader below /// is Linux's (a memfd): this is how either has image and PDF panes. /// A build with -Dpdf=false has the image addon alone. -const compiled_in: []const *const Kind.Ops = if (!@import("builtin_addons").on) +const compiled_in: []const *const Kind.Ops = if (!@import("pardes_options").builtin_addons) &.{} -else if (@import("builtin_addons").pdf) +else if (@import("pardes_options").builtin_pdf) &.{ &@import("image_addon").pardes_addon, &@import("pdf_addon").pardes_addon } else &.{&@import("image_addon").pardes_addon}; diff --git a/core/Editor.zig b/core/Editor.zig index 9781d857..aaf6ab05 100644 --- a/core/Editor.zig +++ b/core/Editor.zig @@ -10,7 +10,7 @@ const Registers = @import("Registers.zig"); /// The library's build (build.zig `library`): a text with no pane and no /// core, its characters its own. Where an edit reaches a pane it branches /// on this at compile time, so the library never compiles the core. -pub const lib = @import("pardes_config").lib; +pub const lib = @import("pardes_options").lib; const Pardes = if (lib) void else @import("Core.zig"); const Syntax = if (lib) @import("lib_editor.zig").Syntax else void; const modal = @import("modal.zig"); diff --git a/core/Output.zig b/core/Output.zig index 23409b68..08abc154 100644 --- a/core/Output.zig +++ b/core/Output.zig @@ -9,7 +9,8 @@ const Pardes = pardes.Pardes; const modal = @import("modal.zig"); const limits = @import("memory.zig").limits; const builtins = @import("builtins.zig"); -const build_options = @import("pardes_config"); +const build_options = @import("pardes_options"); +const build_info = @import("build_info"); const lsp = @import("lsp/lsp.zig"); const look = @import("look.zig"); const locations = @import("locations.zig"); @@ -896,9 +897,9 @@ pub fn openBuild(p: *Pardes, id: usize) !void { const w = &out.writer; try w.print("{s}\n", .{@import("runtime").upgrade.version_line}); try w.print("commit {s}\nchange {s}\nbuilt {s}\n", .{ - build_options.commit orelse "not stamped (a Debug build with -Dplatform or --prefix)", - build_options.change orelse "not stamped", - build_options.built orelse "not stamped", + build_info.commit orelse "not stamped (a Debug build with -Dplatform or --prefix)", + build_info.change orelse "not stamped", + build_info.built orelse "not stamped", }); try w.print("zig {s}\nmode {s}\ntarget {s}-{s}-{s}\nplatform {s}\n", .{ builtin.zig_version_string, @tagName(builtin.mode), @@ -907,9 +908,9 @@ pub fn openBuild(p: *Pardes, id: usize) !void { }); try w.print("grammars {s}\naddons {s}\nsemantics {x:0>16}\n\ndependencies\n{s}", .{ if (build_options.grammars == .full) "full" else if (build_options.grammars == .minimal) "minimal" else "none", - if (@import("builtin_addons").on) "compiled in" else "loaded from <prefix>/lib/pardes/addons", + if (build_options.builtin_addons) "compiled in" else "loaded from <prefix>/lib/pardes/addons", @import("wire").semantics, - build_options.deps, + build_info.deps, }); const content = try out.toOwnedSlice(); return openRead(p, id, .{ .cmd = .Build }, "", content); @@ -918,7 +919,7 @@ pub fn openBuild(p: *Pardes, id: usize) !void { pub fn openChangelog(p: *Pardes, id: usize) !void { var out: std.Io.Writer.Allocating = .init(p.gpa); errdefer out.deinit(); - try out.writer.print("pardes {s}\n\n", .{build_options.version}); + try out.writer.print("pardes {s}\n\n", .{build_info.version}); try out.writer.writeAll(@embedFile("CHANGELOG.md")); const content = try out.toOwnedSlice(); return openRead(p, id, .{ .cmd = .Changelog }, "", content); diff --git a/core/Term.zig b/core/Term.zig index fde36420..3f975df6 100644 --- a/core/Term.zig +++ b/core/Term.zig @@ -15,7 +15,7 @@ const File = @import("File.zig"); const iface = plain.term; /// The terminal module's entries; null in a core built without it. -pub const ops: ?*const iface.Ops = if (@import("term_options").terminal) &@import("term").ops else null; +pub const ops: ?*const iface.Ops = if (@import("pardes_options").terminal) &@import("term").ops else null; /// What a core without a terminal says, once, where one would have been. pub const none = "no terminal in this build"; diff --git a/core/Text.zig b/core/Text.zig index 51d660cf..1b3e6273 100644 --- a/core/Text.zig +++ b/core/Text.zig @@ -113,7 +113,7 @@ refused: bool = false, pub inline fn pane(t: *Text) ?*Pane { // the library's text has none (lib_editor.zig): known at compile time, // so what an edit does with a pane is not compiled there - if (comptime @import("pardes_config").lib) return null; + if (comptime @import("pardes_options").lib) return null; return switch (t.what) { .body => @alignCast(@fieldParentPtr("body", t)), .tag => @alignCast(@fieldParentPtr("tag", t)), diff --git a/core/config.zig b/core/config.zig index 792a7e62..bb04d24d 100644 --- a/core/config.zig +++ b/core/config.zig @@ -39,7 +39,7 @@ comptime { @setEvalBranchQuota(20_000); // A path here is a leaf: no builtin's path is it or runs past it, and // none of it is a builtin's whole path. The library has no builtins. - if (!@import("pardes_config").lib) for (leader_args) |la| for (std.enums.values(Builtin)) |b| if (leader_path.get(b)) |path| { + if (!@import("pardes_options").lib) for (leader_args) |la| for (std.enums.values(Builtin)) |b| if (leader_path.get(b)) |path| { if (std.mem.startsWith(u8, path, la.path) or std.mem.startsWith(u8, la.path, path)) @compileError("leader_args path collides with " ++ @tagName(b) ++ ": " ++ la.path); }; diff --git a/core/lib_editor.zig b/core/lib_editor.zig index c459241a..3fe631af 100644 --- a/core/lib_editor.zig +++ b/core/lib_editor.zig @@ -3,7 +3,7 @@ //! true`, docs/next-editor.md). In-memory editing with helix's keys: no //! files, commands, builtins, prompts or views, which come back to the //! caller as an `action`. Nothing is copied here: a key runs the editor's -//! own normal.zig and edit.zig, built with `pardes_config.lib`, where a +//! own normal.zig and edit.zig, built with `pardes_options.lib`, where a //! text has no pane and its characters are its own. //! //! The editor is a value of plain data (`Editor(capacity)`): no pointer, diff --git a/core/memory.zig b/core/memory.zig index c628ae49..0e0dba29 100644 --- a/core/memory.zig +++ b/core/memory.zig @@ -1,6 +1,6 @@ const std = @import("std"); const builtin = @import("builtin"); -const config = @import("pardes_config"); +const config = @import("pardes_options"); const KiB = 1024; const MiB = 1024 * KiB; diff --git a/core/root.zig b/core/root.zig index 69ec3ded..df273738 100644 --- a/core/root.zig +++ b/core/root.zig @@ -98,12 +98,12 @@ pub const Host = host_io.Host; pub const frameMark = tracy.frameMark; /// The shell this build is for (build.zig's `-Dplatform`). -pub const platform = @import("pardes_config").platform; +pub const platform = @import("pardes_options").platform; -pub const version = @import("pardes_config").version; -pub const commit: ?[]const u8 = @import("pardes_config").commit; +pub const version = @import("build_info").version; +pub const commit: ?[]const u8 = @import("build_info").commit; -pub const isolated = @import("pardes_isolation").isolated; +pub const isolated = @import("pardes_options").isolated; pub const font_picker = platform == .gui or platform == .macos; @@ -442,7 +442,7 @@ test { // A window's build links the window's C (font.c over FreeType and // HarfBuzz) into each of its programs, and their allocator (ui_malloc // and the rest) is gui.zig's. - if (comptime @import("term_options").terminal and platform == .gui) _ = @import("dev").gui; + if (comptime @import("pardes_options").terminal and platform == .gui) _ = @import("dev").gui; } /// The container-level `var`s core/ may hold (at the top of a file, in a diff --git a/core/syntax.zig b/core/syntax.zig index 36aa8c2b..ba3851ab 100644 --- a/core/syntax.zig +++ b/core/syntax.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const config = @import("pardes_config"); +const config = @import("pardes_options"); const tracy = @import("tracy.zig"); const grammar_manifest = @import("grammar_manifest.zig"); const locations = @import("locations.zig"); diff --git a/core/tracy.zig b/core/tracy.zig index 3b0b8621..56429b1b 100644 --- a/core/tracy.zig +++ b/core/tracy.zig @@ -5,7 +5,7 @@ const std = @import("std"); const builtin = @import("builtin"); -pub const enable = if (builtin.is_test) false else @import("pardes_config").enable_tracy; +pub const enable = if (builtin.is_test) false else @import("pardes_options").enable_tracy; const SourceLocation = extern struct { name: ?[*:0]const u8, diff --git a/dev/root.zig b/dev/root.zig index 2c70783f..fc3ccfa8 100644 --- a/dev/root.zig +++ b/dev/root.zig @@ -26,9 +26,9 @@ test { _ = glide; // The frontends', which main.zig's test block collected: a shell's // build (shell-test); the core without a terminal never compiled them. - if (comptime @import("term_options").terminal) { - if (comptime @import("pardes_config").platform == .tui) _ = tui; - if (comptime @import("pardes_config").platform == .gui) _ = gui; + if (comptime @import("pardes_options").terminal) { + if (comptime @import("pardes_options").platform == .tui) _ = tui; + if (comptime @import("pardes_options").platform == .gui) _ = gui; _ = vaxis_input; } } diff --git a/docs/next-editor.md b/docs/next-editor.md index 120b4c09..e7168256 100644 --- a/docs/next-editor.md +++ b/docs/next-editor.md @@ -7,7 +7,7 @@ Decided 2026-11-17 on the coordinator's leans (survey: `.scratch/sketch/reports/editor-lib.md`); built the same day. One source of truth: the library runs the functions pardes runs, compiled from the -same files with `pardes_config.lib` set; nothing is copied for it. +same files with `pardes_options.lib` set; nothing is copied for it. ## The calls, as built diff --git a/docs/next-terminal.md b/docs/next-terminal.md index 26996897..c77ccd33 100644 --- a/docs/next-terminal.md +++ b/docs/next-terminal.md @@ -184,9 +184,9 @@ What differs from the plan above, and why: - **The ops are a compile-time constant, not handed over at start.** `Term.ops` (core/Term.zig:18) is `&@import("term").ops` when the build's - `term_options.terminal` says the core has a terminal, null otherwise. + `pardes_options.terminal` says the core has a terminal, null otherwise. Every core module but core-test's is given `term`; core-test's - (`core_lean` in build.zig) is not, and its `term_options` say so. A + (`core_lean` in build.zig) is not, and its `pardes_options` say so. A run-time `Pardes.Options.terminal` would have put the table in every test's options and every host's start for no gain: no build ever has two terminals, and a null known at compile time drops the dead code. diff --git a/runtime/macos.zig b/runtime/macos.zig index 408915da..24285c07 100644 --- a/runtime/macos.zig +++ b/runtime/macos.zig @@ -359,7 +359,7 @@ fn initCore(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) !void { core.settings.workspace_tag = if (std.c.getenv("PARDES_WORKSPACE_TAG")) |v| std.mem.eql(u8, std.mem.span(v), "1") else - @import("pardes_config").workspace_tag; + @import("pardes_options").workspace_tag; core.view().frontend.native_images = true; var prompt_rcs = host_io.Shell.prepare(); diff --git a/runtime/root.zig b/runtime/root.zig index ec89e734..930f3389 100644 --- a/runtime/root.zig +++ b/runtime/root.zig @@ -22,9 +22,9 @@ test { _ = ninep; // main.zig's test block collected the crash file's: a shell's build // (shell-test); the core without a terminal (core-test) never compiled it. - if (comptime @import("term_options").terminal) _ = crash; + if (comptime @import("pardes_options").terminal) _ = crash; // A window's build links the window's C (font.c over FreeType and // HarfBuzz) into each of its programs, and their allocator (ui_malloc // and the rest) is gui.zig's. - if (comptime @import("term_options").terminal and @import("pardes_config").platform == .gui) _ = @import("dev").gui; + if (comptime @import("pardes_options").terminal and @import("pardes_options").platform == .gui) _ = @import("dev").gui; } diff --git a/test/behaviour/panes.zig b/test/behaviour/panes.zig index 8fb85cb7..dcde9c4d 100644 --- a/test/behaviour/panes.zig +++ b/test/behaviour/panes.zig @@ -888,7 +888,7 @@ test "panes: truncating body empties it, and a stat says the length after" { } test "panes: a rename colours a source its new name's language names, its text unchanged" { - if (@import("pardes_config").grammars == .disabled) return error.SkipZigTest; + if (@import("pardes_options").grammars == .disabled) return error.SkipZigTest; var s = try Session.initFile(std.testing.allocator, "fn check() void {}\n"); defer s.deinit(); const n = try s.focused(); diff --git a/test/behaviour/settings.zig b/test/behaviour/settings.zig index bd88b75e..cacee701 100644 --- a/test/behaviour/settings.zig +++ b/test/behaviour/settings.zig @@ -37,7 +37,7 @@ test "settings: Pet is the window's: a terminal's view refuses it; a window take defer s.deinit(); // Which build, from its options, not from the answer: a terminal's view // taking Pet must fail here, not pass as a window. - if (comptime @import("pardes_config").platform == .gui) { + if (comptime @import("pardes_options").platform == .gui) { try std.testing.expectEqualStrings("Pet off", try setting(&s, "Pet")); try s.write("/ctl", "Pet cat\n"); try std.testing.expectEqualStrings("Pet cat", try setting(&s, "Pet")); @@ -106,7 +106,7 @@ test "settings: a bad setting value is quoted, so two different bad values log a test "settings: a setting this frontend cannot show says GUI-only, never run as a command, and DumpDir reads back" { var s = try Session.initFile(std.testing.allocator, "x\n"); defer s.deinit(); - if (comptime @import("pardes_config").platform != .gui) { + if (comptime @import("pardes_options").platform != .gui) { _ = try s.refused("/ctl", "GripWidth 120\n"); try std.testing.expectEqualStrings("GripWidth is GUI-only, invalid here \"GripWidth\"", s.said); // A builtin the GUI alone has, written to a ctl or an exec, never @@ -158,7 +158,7 @@ test "settings: Back and Forward written to exec keep to the focused file" { }); } -const syntax = @import("pardes_config").grammars != .disabled; +const syntax = @import("pardes_options").grammars != .disabled; /// The style /screen draws the cell `into` cells into the first place /// `text` is drawn. @@ -314,7 +314,7 @@ test "settings: the user's startup file loads clean, every word of it known and const ctl = try s.read("/ctl"); for ([_][]const u8{ "Theme monokai_pro_classic\n", "CallstackDepth 64\n", "InactiveDim 5\n", "Shell fish\n", "JumpTrail on\n", "LocationsConfig context:4 tscontext:on tslocations:on layout:stacked\n" }) |line| try expectHas(ctl, line); // The window's words, which a terminal's view leaves to the window. - const window = @import("pardes_config").platform == .gui; + const window = @import("pardes_options").platform == .gui; for ([_][2][]const u8{ .{ "GripWidth", "110" }, .{ "CursorBlink", "off" }, .{ "WindowOpacity", "100" }, .{ "TaglineSize", "80" }, .{ "Pet", "frog" } }) |w| try expectHas(ctl, if (window) s.at("\n{s} {s}\n", .{ w[0], w[1] }) else s.at("\n# {s} unsupported\n", .{w[0]})); } diff --git a/test/output.zig b/test/output.zig index 17525616..dc99be8b 100644 --- a/test/output.zig +++ b/test/output.zig @@ -786,7 +786,7 @@ test "identical result refresh keeps warm content caches without allocation" { const index = try panes.File.lineIndex(p.gpa, file); const styles = try std.testing.allocator.dupe(u8, file.highlights); defer std.testing.allocator.free(styles); - if (@import("pardes_config").grammars != .disabled) try std.testing.expect(styles.len > 0); + if (@import("pardes_options").grammars != .disabled) try std.testing.expect(styles.len > 0); const revision = file.revision; const saved_revision = file.saved_revision; const body_ptr = file.content.ptr; |
