summaryrefslogtreecommitdiffstatshomepage
path: root/build.zig
diff options
context:
space:
mode:
authorManlio Perillo <manlio.perillo@gmail.com>2023-04-10 21:02:54 +0200
committerManlio Perillo <manlio.perillo@gmail.com>2023-04-11 12:45:55 +0200
commit1ee8aabcf3457fe5951958adc11a7c8ca2f3476a (patch)
tree94306c5e8cbe23417842bc0828a5e147fbe6651d /build.zig
parentbe782af7a30456990e7bcc58e40be3ac11e1ce17 (diff)
build: simplify the code when solving all the exercises
Initialize the first step in the chain to the header_step, instead of making the code more complex handling the first step as a special case in the for loop.
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig12
1 files changed, 3 insertions, 9 deletions
diff --git a/build.zig b/build.zig
index 39096fe..8b93e2b 100644
--- a/build.zig
+++ b/build.zig
@@ -643,14 +643,12 @@ pub fn build(b: *Build) !void {
}
const ziglings_step = b.step("ziglings", "Check all ziglings");
- ziglings_step.dependOn(&header_step.step);
b.default_step = ziglings_step;
// Don't use the "multi-object for loop" syntax, in order to avoid a syntax
// error with old Zig compilers.
- var prev_step: *Step = undefined;
+ var prev_step = &header_step.step;
for (exercises) |ex| {
- const n = ex.number();
const base_name = ex.baseName();
const file_path = std.fs.path.join(b.allocator, &[_][]const u8{
"exercises", ex.main_file,
@@ -660,13 +658,9 @@ pub fn build(b: *Build) !void {
build_step.install();
const verify_stepn = ZiglingStep.create(b, ex, use_healed);
- if (n == 1) {
- prev_step = &verify_stepn.step;
- } else {
- verify_stepn.step.dependOn(prev_step);
+ verify_stepn.step.dependOn(prev_step);
- prev_step = &verify_stepn.step;
- }
+ prev_step = &verify_stepn.step;
}
ziglings_step.dependOn(prev_step);