summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGravatar Jimmi Holst Christensen2022-08-25 18:07:44 +0200
committerGravatar Jimmi Holst Christensen2022-08-25 18:07:44 +0200
commitee6cb6a17bd8748c3af45467c5dabbe1d56be832 (patch)
tree7686bd4de2dac502ea7eb7e134a46dce7c9a413c /build.zig
parentHave all tests have a name (diff)
downloadzig-clap-ee6cb6a17bd8748c3af45467c5dabbe1d56be832.tar.gz
zig-clap-ee6cb6a17bd8748c3af45467c5dabbe1d56be832.tar.xz
zig-clap-ee6cb6a17bd8748c3af45467c5dabbe1d56be832.zip
Fix zig-clap for new default compiler
Also enable test suit for both stage 1 and stage 2, to ensure we don't break things for people who haven't switched yet.
Diffstat (limited to '')
-rw-r--r--build.zig24
1 files changed, 15 insertions, 9 deletions
diff --git a/build.zig b/build.zig
index 0d253e2..03834b4 100644
--- a/build.zig
+++ b/build.zig
@@ -7,17 +7,23 @@ pub fn build(b: *Builder) void {
7 const target = b.standardTargetOptions(.{}); 7 const target = b.standardTargetOptions(.{});
8 8
9 const test_all_step = b.step("test", "Run all tests in all modes."); 9 const test_all_step = b.step("test", "Run all tests in all modes.");
10 inline for (@typeInfo(std.builtin.Mode).Enum.fields) |field| { 10 for ([_]bool{ true, false }) |stage1| {
11 const test_mode = @field(std.builtin.Mode, field.name); 11 for (std.meta.tags(std.builtin.Mode)) |test_mode| {
12 const mode_str = @tagName(test_mode); 12 const mode_str = @tagName(test_mode);
13 const stage1_str = if (stage1) "stage1" else "stage2";
13 14
14 const tests = b.addTest("clap.zig"); 15 const tests = b.addTest("clap.zig");
15 tests.setBuildMode(test_mode); 16 tests.setBuildMode(test_mode);
16 tests.setTarget(target); 17 tests.setTarget(target);
18 tests.use_stage1 = stage1;
17 19
18 const test_step = b.step("test-" ++ mode_str, "Run all tests in " ++ mode_str ++ "."); 20 const test_step = b.step(
19 test_step.dependOn(&tests.step); 21 b.fmt("test-{s}-{s}", .{ stage1_str, mode_str }),
20 test_all_step.dependOn(test_step); 22 b.fmt("Run all tests with {s} compiler in {s}.", .{ stage1_str, mode_str }),
23 );
24 test_step.dependOn(&tests.step);
25 test_all_step.dependOn(test_step);
26 }
21 } 27 }
22 28
23 const example_step = b.step("examples", "Build examples"); 29 const example_step = b.step("examples", "Build examples");