mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
Changes the `make` function signature to take an options struct, which additionally includes `watch: bool`. I intentionally am not exposing this information to configure phase logic. Also adds global zig cache to the compiler cache prefixes. Closes #20600
36 lines
831 B
Zig
36 lines
831 B
Zig
//! Fail the build with a given message.
|
|
const std = @import("std");
|
|
const Step = std.Build.Step;
|
|
const Fail = @This();
|
|
|
|
step: Step,
|
|
error_msg: []const u8,
|
|
|
|
pub const base_id: Step.Id = .fail;
|
|
|
|
pub fn create(owner: *std.Build, error_msg: []const u8) *Fail {
|
|
const fail = owner.allocator.create(Fail) catch @panic("OOM");
|
|
|
|
fail.* = .{
|
|
.step = Step.init(.{
|
|
.id = base_id,
|
|
.name = "fail",
|
|
.owner = owner,
|
|
.makeFn = make,
|
|
}),
|
|
.error_msg = owner.dupe(error_msg),
|
|
};
|
|
|
|
return fail;
|
|
}
|
|
|
|
fn make(step: *Step, options: Step.MakeOptions) !void {
|
|
_ = options; // No progress to report.
|
|
|
|
const fail: *Fail = @fieldParentPtr("step", step);
|
|
|
|
try step.result_error_msgs.append(step.owner.allocator, fail.error_msg);
|
|
|
|
return error.MakeFailed;
|
|
}
|