diff options
Diffstat (limited to 'build')
| -rw-r--r-- | build/core.zig | 9 | ||||
| -rw-r--r-- | build/tests.zig | 5 |
2 files changed, 11 insertions, 3 deletions
diff --git a/build/core.zig b/build/core.zig index f9cb450f..c787fdc8 100644 --- a/build/core.zig +++ b/build/core.zig @@ -131,9 +131,11 @@ fn patchesHash(b: *std.Build, io: std.Io) u64 { return h; } -fn vendoredThemes(b: *std.Build, io: std.Io) []const []const u8 { +/// The theme sources in `sub` of vendor/themes, sorted: the ring's (`.`), +/// or the retired ones kept themes inherit from (`base`, read, never rung). +fn vendoredThemes(b: *std.Build, io: std.Io, sub: []const u8) []const []const u8 { var names: std.ArrayList([]const u8) = .empty; - var dir = b.root.root_dir.handle.openDir(io, "vendor/themes", .{ .iterate = true }) catch @panic("open vendor/themes"); + var dir = b.root.root_dir.handle.openDir(io, b.pathJoin(&.{ "vendor/themes", sub }), .{ .iterate = true }) catch @panic("open vendor/themes"); defer dir.close(io); var it = dir.iterate(); while (it.next(io) catch @panic("read vendor/themes")) |e| { @@ -161,7 +163,8 @@ pub fn generatedThemes(b: *std.Build, io: std.Io, target: std.Build.ResolvedTarg }); const run_theme_gen = b.addRunArtifact(theme_gen); const themes_out = run_theme_gen.addOutputDirectoryArg("themes"); - for (vendoredThemes(b, io)) |name| run_theme_gen.addFileArg(b.path(b.fmt("vendor/themes/{s}", .{name}))); + for (vendoredThemes(b, io, ".")) |name| run_theme_gen.addFileArg(b.path(b.fmt("vendor/themes/{s}", .{name}))); + for (vendoredThemes(b, io, "base")) |name| run_theme_gen.addPrefixedFileArg("base=", b.path(b.fmt("vendor/themes/base/{s}", .{name}))); return b.createModule(.{ .target = target, .optimize = optimize, diff --git a/build/tests.zig b/build/tests.zig index 8cf42acd..c35857f7 100644 --- a/build/tests.zig +++ b/build/tests.zig @@ -76,6 +76,11 @@ 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 theme importer's own tests (tools/gen_themes.zig): its mapping, + // rule by rule, on the machine that builds. + const gen_themes_test = b.addTest(.{ .root_module = b.createModule(.{ .root_source_file = b.path("tools/gen_themes.zig"), .target = b.graph.host, .optimize = .debug }), .filters = c.test_filters }); + core_test_step.dependOn(&b.addRunArtifact(gen_themes_test).step); + if (core_match) |check| check.addArtifactArg(gen_themes_test); // 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 (core/term/)").dependOn(&run_term_test.step); |
