Merge pull request 'Fix #127 and #129 by updating the build files to account for recent 0.14.0-dev updates' (#130) from bsubei/exercises:fix-0.14.0-build-changes into main

Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/130
This commit is contained in:
Chris Boesch 2024-08-04 12:31:21 +00:00
commit d6887f21c8
2 changed files with 11 additions and 11 deletions

View file

@ -274,7 +274,7 @@ const ZiglingStep = struct {
return self; return self;
} }
fn make(step: *Step, prog_node: std.Progress.Node) !void { fn make(step: *Step, options: Step.MakeOptions) !void {
// NOTE: Using exit code 2 will prevent the Zig compiler to print the message: // NOTE: Using exit code 2 will prevent the Zig compiler to print the message:
// "error: the following build command failed with exit code 1:..." // "error: the following build command failed with exit code 1:..."
const self: *ZiglingStep = @alignCast(@fieldParentPtr("step", step)); const self: *ZiglingStep = @alignCast(@fieldParentPtr("step", step));
@ -285,7 +285,7 @@ const ZiglingStep = struct {
return; return;
} }
const exe_path = self.compile(prog_node) catch { const exe_path = self.compile(options.progress_node) catch {
self.printErrors(); self.printErrors();
if (self.exercise.hint) |hint| if (self.exercise.hint) |hint|
@ -295,7 +295,7 @@ const ZiglingStep = struct {
std.process.exit(2); std.process.exit(2);
}; };
self.run(exe_path.?, prog_node) catch { self.run(exe_path.?, options.progress_node) catch {
self.printErrors(); self.printErrors();
if (self.exercise.hint) |hint| if (self.exercise.hint) |hint|
@ -436,7 +436,7 @@ const ZiglingStep = struct {
zig_args.append("--listen=-") catch @panic("OOM"); zig_args.append("--listen=-") catch @panic("OOM");
return try self.step.evalZigProcess(zig_args.items, prog_node); return try self.step.evalZigProcess(zig_args.items, prog_node, false);
} }
fn help(self: *ZiglingStep) void { fn help(self: *ZiglingStep) void {
@ -525,7 +525,7 @@ const PrintStep = struct {
return self; return self;
} }
fn make(step: *Step, _: std.Progress.Node) !void { fn make(step: *Step, _: Step.MakeOptions) !void {
const self: *PrintStep = @alignCast(@fieldParentPtr("step", step)); const self: *PrintStep = @alignCast(@fieldParentPtr("step", step));
print("{s}", .{self.message}); print("{s}", .{self.message});
} }

View file

@ -50,7 +50,7 @@ pub fn addCliTests(b: *std.Build, exercises: []const Exercise) *Step {
case_step.dependOn(&verify.step); case_step.dependOn(&verify.step);
} }
const cleanup = b.addRemoveDirTree(tmp_path); const cleanup = b.addRemoveDirTree(.{ .src_path = .{ .owner = b, .sub_path = tmp_path } });
cleanup.step.dependOn(case_step); cleanup.step.dependOn(case_step);
step.dependOn(&cleanup.step); step.dependOn(&cleanup.step);
@ -82,7 +82,7 @@ pub fn addCliTests(b: *std.Build, exercises: []const Exercise) *Step {
const verify = CheckStep.create(b, exercises, stderr); const verify = CheckStep.create(b, exercises, stderr);
verify.step.dependOn(&cmd.step); verify.step.dependOn(&cmd.step);
const cleanup = b.addRemoveDirTree(tmp_path); const cleanup = b.addRemoveDirTree(.{ .src_path = .{ .owner = b, .sub_path = tmp_path } });
cleanup.step.dependOn(&verify.step); cleanup.step.dependOn(&verify.step);
step.dependOn(&cleanup.step); step.dependOn(&cleanup.step);
@ -150,7 +150,7 @@ const CheckNamedStep = struct {
return self; return self;
} }
fn make(step: *Step, _: std.Progress.Node) !void { fn make(step: *Step, _: Step.MakeOptions) !void {
const b = step.owner; const b = step.owner;
const self: *CheckNamedStep = @alignCast(@fieldParentPtr("step", step)); const self: *CheckNamedStep = @alignCast(@fieldParentPtr("step", step));
const ex = self.exercise; const ex = self.exercise;
@ -202,7 +202,7 @@ const CheckStep = struct {
return self; return self;
} }
fn make(step: *Step, _: std.Progress.Node) !void { fn make(step: *Step, _: Step.MakeOptions) !void {
const b = step.owner; const b = step.owner;
const self: *CheckStep = @alignCast(@fieldParentPtr("step", step)); const self: *CheckStep = @alignCast(@fieldParentPtr("step", step));
const exercises = self.exercises; const exercises = self.exercises;
@ -325,7 +325,7 @@ const FailStep = struct {
return self; return self;
} }
fn make(step: *Step, _: std.Progress.Node) !void { fn make(step: *Step, _: Step.MakeOptions) !void {
const b = step.owner; const b = step.owner;
const self: *FailStep = @alignCast(@fieldParentPtr("step", step)); const self: *FailStep = @alignCast(@fieldParentPtr("step", step));
@ -368,7 +368,7 @@ const HealStep = struct {
return self; return self;
} }
fn make(step: *Step, _: std.Progress.Node) !void { fn make(step: *Step, _: Step.MakeOptions) !void {
const b = step.owner; const b = step.owner;
const self: *HealStep = @alignCast(@fieldParentPtr("step", step)); const self: *HealStep = @alignCast(@fieldParentPtr("step", step));