summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-18 21:43:03 -0300
committerGabriel Schneider <[email protected]>2026-11-18 22:03:06 -0300
commit92d553123673376adf6126ab90d49a22c5b833d2 (patch)
tree2a4e83a7e5a0d8766358ce87ccebba72b95f9a2a /build
parentf9a3179542012ec1a700e2020ac9f616b819f972 (diff)
downloadpardes-92d553123673376adf6126ab90d49a22c5b833d2.tar.gz
pardes-92d553123673376adf6126ab90d49a22c5b833d2.zip
abi: plain.zig and term.zig, the addon header and its Zig module, pardes.h and the replica stream's wire into abi/ (the reorganisation's tree, step 2c; abi.zig, the seam, is step 12's): plain, the addon's and pardes.h's modules as before from their new place, the wire a module of its own (`wire`, named by the core, the runtime and main.zig); shell-test runs the wire's tests on the core's set, since a window's set links the window's C, whose allocator gui.zig holds; nothing else changes: the ledger, 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.zig22
-rw-r--r--build/macos.zig8
-rw-r--r--build/tests.zig10
3 files changed, 24 insertions, 16 deletions
diff --git a/build/core.zig b/build/core.zig
index 56a047c0..26de1669 100644
--- a/build/core.zig
+++ b/build/core.zig
@@ -250,7 +250,7 @@ pub fn editorModule(b: *std.Build, name: ?[]const u8, target: std.Build.Resolved
var lib_cfg = cfg;
lib_cfg.lib = true;
m.addOptions("pardes_config", shellOptions(b, lib_cfg, .tui));
- m.addImport("plain", b.createModule(.{ .target = target, .optimize = optimize, .root_source_file = b.path("src/plain/plain.zig") }));
+ 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);
m.addImport("mvzr", d.mvzr);
@@ -274,7 +274,7 @@ pub const Parts = struct {
pdf: ?*std.Build.Module,
term: *std.Build.Module,
plain: *std.Build.Module,
- /// The kinds' C ABI (src/kinds/pardes_addon.h), translated.
+ /// The kinds' C ABI (abi/pardes_addon.h), translated.
kind: *std.Build.Module,
themes: *std.Build.Module,
ts: TreeSitter,
@@ -318,8 +318,9 @@ pub const Core = struct {
util: bool = false,
};
-/// What `module` makes: the core, the devices and the runtime, each naming
-/// the others (`core`, `dev`, `runtime`), and the module a compile roots at.
+/// What `module` makes: the core, the devices, the runtime and the replica
+/// stream's wire (abi/wire.zig), each naming the others (`core`, `dev`,
+/// `runtime`, `wire`), and the module a compile roots at.
pub const Modules = struct {
/// A product's own file (runtime/main.zig, runtime/macos.zig) naming
/// both, the runtime, or the core.
@@ -327,6 +328,7 @@ pub const Modules = struct {
core: *std.Build.Module,
dev: *std.Build.Module,
runtime: *std.Build.Module,
+ wire: *std.Build.Module,
};
/// A core and the devices and runtime beside it, everything they import
@@ -361,6 +363,7 @@ pub fn module(b: *std.Build, p: Parts, c: Core) Modules {
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 });
+ const wire = b.createModule(.{ .target = p.target, .optimize = p.optimize, .root_source_file = b.path("abi/wire.zig"), .link_libc = true });
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.
@@ -370,7 +373,7 @@ pub fn module(b: *std.Build, p: Parts, c: Core) Modules {
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();
- for ([_]*std.Build.Module{ m, dev, runtime, root }) |x| {
+ 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);
@@ -394,8 +397,9 @@ pub fn module(b: *std.Build, p: Parts, c: Core) Modules {
x.addImport("core", m);
x.addImport("dev", dev);
x.addImport("runtime", runtime);
+ x.addImport("wire", wire);
}
- return .{ .root = root, .core = m, .dev = dev, .runtime = runtime };
+ return .{ .root = root, .core = m, .dev = dev, .runtime = runtime, .wire = wire };
}
/// What `assemble` makes besides the parts: the shells' options, the
@@ -497,9 +501,9 @@ pub fn assemble(b: *std.Build, c: struct {
// The kinds' C ABI (src/kinds/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("src/kinds/pardes_addon.h"), .target = target, .optimize = optimize }).createModule();
+ 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).
- const addon_mod = b.createModule(.{ .root_source_file = b.path("src/kinds/addon.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "pardes_addon", .module = kind_mod }} });
+ 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,
.c_optimize = c_optimize,
@@ -590,7 +594,7 @@ pub fn assemble(b: *std.Build, c: struct {
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).
- const plain_mod = b.createModule(.{ .root_source_file = b.path("src/plain/plain.zig"), .target = target, .optimize = optimize });
+ 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
// 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 });
diff --git a/build/macos.zig b/build/macos.zig
index b865740e..c485d7c2 100644
--- a/build/macos.zig
+++ b/build/macos.zig
@@ -17,7 +17,7 @@ pub fn add(b: *std.Build, c: struct {
unit_profile: *std.Build.Step.Compile,
}) void {
const header = b.addTranslateC(.{
- .root_source_file = b.path("src/macos/pardes.h"),
+ .root_source_file = b.path("abi/pardes.h"),
.target = c.target,
.optimize = c.optimize,
});
@@ -39,7 +39,7 @@ pub fn add(b: *std.Build, c: struct {
else
&b.addInstallArtifact(lib, .{}).step;
b.getInstallStep().dependOn(install_lib);
- b.installFile("src/macos/pardes.h", "include/pardes.h");
+ b.installFile("abi/pardes.h", "include/pardes.h");
const app_step = b.step("macos-app", "assemble zig-out/pardes.app (needs macOS + swiftc)");
const dmg_step = b.step("macos-dmg", "package zig-out/pardes.dmg for distribution (needs macOS + swiftc)");
@@ -58,7 +58,7 @@ pub fn add(b: *std.Build, c: struct {
};
const link = b.addSystemCommand(&.{ "swiftc", swift_mode, "-target", triple, "-import-objc-header" });
- link.addFileArg(b.path("src/macos/pardes.h"));
+ link.addFileArg(b.path("abi/pardes.h"));
link.addArg("-o");
const app_bin = link.addOutputFileArg("pardes");
for ([_][]const u8{
@@ -145,7 +145,7 @@ pub fn add(b: *std.Build, c: struct {
const arch = if (c.target.result.cpu.arch == .aarch64) "arm64" else @tagName(c.target.result.cpu.arch);
const triple = b.fmt("{s}-apple-macos{d}.{d}", .{ arch, macos_min_version.major, macos_min_version.minor });
const e2e = b.addSystemCommand(&.{ "swiftc", "-O", "-target", triple, "-import-objc-header" });
- e2e.addFileArg(b.path("src/macos/pardes.h"));
+ e2e.addFileArg(b.path("abi/pardes.h"));
e2e.addArg("-o");
const e2e_bin = e2e.addOutputFileArg("pardes-macos-e2e");
for ([_][]const u8{
diff --git a/build/tests.zig b/build/tests.zig
index d351684d..0eaf7c63 100644
--- a/build/tests.zig
+++ b/build/tests.zig
@@ -13,6 +13,8 @@ pub fn add(b: *std.Build, c: struct {
core_lean: core.Modules,
/// The shell's root, core, devices and runtime: shell-test.
root_set: core.Modules,
+ /// The wire (abi/wire.zig) on the core's configuration: shell-test's.
+ core_wire: *std.Build.Module,
core_module: *std.Build.Module,
/// core_module's configuration, for the test roots that run on its imports.
core_cfg: core.Core,
@@ -65,7 +67,7 @@ pub fn add(b: *std.Build, c: struct {
_ = units.add(b, units.root(b, "test/fs_bench.zig", null, &.{}), null);
const core_test_step = b.step("core-test", "run core tests without native shell tests, on the core without a terminal (a test that needs one skips), and the devices' and the runtime's beside it");
const core_match = testMatch(b, c.unit_profile, c.test_filters, core_test_step);
- for ([_]*std.Build.Module{ c.core_lean.core, c.core_lean.dev, c.core_lean.runtime }) |m| {
+ for ([_]*std.Build.Module{ c.core_lean.core, c.core_lean.dev, c.core_lean.runtime, c.core_lean.wire }) |m| {
const core_test = b.addTest(.{ .root_module = m, .filters = c.test_filters });
const run_core_test = b.addRunArtifact(core_test);
run_core_test.has_side_effects = true;
@@ -112,7 +114,7 @@ pub fn add(b: *std.Build, c: struct {
.{ "fake_addon_no_dump", "-DFAKE_NO_DUMP" },
}) |variant| {
const lib = b.addLibrary(.{ .name = variant[0], .linkage = .dynamic, .root_module = b.createModule(.{ .target = c.target, .optimize = c.optimize, .link_libc = true }) });
- lib.root_module.addIncludePath(b.path("src/kinds"));
+ lib.root_module.addIncludePath(b.path("abi"));
const name_flag = if (std.mem.eql(u8, variant[0], "fake_addon_abi")) "-DFAKE_NAME=\"fakeabi\"" else if (std.mem.eql(u8, variant[0], "fake_addon_core_word")) "-DFAKE_NAME=\"fakeword\"" else "-DFAKE_PLAIN";
// The header is the whole contract: it compiles clean under every warning.
lib.root_module.addCSourceFile(.{ .file = b.path("addons/fake/fake.c"), .flags = &.{ "-std=c11", "-Wall", "-Wextra", "-Werror", "-Wno-override-init", variant[1], name_flag } });
@@ -222,7 +224,9 @@ pub fn add(b: *std.Build, c: struct {
// The native shell's tests alone, without the perf gate's
// ReleaseFast build: what a -Dtest-filter iteration wants.
const shell_test_step = b.step("shell-test", "run the native shell's unit tests (runtime/main.zig's, and its core's, devices' and runtime's)");
- for ([_]*std.Build.Module{ c.root_set.root, c.root_set.core, c.root_set.dev, c.root_set.runtime }) |m|
+ // The wire's on the core's own set: a window's set links the window's C,
+ // whose allocator is gui.zig's, which nothing in the wire reaches.
+ for ([_]*std.Build.Module{ c.root_set.root, c.root_set.core, c.root_set.dev, c.root_set.runtime, c.core_wire }) |m|
shell_test_step.dependOn(&units.add(b, b.addTest(.{ .root_module = m, .filters = c.test_filters }), null).step);
const profile_test = b.addExecutable(.{
.name = "pardes-unit-profile-test",