Skip to content

Commit 12da866

Browse files
committed
make tools dependant on llvm optional
1 parent a52bcdb commit 12da866

File tree

2 files changed

+226
-141
lines changed

2 files changed

+226
-141
lines changed

FailStep.zig

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// This file implements a fail step for the build system
2+
// it's taken from Zig 0.14.0-dev and pasted here to be
3+
// used temporarily while we still target Zig 0.13.0
4+
const std = @import("std");
5+
const Step = std.Build.Step;
6+
const Fail = @This();
7+
8+
step: Step,
9+
error_msg: []const u8,
10+
11+
pub const base_id: Step.Id = .custom;
12+
13+
pub fn create(owner: *std.Build, error_msg: []const u8) *Fail {
14+
const fail = owner.allocator.create(Fail) catch @panic("OOM");
15+
16+
fail.* = .{
17+
.step = Step.init(.{
18+
.id = base_id,
19+
.name = "fail",
20+
.owner = owner,
21+
.makeFn = make,
22+
}),
23+
.error_msg = owner.dupe(error_msg),
24+
};
25+
26+
return fail;
27+
}
28+
29+
fn make(step: *Step, prog_node: std.Progress.Node) !void {
30+
_ = prog_node;
31+
32+
const fail: *Fail = @fieldParentPtr("step", step);
33+
34+
try step.result_error_msgs.append(step.owner.allocator, fail.error_msg);
35+
36+
return error.MakeFailed;
37+
}

0 commit comments

Comments
 (0)