summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-18 22:03:14 -0300
committerGabriel Schneider <[email protected]>2026-11-18 22:23:51 -0300
commit99f5b10eccd95aa0066ea6fe6bb75f367ab56a47 (patch)
tree813596ea84318a7bae4fd7416ba463de8e3b7107 /build
parent92d553123673376adf6126ab90d49a22c5b833d2 (diff)
downloadpardes-99f5b10eccd95aa0066ea6fe6bb75f367ab56a47.tar.gz
pardes-99f5b10eccd95aa0066ea6fe6bb75f367ab56a47.zip
core: src/ becomes core/, pardes.zig its root.zig (the reorganisation's tree, step 2d), and every mention of a src/ path follows: the build's paths, the core's imports of its root, the tests that read the repository's files by path (lspbench's, look.zig's spans over core/look.zig), the comments that cite files, the documents and the manual (the typst corpus reads core/tutor.txt and core/plumbing); left as they were: the /src tree's served names (src/pardes.zig and the rest are the 9P tree's, not the repository's), the CHANGELOG's history, fixtures that are only strings; fs-unit-test runs from the core's root (a module of the core rooted at fs.zig had the runtime's and the devices' `core` be fs.zig); nothing else changes: the ledger (pardes.test.* now root.test.*), frames byte-identical, replicas and process-test the base's
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'build')
-rw-r--r--build/core.zig40
-rw-r--r--build/docs.zig2
-rw-r--r--build/library.zig6
-rw-r--r--build/patches.zig2
-rw-r--r--build/tests.zig19
-rw-r--r--build/tools.zig4
6 files changed, 37 insertions, 36 deletions
diff --git a/build/core.zig b/build/core.zig
index 26de1669..974d5c7e 100644
--- a/build/core.zig
+++ b/build/core.zig
@@ -1,7 +1,7 @@
const std = @import("std");
const Platform = @import("../build.zig").Platform;
const TreeSitterGrammars = @import("../build.zig").TreeSitterGrammars;
-const grammar_manifest = @import("../src/grammar_manifest.zig");
+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`
@@ -16,7 +16,7 @@ else
/// Every dependency the manifest pins, by its content hash: a grammar,
/// ghostty or the Unicode tables steps a core differently, so they are part
-/// of a replica's semantics hash (src/wire.zig `semantics`).
+/// of a replica's semantics hash (abi/wire.zig `semantics`).
const deps_text = blk: {
var text: []const u8 = "";
for (@typeInfo(@TypeOf(zon.dependencies)).@"struct".field_names) |name| {
@@ -71,8 +71,8 @@ pub const ShellConfig = struct {
/// `Build` word's, stamped with the commit (see `stamp_commit`).
change: ?[]const u8 = null,
built: ?[]const u8 = null,
- /// The library's editor (src/lib_editor.zig): a text with no pane, so
- /// the core is not compiled (src/Editor.zig).
+ /// The library's editor (core/lib_editor.zig): a text with no pane, so
+ /// the core is not compiled (core/Editor.zig).
lib: bool = false,
};
@@ -189,7 +189,7 @@ pub fn treeSitter(b: *std.Build, io: std.Io, target: std.Build.ResolvedTarget, c
// Every allocation a grammar's external scanner makes goes to the
// runtime's allocator, which syntax.zig points at a Zig one:
// TREE_SITTER_REUSE_ALLOCATOR for the scanners that use
- // ts_malloc, and src/tree_sitter_heap.h for the ones that call
+ // ts_malloc, and core/tree_sitter_heap.h for the ones that call
// malloc themselves.
const ts_cflags = [_][]const u8{
"-fno-sanitize=function",
@@ -197,7 +197,7 @@ pub fn treeSitter(b: *std.Build, io: std.Io, target: std.Build.ResolvedTarget, c
// From the compiler's working directory, the root
// package's: pardes's own, or the one that depends on it.
"-include",
- b.root.joinString(b.allocator, "src/tree_sitter_heap.h") catch @panic("OOM"),
+ b.root.joinString(b.allocator, "core/tree_sitter_heap.h") catch @panic("OOM"),
};
lib.root_module.addCSourceFile(.{ .file = dep.path(g.src ++ "/parser.c"), .flags = &ts_cflags });
if (g.scanner) lib.root_module.addCSourceFile(.{ .file = dep.path(g.src ++ "/scanner.c"), .flags = &ts_cflags });
@@ -227,7 +227,7 @@ pub fn uucodeModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: s
}) catch return null).module("uucode");
}
-/// The editor as a library (src/lib_editor.zig, docs/next-editor.md): the
+/// The editor as a library (core/lib_editor.zig, docs/next-editor.md): the
/// text pane's own code built with `lib`, so no pane and no core, over
/// tree-sitter, uucode and mvzr, with pardes-syntax in it as `.syntax`.
/// `library` exports it to a package that asks; hxdiff runs its cases on it.
@@ -243,7 +243,7 @@ pub fn editorModule(b: *std.Build, name: ?[]const u8, target: std.Build.Resolved
const options: std.Build.Module.CreateOptions = .{
.target = target,
.optimize = optimize,
- .root_source_file = b.path("src/lib_editor.zig"),
+ .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);
@@ -254,7 +254,7 @@ pub fn editorModule(b: *std.Build, name: ?[]const u8, target: std.Build.Resolved
m.addImport("generated_themes", d.themes);
d.ts.wire(m);
m.addImport("mvzr", d.mvzr);
- m.addImport("c_heap", b.createModule(.{ .target = target, .optimize = optimize, .root_source_file = b.path("src/c_heap.zig") }));
+ m.addImport("c_heap", b.createModule(.{ .target = target, .optimize = optimize, .root_source_file = b.path("core/c_heap.zig") }));
m.addImport("vaxis", d.vaxis);
m.addImport("uucode", d.uucode);
return m;
@@ -299,7 +299,7 @@ pub const Parts = struct {
/// Which core: its root and the few ways the products differ.
pub const Core = struct {
/// runtime/main.zig for a shell (runtime/macos.zig for the macOS
- /// library), src/pardes.zig for the core, runtime/root.zig for the
+ /// 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
@@ -335,7 +335,7 @@ pub const Modules = struct {
/// and link named here and nowhere else.
pub fn module(b: *std.Build, p: Parts, c: Core) Modules {
const in_runtime = std.mem.startsWith(u8, c.root, "runtime/");
- const m = b.createModule(.{ .target = p.target, .optimize = p.optimize, .root_source_file = b.path(if (in_runtime) "src/pardes.zig" else c.root), .link_libc = true });
+ const m = b.createModule(.{ .target = p.target, .optimize = p.optimize, .root_source_file = b.path(if (in_runtime) "core/root.zig" else c.root), .link_libc = true });
// 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", .{});
@@ -409,7 +409,7 @@ pub const Assembly = struct {
/// 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 (src/kinds/addon.zig).
+ /// What an addon in Zig imports (abi/addon.zig).
addon_mod: *std.Build.Module,
pdf: addons.Pdf,
image_addon: *std.Build.Step.Compile,
@@ -484,7 +484,7 @@ pub fn assemble(b: *std.Build, c: struct {
const c_heap_mod = b.createModule(.{
.target = target,
.optimize = optimize,
- .root_source_file = b.path("src/c_heap.zig"),
+ .root_source_file = b.path("core/c_heap.zig"),
});
// MuPDF and FreeType, lazy (build.zig's `pdf` option has why).
@@ -499,10 +499,10 @@ pub fn assemble(b: *std.Build, c: struct {
}) catch null else null;
const freetype = if (freetype_dep) |d| d.artifact("freetype") else null;
- // The kinds' C ABI (src/kinds/pardes_addon.h), translated once: the core's
+ // The kinds' C ABI (abi/pardes_addon.h), translated once: the core's
// records are the header's, never a mirror of it.
const kind_mod = b.addTranslateC(.{ .root_source_file = b.path("abi/pardes_addon.h"), .target = target, .optimize = optimize }).createModule();
- // ...and what an addon in Zig imports over it (src/kinds/addon.zig).
+ // ...and what an addon in Zig imports over it (abi/addon.zig).
const addon_mod = b.createModule(.{ .root_source_file = b.path("abi/addon.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "pardes_addon", .module = kind_mod }} });
const pdf_built = addons.pdf(b, .{
.addon_mod = addon_mod,
@@ -551,7 +551,7 @@ pub fn assemble(b: *std.Build, c: struct {
patches.zstbi(b, patch, zstbi_dep, zstbi_mod);
// One zstd (docs/shared-libs.md): a far replica's stream, compressed by
- // its session and read by its client (src/replica.zig). The library's
+ // its session and read by its client (core/replica.zig). The library's
// compressor and decompressor alone, single-threaded and without its
// x86 assembly, each context made with ZSTD_customMem over c_heap; of
// its block compressors only those of levels 3 (dfast) and 6 (lazy),
@@ -588,16 +588,16 @@ pub fn assemble(b: *std.Build, c: struct {
break :zstd lib;
};
- // xitdb keeps what pardes writes to disk (src/Db.zig): pure Zig, no C
+ // xitdb keeps what pardes writes to disk (core/Db.zig): pure Zig, no C
// library and no allocator hook of its own (it takes Zig allocators).
const xitdb_mod = b.dependency("xitdb", .{ .target = target, .optimize = optimize }).module("xitdb");
const image_addon = addons.image(b, target, c_optimize, addon_mod, zstbi_dep);
- // The records the core and the terminal both name (src/plain/plain.zig).
+ // The records the core and the terminal both name (abi/plain.zig).
const plain_mod = b.createModule(.{ .root_source_file = b.path("abi/plain.zig"), .target = target, .optimize = optimize });
- // The terminal, a module of its own (src/term/term.zig): the emulator and
+ // The terminal, a module of its own (core/term/term.zig): the emulator and
// what it brings are its, and every core but core-test's is given it.
- const term_mod = b.createModule(.{ .root_source_file = b.path("src/term/term.zig"), .target = target, .optimize = optimize, .link_libc = true });
+ const term_mod = b.createModule(.{ .root_source_file = b.path("core/term/term.zig"), .target = target, .optimize = optimize, .link_libc = true });
term_mod.addImport("plain", plain_mod);
if (ghostty_vt_for_tests) |x| term_mod.addImport("ghostty-vt", x);
if (wuffs_mod) |x| term_mod.addImport("wuffs", x);
diff --git a/build/docs.zig b/build/docs.zig
index b698da02..e6cd9e72 100644
--- a/build/docs.zig
+++ b/build/docs.zig
@@ -40,7 +40,7 @@ pub fn add(b: *std.Build) [3]*std.Build.Step.Run {
}
/// docs/typ/builtins-<platform>.json: every builtin, from the registry and the Help
-/// rows (src/builtins_json.zig), rewritten in the source tree so a plain
+/// rows (core/builtins_json.zig), rewritten in the source tree so a plain
/// `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.
diff --git a/build/library.zig b/build/library.zig
index 049b4323..ebfd8596 100644
--- a/build/library.zig
+++ b/build/library.zig
@@ -4,7 +4,7 @@ const core = @import("core.zig");
const patches = @import("patches.zig");
/// pardes as a library, all a package that depends on it is given: the
-/// `pardes-syntax` module (src/lib_syntax.zig), the grammars, highlighting
+/// `pardes-syntax` module (core/lib_syntax.zig), the grammars, highlighting
/// and themes for a program that draws source text itself. It takes
/// tree-sitter and the grammars of its `tree-sitter` option and no other
/// dependency, so nothing else is fetched (build.zig.zon). test/lib is such
@@ -19,7 +19,7 @@ pub fn build(b: *std.Build) void {
const mod = b.addModule("pardes-syntax", .{
.target = target,
.optimize = optimize,
- .root_source_file = b.path("src/lib_syntax.zig"),
+ .root_source_file = b.path("core/lib_syntax.zig"),
.link_libc = true,
});
// A library's options: its grammars, nothing stamped, no window.
@@ -29,7 +29,7 @@ pub fn build(b: *std.Build) void {
const themes = core.generatedThemes(b, io, target, optimize);
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") }));
+ mod.addImport("c_heap", b.createModule(.{ .target = target, .optimize = optimize, .root_source_file = b.path("core/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.
diff --git a/build/patches.zig b/build/patches.zig
index b6b6b86d..5e120345 100644
--- a/build/patches.zig
+++ b/build/patches.zig
@@ -258,7 +258,7 @@ pub fn ghosttyKitty(b: *std.Build, patch: *std.Build.Step.Compile, dep: *std.Bui
/// no bound on its work (its own test "do not make this test any
/// longer": `a?` n times is 2^n steps), so each entry to matchPattern,
/// which its backtracking recurses through, spends a step, and with none
-/// left the match fails and says so (src/regexp.zig).
+/// left the match fails and says so (core/regexp.zig).
/// - A group's greedy match never gave back to what follows the group: on
/// `aab`, `(a+)ab` missed where `a+ab` matched. hasAlt counts the group's
/// own `)` as an alternative, so every group with pattern after it takes
diff --git a/build/tests.zig b/build/tests.zig
index 0eaf7c63..fe9e1355 100644
--- a/build/tests.zig
+++ b/build/tests.zig
@@ -74,9 +74,9 @@ pub fn add(b: *std.Build, c: struct {
core_test_step.dependOn(&run_core_test.step);
if (core_match) |check| check.addArtifactArg(core_test);
}
- // The terminal module's own tests (src/term/): the emulator without a core.
+ // The terminal module's own tests (core/term/): the emulator without a core.
const run_term_test = units.add(b, b.addTest(.{ .root_module = c.parts.term, .filters = c.test_filters }), null);
- b.step("term-test", "run the terminal module's own tests (src/term/)").dependOn(&run_term_test.step);
+ b.step("term-test", "run the terminal module's own tests (core/term/)").dependOn(&run_term_test.step);
// test/terminal.zig reads the emulator behind a core's terminal.
const pane_tests = units.root(b, "test/panes.zig", true, &.{ .{ .name = "pardes", .module = c.core_module }, .{ .name = "term", .module = c.parts.term }, .{ .name = "plain", .module = c.parts.plain } });
if (c.ghostty_vt_for_tests) |x| pane_tests.root_module.addImport("ghostty-vt", x);
@@ -193,13 +193,14 @@ pub fn add(b: *std.Build, c: struct {
// pty and the shell's output, is the kitty-harness step.
_ = units.add(b, units.root(b, "test/kitty.zig", true, &.{.{ .name = "pardes", .module = c.core_module }}), b.step("kitty-test", "run the kitty graphics conformance cases for terminal panes"));
- // 9p_io.zig's and fs.zig's tests as roots of their own, on the
- // core's imports and C libraries: native transport integration
- // stays reachable even when Zig's filter leaves the core's
- // anonymous test-import block out.
+ // 9p_io.zig's and fs.zig's tests on the core's imports and C
+ // libraries: native transport integration stays reachable even when
+ // Zig's filter leaves the core's anonymous test-import block out. Each
+ // from its module's root (runtime/root.zig, core/root.zig): the
+ // modules name each other by module, whose `core` is the core's root.
for ([_]struct { path: []const u8, step: []const u8, about: []const u8, filters: []const []const u8 }{
.{ .path = "runtime/root.zig", .step = "9p-io-test", .about = "run native 9P transport and client integration tests", .filters = &.{ "Unix and TCP", "one fetch", "expired sessions", "posts itself" } },
- .{ .path = "src/fs.zig", .step = "fs-unit-test", .about = "run filesystem unit tests", .filters = c.test_filters },
+ .{ .path = "core/root.zig", .step = "fs-unit-test", .about = "run filesystem unit tests", .filters = c.test_filters },
}) |t| {
var cfg = c.core_cfg;
cfg.root = t.path;
@@ -214,9 +215,9 @@ pub fn add(b: *std.Build, c: struct {
protocol_step.dependOn(&units.add(b, protocol_tests, null).step);
if (testMatch(b, c.unit_profile, c.test_filters, protocol_step)) |check| check.addArtifactArg(protocol_tests);
_ = units.add(b, units.root(b, "dev/fonts.zig", true, cloud9), null);
- _ = units.add(b, units.root(b, "src/c_heap.zig", false, cloud9), null);
+ _ = units.add(b, units.root(b, "core/c_heap.zig", false, cloud9), null);
// Its lookup goes wrong only where the optimizer folds it.
- _ = units.add(b, b.addTest(.{ .root_module = b.createModule(.{ .target = c.target, .optimize = .safe, .root_source_file = b.path("src/c_heap.zig"), .link_libc = false, .imports = cloud9 }), .filters = c.test_filters }), null);
+ _ = units.add(b, b.addTest(.{ .root_module = b.createModule(.{ .target = c.target, .optimize = .safe, .root_source_file = b.path("core/c_heap.zig"), .link_libc = false, .imports = cloud9 }), .filters = c.test_filters }), null);
_ = units.add(b, units.root(b, "test/deck/replay.zig", null, &.{.{ .name = "deck", .module = b.createModule(.{ .target = c.target, .optimize = c.optimize, .root_source_file = b.path("dev/gui/deck.zig") }) }}), null);
diff --git a/build/tools.zig b/build/tools.zig
index c6f25e6d..1343fef9 100644
--- a/build/tools.zig
+++ b/build/tools.zig
@@ -107,7 +107,7 @@ pub fn add(b: *std.Build, c: struct {
const hxdiff_step = b.step("hxdiff", "compare Helix results (-- --strict cases reference [waivers]; cases alone emits; --parity: a pty pane against a file pane)");
hxdiff_step.dependOn(&run_hxdiff.step);
- // The same cases on the library (src/lib_editor.zig): test/hxlib.zig
+ // The same cases on the library (core/lib_editor.zig): test/hxlib.zig
// types them into an editor value and prints its results, which
// hxdiff holds against helix's goldens, or with `-- --parity`
// against the file pane, so the library cannot drift from either.
@@ -235,7 +235,7 @@ pub fn add(b: *std.Build, c: struct {
// The syntax module's own tests and snapshots, on the core without
// a terminal: its tests reach the editor's modes (modal.zig).
var syntax_cfg = c.lean;
- syntax_cfg.root = "src/syntax.zig";
+ syntax_cfg.root = "core/syntax.zig";
const syntax_module = core.module(b, c.parts, syntax_cfg).root;
const syntax_runner = program(b, "pardes-syntax", "test/syntax.zig", c.target, c.optimize, &.{.{ .name = "syntax", .module = syntax_module }});
const run_syntax = b.addRunArtifact(syntax_runner);