From ee6cb6a17bd8748c3af45467c5dabbe1d56be832 Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Thu, 25 Aug 2022 18:07:44 +0200 Subject: 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. --- build.zig | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'build.zig') 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 { const target = b.standardTargetOptions(.{}); const test_all_step = b.step("test", "Run all tests in all modes."); - inline for (@typeInfo(std.builtin.Mode).Enum.fields) |field| { - const test_mode = @field(std.builtin.Mode, field.name); - const mode_str = @tagName(test_mode); + for ([_]bool{ true, false }) |stage1| { + for (std.meta.tags(std.builtin.Mode)) |test_mode| { + const mode_str = @tagName(test_mode); + const stage1_str = if (stage1) "stage1" else "stage2"; - const tests = b.addTest("clap.zig"); - tests.setBuildMode(test_mode); - tests.setTarget(target); + const tests = b.addTest("clap.zig"); + tests.setBuildMode(test_mode); + tests.setTarget(target); + tests.use_stage1 = stage1; - const test_step = b.step("test-" ++ mode_str, "Run all tests in " ++ mode_str ++ "."); - test_step.dependOn(&tests.step); - test_all_step.dependOn(test_step); + const test_step = b.step( + b.fmt("test-{s}-{s}", .{ stage1_str, mode_str }), + b.fmt("Run all tests with {s} compiler in {s}.", .{ stage1_str, mode_str }), + ); + test_step.dependOn(&tests.step); + test_all_step.dependOn(test_step); + } } const example_step = b.step("examples", "Build examples"); -- cgit v1.2.3