build: lazy dependencies — a build loads only what it ships

The 13 /test fixtures and the acpi/fdt discovery pair are .lazy in the
root zon, resolved with b.lazyDependency only when a build actually
bundles them: a plain `zig build` neither compiles the fixtures nor
loads their build files, and only the -Ddiscovery-selected package ever
loads. Fixture packages are uniform (dependency name = artifact name =
boot-path leaf), so the bundled list shrinks to a name loop. Production
manifest byte-identical; the -Dtest-case manifest carries the same 13
entries in the same order; -Ddiscovery=fdt exercises the lazy fdt path.
Discharges the plan's deferred what-this-buys #4.
This commit is contained in:
Daniel Samson
2026-07-30 06:26:22 +01:00
parent d27670ec39
commit c621b649f6
3 changed files with 63 additions and 65 deletions
+18 -15
View File
@@ -51,26 +51,29 @@
.@"device-manager" = .{ .path = "system/services/device-manager" },
.input = .{ .path = "system/services/input" },
.logger = .{ .path = "system/services/logger" },
.acpi = .{ .path = "system/services/acpi" },
.fdt = .{ .path = "system/services/fdt" },
// The discovery pair and the /test fixtures are lazy: only what a
// given build actually ships gets its build file loaded and compiled
// (-Ddiscovery picks one of the pair; -Dtest-case pulls the fixtures).
.acpi = .{ .path = "system/services/acpi", .lazy = true },
.fdt = .{ .path = "system/services/fdt", .lazy = true },
.@"ps2-bus" = .{ .path = "system/drivers/ps2-bus" },
.@"usb-xhci-bus" = .{ .path = "system/drivers/usb-xhci-bus" },
.@"usb-hid" = .{ .path = "system/drivers/usb-hid" },
.@"usb-storage" = .{ .path = "system/drivers/usb-storage" },
.@"virtio-gpu" = .{ .path = "system/drivers/virtio-gpu" },
.@"vfs-test" = .{ .path = "test/system/services/vfs-test" },
.@"fat-test" = .{ .path = "test/system/services/fat-test" },
.@"shared-memory-server" = .{ .path = "test/system/services/shared-memory-server" },
.@"shared-memory-client" = .{ .path = "test/system/services/shared-memory-client" },
.@"crash-test" = .{ .path = "test/system/services/crash-test" },
.@"device-list" = .{ .path = "test/system/services/device-list" },
.@"pci-cap-test" = .{ .path = "test/system/services/pci-cap-test" },
.@"iommu-fault-test" = .{ .path = "test/system/services/iommu-fault-test" },
.@"input-source" = .{ .path = "test/system/services/input-source" },
.@"input-test" = .{ .path = "test/system/services/input-test" },
.@"args-echo" = .{ .path = "test/system/services/args-echo" },
.@"process-test" = .{ .path = "test/system/services/process-test" },
.@"thread-test" = .{ .path = "test/system/services/thread-test" },
.@"vfs-test" = .{ .path = "test/system/services/vfs-test", .lazy = true },
.@"fat-test" = .{ .path = "test/system/services/fat-test", .lazy = true },
.@"shared-memory-server" = .{ .path = "test/system/services/shared-memory-server", .lazy = true },
.@"shared-memory-client" = .{ .path = "test/system/services/shared-memory-client", .lazy = true },
.@"crash-test" = .{ .path = "test/system/services/crash-test", .lazy = true },
.@"device-list" = .{ .path = "test/system/services/device-list", .lazy = true },
.@"pci-cap-test" = .{ .path = "test/system/services/pci-cap-test", .lazy = true },
.@"iommu-fault-test" = .{ .path = "test/system/services/iommu-fault-test", .lazy = true },
.@"input-source" = .{ .path = "test/system/services/input-source", .lazy = true },
.@"input-test" = .{ .path = "test/system/services/input-test", .lazy = true },
.@"args-echo" = .{ .path = "test/system/services/args-echo", .lazy = true },
.@"process-test" = .{ .path = "test/system/services/process-test", .lazy = true },
.@"thread-test" = .{ .path = "test/system/services/thread-test", .lazy = true },
// See `zig fetch --save <url>` for a command-line interface for adding dependencies.
//.example = .{
// // When updating this field to a new URL, be sure to delete the corresponding