Skip to content

Commit

Permalink
Fix test and benchmakr order in root project
Browse files Browse the repository at this point in the history
  • Loading branch information
ACSimon33 committed Dec 12, 2024
1 parent b450e09 commit b712095
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 29 deletions.
6 changes: 3 additions & 3 deletions 2024/00/zig_template/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void {
run_cmd.addArgs(args);
}

const run_step = b.step("run", "Run the zig_template (day 00) app");
const run_step = b.step("run", "Run the Zig Template (day 00) app");
run_step.dependOn(&run_cmd.step);

// --------------------------- Example tests ---------------------------- \\
Expand All @@ -45,7 +45,7 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(zig_template_tests);

const test_step = b.step("test", "Run zig_template (day 00) tests");
const test_step = b.step("test", "Run Zig Template (day 00) tests");
test_step.dependOn(&b.addRunArtifact(zig_template_tests).step);

// ------------------------- Puzzle benchmarks -------------------------- \\
Expand All @@ -67,6 +67,6 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(zig_template_benchmarks);

const benchmark_step = b.step("benchmark", "Run zig_template (day 00) benchmarks");
const benchmark_step = b.step("benchmark", "Run Zig Template (day 00) benchmarks");
benchmark_step.dependOn(&b.addRunArtifact(zig_template_benchmarks).step);
}
6 changes: 3 additions & 3 deletions 2024/01/historian_hysteria/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void {
run_cmd.addArgs(args);
}

const run_step = b.step("run", "Run the historian_hysteria (day 01) app");
const run_step = b.step("run", "Run the Historian Hysteria (day 01) app");
run_step.dependOn(&run_cmd.step);

// --------------------------- Example tests ---------------------------- \\
Expand All @@ -45,7 +45,7 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(historian_hysteria_tests);

const test_step = b.step("test", "Run historian_hysteria (day 01) tests");
const test_step = b.step("test", "Run Historian Hysteria (day 01) tests");
test_step.dependOn(&b.addRunArtifact(historian_hysteria_tests).step);

// ------------------------- Puzzle benchmarks -------------------------- \\
Expand All @@ -67,6 +67,6 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(historian_hysteria_benchmarks);

const benchmark_step = b.step("benchmark", "Run historian_hysteria (day 01) benchmarks");
const benchmark_step = b.step("benchmark", "Run Historian Hysteria (day 01) benchmarks");
benchmark_step.dependOn(&b.addRunArtifact(historian_hysteria_benchmarks).step);
}
6 changes: 3 additions & 3 deletions 2024/02/red_nosed_reports/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void {
run_cmd.addArgs(args);
}

const run_step = b.step("run", "Run the red_nosed_reports (day 02) app");
const run_step = b.step("run", "Run the Red Nosed Reports (day 02) app");
run_step.dependOn(&run_cmd.step);

// --------------------------- Example tests ---------------------------- \\
Expand All @@ -45,7 +45,7 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(red_nosed_reports_tests);

const test_step = b.step("test", "Run red_nosed_reports (day 02) tests");
const test_step = b.step("test", "Run Red Nosed Reports (day 02) tests");
test_step.dependOn(&b.addRunArtifact(red_nosed_reports_tests).step);

// ------------------------- Puzzle benchmarks -------------------------- \\
Expand All @@ -67,6 +67,6 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(red_nosed_reports_benchmarks);

const benchmark_step = b.step("benchmark", "Run red_nosed_reports (day 02) benchmarks");
const benchmark_step = b.step("benchmark", "Run Red Nosed Reports (day 02) benchmarks");
benchmark_step.dependOn(&b.addRunArtifact(red_nosed_reports_benchmarks).step);
}
6 changes: 3 additions & 3 deletions 2024/03/mull_it_over/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void {
run_cmd.addArgs(args);
}

const run_step = b.step("run", "Run the mull_it_over (day 03) app");
const run_step = b.step("run", "Run the Mull It Over (day 03) app");
run_step.dependOn(&run_cmd.step);

// --------------------------- Example tests ---------------------------- \\
Expand All @@ -48,7 +48,7 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(mull_it_over_tests);

const test_step = b.step("test", "Run mull_it_over (day 03) tests");
const test_step = b.step("test", "Run Mull It Over (day 03) tests");
test_step.dependOn(&b.addRunArtifact(mull_it_over_tests).step);

// ------------------------- Puzzle benchmarks -------------------------- \\
Expand All @@ -70,6 +70,6 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(mull_it_over_benchmarks);

const benchmark_step = b.step("benchmark", "Run mull_it_over (day 03) benchmarks");
const benchmark_step = b.step("benchmark", "Run Mull It Over (day 03) benchmarks");
benchmark_step.dependOn(&b.addRunArtifact(mull_it_over_benchmarks).step);
}
6 changes: 3 additions & 3 deletions 2024/06/guard_gallivant/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void {
run_cmd.addArgs(args);
}

const run_step = b.step("run", "Run the guard_gallivant (day 06) app");
const run_step = b.step("run", "Run the Guard Gallivant (day 06) app");
run_step.dependOn(&run_cmd.step);

// --------------------------- Example tests ---------------------------- \\
Expand All @@ -45,7 +45,7 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(guard_gallivant_tests);

const test_step = b.step("test", "Run guard_gallivant (day 06) tests");
const test_step = b.step("test", "Run Guard Gallivant (day 06) tests");
test_step.dependOn(&b.addRunArtifact(guard_gallivant_tests).step);

// ------------------------- Puzzle benchmarks -------------------------- \\
Expand All @@ -67,6 +67,6 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(guard_gallivant_benchmarks);

const benchmark_step = b.step("benchmark", "Run guard_gallivant (day 06) benchmarks");
const benchmark_step = b.step("benchmark", "Run Guard Gallivant (day 06) benchmarks");
benchmark_step.dependOn(&b.addRunArtifact(guard_gallivant_benchmarks).step);
}
6 changes: 3 additions & 3 deletions 2024/09/disk_fragmenter/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void {
run_cmd.addArgs(args);
}

const run_step = b.step("run", "Run the disk_fragmenter (day 09) app");
const run_step = b.step("run", "Run the Disk Fragmenter (day 09) app");
run_step.dependOn(&run_cmd.step);

// --------------------------- Example tests ---------------------------- \\
Expand All @@ -45,7 +45,7 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(disk_fragmenter_tests);

const test_step = b.step("test", "Run disk_fragmenter (day 09) tests");
const test_step = b.step("test", "Run Disk Fragmenter (day 09) tests");
test_step.dependOn(&b.addRunArtifact(disk_fragmenter_tests).step);

// ------------------------- Puzzle benchmarks -------------------------- \\
Expand All @@ -67,6 +67,6 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(disk_fragmenter_benchmarks);

const benchmark_step = b.step("benchmark", "Run disk_fragmenter (day 09) benchmarks");
const benchmark_step = b.step("benchmark", "Run Disk Fragmenter (day 09) benchmarks");
benchmark_step.dependOn(&b.addRunArtifact(disk_fragmenter_benchmarks).step);
}
6 changes: 3 additions & 3 deletions 2024/10/hoof_it/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void {
run_cmd.addArgs(args);
}

const run_step = b.step("run", "Run the hoof_it (day 10) app");
const run_step = b.step("run", "Run the Hoof It (day 10) app");
run_step.dependOn(&run_cmd.step);

// --------------------------- Example tests ---------------------------- \\
Expand All @@ -51,7 +51,7 @@ pub fn build(b: *std.Build) void {
}
b.installArtifact(hoof_it_tests);

const test_step = b.step("test", "Run hoof_it (day 10) tests");
const test_step = b.step("test", "Run Hoof It (day 10) tests");
test_step.dependOn(&b.addRunArtifact(hoof_it_tests).step);

// ------------------------- Puzzle benchmarks -------------------------- \\
Expand All @@ -73,6 +73,6 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(hoof_it_benchmarks);

const benchmark_step = b.step("benchmark", "Run hoof_it (day 10) benchmarks");
const benchmark_step = b.step("benchmark", "Run Hoof It (day 10) benchmarks");
benchmark_step.dependOn(&b.addRunArtifact(hoof_it_benchmarks).step);
}
6 changes: 3 additions & 3 deletions 2024/11/plutonian_pebbles/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void {
run_cmd.addArgs(args);
}

const run_step = b.step("run", "Run the plutonian_pebbles (day 11) app");
const run_step = b.step("run", "Run the Plutonian Pebbles (day 11) app");
run_step.dependOn(&run_cmd.step);

// --------------------------- Example tests ---------------------------- \\
Expand All @@ -45,7 +45,7 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(plutonian_pebbles_tests);

const test_step = b.step("test", "Run plutonian_pebbles (day 11) tests");
const test_step = b.step("test", "Run Plutonian Pebbles (day 11) tests");
test_step.dependOn(&b.addRunArtifact(plutonian_pebbles_tests).step);

// ------------------------- Puzzle benchmarks -------------------------- \\
Expand All @@ -67,6 +67,6 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(plutonian_pebbles_benchmarks);

const benchmark_step = b.step("benchmark", "Run plutonian_pebbles (day 11) benchmarks");
const benchmark_step = b.step("benchmark", "Run Plutonian Pebbles (day 11) benchmarks");
benchmark_step.dependOn(&b.addRunArtifact(plutonian_pebbles_benchmarks).step);
}
6 changes: 3 additions & 3 deletions 2024/12/garden_groups/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void {
run_cmd.addArgs(args);
}

const run_step = b.step("run", "Run the garden_groups (day 12) app");
const run_step = b.step("run", "Run the Garden Groups (day 12) app");
run_step.dependOn(&run_cmd.step);

// --------------------------- Example tests ---------------------------- \\
Expand All @@ -51,7 +51,7 @@ pub fn build(b: *std.Build) void {
}
b.installArtifact(garden_groups_tests);

const test_step = b.step("test", "Run garden_groups (day 12) tests");
const test_step = b.step("test", "Run Garden Groups (day 12) tests");
test_step.dependOn(&b.addRunArtifact(garden_groups_tests).step);

// ------------------------- Puzzle benchmarks -------------------------- \\
Expand All @@ -73,6 +73,6 @@ pub fn build(b: *std.Build) void {
});
b.installArtifact(garden_groups_benchmarks);

const benchmark_step = b.step("benchmark", "Run garden_groups (day 12) benchmarks");
const benchmark_step = b.step("benchmark", "Run Garden Groups (day 12) benchmarks");
benchmark_step.dependOn(&b.addRunArtifact(garden_groups_benchmarks).step);
}
18 changes: 16 additions & 2 deletions 2024/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const ResolvedTarget = std.Build.ResolvedTarget;
const OptimizeMode = std.builtin.OptimizeMode;
const Step = std.Build.Step;

var previous_test_step: ?*Step = null;
var previous_benchmark_step: ?*Step = null;

/// Add a dependency for each day
fn add_subproject(
b: *std.Build,
Expand All @@ -19,8 +22,19 @@ fn add_subproject(
.optimize = optimize,
});

test_step.dependOn(&b.addRunArtifact(subproject.artifact(name ++ "_tests")).step);
benchmark_step.dependOn(&b.addRunArtifact(subproject.artifact(name ++ "_benchmarks")).step);
const subproject_test_step = &b.addRunArtifact(subproject.artifact(name ++ "_tests")).step;
if (previous_test_step) |prev_subproject_test_step| {
subproject_test_step.dependOn(prev_subproject_test_step);
}
test_step.dependOn(subproject_test_step);
previous_test_step = subproject_test_step;

const subproject_benchmark_step = &b.addRunArtifact(subproject.artifact(name ++ "_benchmarks")).step;
if (previous_benchmark_step) |prev_subproject_benchmark_step| {
subproject_benchmark_step.dependOn(prev_subproject_benchmark_step);
}
benchmark_step.dependOn(subproject_benchmark_step);
previous_benchmark_step = subproject_benchmark_step;
}

pub fn build(b: *std.Build) void {
Expand Down

0 comments on commit b712095

Please sign in to comment.