diff options
| author | Manlio Perillo <[email protected]> | 2023-05-07 20:01:02 +0200 |
|---|---|---|
| committer | Manlio Perillo <[email protected]> | 2023-05-09 11:07:22 +0200 |
| commit | 4ae67ebf1b7027cf33ecd96317d745ccf54987fb (patch) | |
| tree | 97be010b1a92f0a379260f98b074e188cb53de1b /build.zig | |
| parent | 185a40eb75689005ace380c7dc9501db4cafe33a (diff) | |
| download | ziglings-4ae67ebf1b7027cf33ecd96317d745ccf54987fb.tar.xz ziglings-4ae67ebf1b7027cf33ecd96317d745ccf54987fb.zip | |
build: don't install skipped exercises
Update the code in `zig build install` and `zig build -Dn=n install`, so
that exercises that must be skipped are not installed, since it will
cause an error. Ensure that a skip message is printed.
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -133,17 +133,20 @@ pub fn build(b: *Build) !void { print("unknown exercise number: {}\n", .{n}); std.os.exit(1); } - const ex = exercises[n - 1]; const build_step = ex.addExecutable(b, work_path); - b.installArtifact(build_step); + + const skip_step = SkipStep.create(b, ex); + if (!ex.skip) + b.installArtifact(build_step) + else + b.getInstallStep().dependOn(&skip_step.step); const run_step = b.addRunArtifact(build_step); const test_step = b.step("test", b.fmt("Run {s} without checking output", .{ex.main_file})); if (ex.skip) { - const skip_step = SkipStep.create(b, ex); test_step.dependOn(&skip_step.step); } else { test_step.dependOn(&run_step.step); @@ -201,7 +204,12 @@ pub fn build(b: *Build) !void { var prev_step = &header_step.step; for (exercises) |ex| { const build_step = ex.addExecutable(b, work_path); - b.installArtifact(build_step); + + const skip_step = SkipStep.create(b, ex); + if (!ex.skip) + b.installArtifact(build_step) + else + b.getInstallStep().dependOn(&skip_step.step); const verify_stepn = ZiglingStep.create(b, ex, work_path); verify_stepn.step.dependOn(prev_step); |
