diff options
| author | 2022-11-15 11:17:21 +0100 | |
|---|---|---|
| committer | 2022-11-15 11:17:21 +0100 | |
| commit | 859de57556dc5b97d6d41fa526beef0c850cf6c8 (patch) | |
| tree | 592231593702f813aad571658a25f0ab94371978 /build.zig | |
| parent | Bump goto-bus-stop/setup-zig from 1.3.0 to 2.0.1 (diff) | |
| download | zig-clap-859de57556dc5b97d6d41fa526beef0c850cf6c8.tar.gz zig-clap-859de57556dc5b97d6d41fa526beef0c850cf6c8.tar.xz zig-clap-859de57556dc5b97d6d41fa526beef0c850cf6c8.zip | |
Don't iterate all configs in build script
Instead, cicd will now have a job for every configuration
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 29 |
1 files changed, 8 insertions, 21 deletions
| @@ -5,32 +5,19 @@ const Builder = std.build.Builder; | |||
| 5 | pub fn build(b: *Builder) void { | 5 | pub fn build(b: *Builder) void { |
| 6 | const mode = b.standardReleaseOptions(); | 6 | const mode = b.standardReleaseOptions(); |
| 7 | const target = b.standardTargetOptions(.{}); | 7 | const target = b.standardTargetOptions(.{}); |
| 8 | const stage1 = b.option(bool, "stage1", "Use the stage 1 compiler") orelse false; | ||
| 8 | 9 | ||
| 9 | const test_all_step = b.step("test", "Run all tests in all modes."); | 10 | const test_step = b.step("test", "Run all tests in all modes."); |
| 10 | for ([_]bool{ true, false }) |stage1| { | 11 | const tests = b.addTest("clap.zig"); |
| 11 | for (std.meta.tags(std.builtin.Mode)) |test_mode| { | 12 | tests.setBuildMode(mode); |
| 12 | const mode_str = @tagName(test_mode); | 13 | tests.setTarget(target); |
| 13 | const stage1_str = if (stage1) "stage1" else "stage2"; | 14 | tests.use_stage1 = stage1; |
| 14 | 15 | test_step.dependOn(&tests.step); | |
| 15 | const tests = b.addTest("clap.zig"); | ||
| 16 | tests.setBuildMode(test_mode); | ||
| 17 | tests.setTarget(target); | ||
| 18 | tests.use_stage1 = stage1; | ||
| 19 | |||
| 20 | const test_step = b.step( | ||
| 21 | b.fmt("test-{s}-{s}", .{ stage1_str, mode_str }), | ||
| 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 | } | ||
| 27 | } | ||
| 28 | 16 | ||
| 29 | const example_step = b.step("examples", "Build examples"); | 17 | const example_step = b.step("examples", "Build examples"); |
| 30 | inline for (.{ | 18 | inline for (.{ |
| 31 | "simple", | 19 | "simple", |
| 32 | "simple-ex", | 20 | "simple-ex", |
| 33 | //"simple-error", | ||
| 34 | "streaming-clap", | 21 | "streaming-clap", |
| 35 | "help", | 22 | "help", |
| 36 | "usage", | 23 | "usage", |
| @@ -49,7 +36,7 @@ pub fn build(b: *Builder) void { | |||
| 49 | readme_step.dependOn(readme); | 36 | readme_step.dependOn(readme); |
| 50 | 37 | ||
| 51 | const all_step = b.step("all", "Build everything and runs all tests"); | 38 | const all_step = b.step("all", "Build everything and runs all tests"); |
| 52 | all_step.dependOn(test_all_step); | 39 | all_step.dependOn(test_step); |
| 53 | all_step.dependOn(example_step); | 40 | all_step.dependOn(example_step); |
| 54 | all_step.dependOn(readme_step); | 41 | all_step.dependOn(readme_step); |
| 55 | 42 | ||