diff options
| author | 2022-08-25 18:07:44 +0200 | |
|---|---|---|
| committer | 2022-08-25 18:07:44 +0200 | |
| commit | ee6cb6a17bd8748c3af45467c5dabbe1d56be832 (patch) | |
| tree | 7686bd4de2dac502ea7eb7e134a46dce7c9a413c /build.zig | |
| parent | Have all tests have a name (diff) | |
| download | zig-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 'build.zig')
| -rw-r--r-- | build.zig | 24 |
1 files changed, 15 insertions, 9 deletions
| @@ -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"); |