mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-22 14:03:10 -05:00
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.
This commit is contained in:
parent
be782af7a3
commit
1ee8aabcf3
1 changed files with 3 additions and 9 deletions
|
@ -643,14 +643,12 @@ pub fn build(b: *Build) !void {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ziglings_step = b.step("ziglings", "Check all ziglings");
|
const ziglings_step = b.step("ziglings", "Check all ziglings");
|
||||||
ziglings_step.dependOn(&header_step.step);
|
|
||||||
b.default_step = ziglings_step;
|
b.default_step = ziglings_step;
|
||||||
|
|
||||||
// Don't use the "multi-object for loop" syntax, in order to avoid a syntax
|
// Don't use the "multi-object for loop" syntax, in order to avoid a syntax
|
||||||
// error with old Zig compilers.
|
// error with old Zig compilers.
|
||||||
var prev_step: *Step = undefined;
|
var prev_step = &header_step.step;
|
||||||
for (exercises) |ex| {
|
for (exercises) |ex| {
|
||||||
const n = ex.number();
|
|
||||||
const base_name = ex.baseName();
|
const base_name = ex.baseName();
|
||||||
const file_path = std.fs.path.join(b.allocator, &[_][]const u8{
|
const file_path = std.fs.path.join(b.allocator, &[_][]const u8{
|
||||||
"exercises", ex.main_file,
|
"exercises", ex.main_file,
|
||||||
|
@ -660,14 +658,10 @@ pub fn build(b: *Build) !void {
|
||||||
build_step.install();
|
build_step.install();
|
||||||
|
|
||||||
const verify_stepn = ZiglingStep.create(b, ex, use_healed);
|
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);
|
ziglings_step.dependOn(prev_step);
|
||||||
|
|
||||||
const test_step = b.step("test", "Run all the tests");
|
const test_step = b.step("test", "Run all the tests");
|
||||||
|
|
Loading…
Reference in a new issue