aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Step.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-02-28 23:58:13 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-03-15 10:48:13 -0700
commit0e078790feaf49964d7a0da3042117ebd10de13b (patch)
treedba66f98f82654a645a1540aea8df7d4f1ed4ca2 /lib/std/Build/Step.zig
parent81376e72057026464e1c17330666d4fb3c5a7ce0 (diff)
downloadzig-0e078790feaf49964d7a0da3042117ebd10de13b.tar.gz
zig-0e078790feaf49964d7a0da3042117ebd10de13b.zip
multiplex compiler progress messages into the build runner
Diffstat (limited to 'lib/std/Build/Step.zig')
-rw-r--r--lib/std/Build/Step.zig13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/std/Build/Step.zig b/lib/std/Build/Step.zig
index 4edece8038..53861683ac 100644
--- a/lib/std/Build/Step.zig
+++ b/lib/std/Build/Step.zig
@@ -1,6 +1,6 @@
id: Id,
name: []const u8,
-makeFn: *const fn (self: *Step) anyerror!void,
+makeFn: MakeFn,
dependencies: std.ArrayList(*Step),
/// This field is empty during execution of the user's build script, and
/// then populated during dependency loop checking in the build runner.
@@ -13,6 +13,8 @@ debug_stack_trace: [n_debug_stack_frames]usize,
result_error_msgs: std.ArrayListUnmanaged([]const u8),
result_error_bundle: std.zig.ErrorBundle,
+pub const MakeFn = *const fn (self: *Step, prog_node: *std.Progress.Node) anyerror!void;
+
const n_debug_stack_frames = 4;
pub const State = enum {
@@ -72,7 +74,7 @@ pub const Id = enum {
pub const Options = struct {
id: Id,
name: []const u8,
- makeFn: *const fn (self: *Step) anyerror!void = makeNoOp,
+ makeFn: MakeFn = makeNoOp,
first_ret_addr: ?usize = null,
};
@@ -101,8 +103,8 @@ pub fn init(allocator: Allocator, options: Options) Step {
/// If the Step's `make` function reports `error.MakeFailed`, it indicates they
/// have already reported the error. Otherwise, we add a simple error report
/// here.
-pub fn make(s: *Step) error{MakeFailed}!void {
- return s.makeFn(s) catch |err| {
+pub fn make(s: *Step, prog_node: *std.Progress.Node) error{MakeFailed}!void {
+ return s.makeFn(s, prog_node) catch |err| {
if (err != error.MakeFailed) {
const gpa = s.dependencies.allocator;
s.result_error_msgs.append(gpa, std.fmt.allocPrint(gpa, "{s} failed: {s}", .{
@@ -129,8 +131,9 @@ pub fn getStackTrace(s: *Step) std.builtin.StackTrace {
};
}
-fn makeNoOp(self: *Step) anyerror!void {
+fn makeNoOp(self: *Step, prog_node: *std.Progress.Node) anyerror!void {
_ = self;
+ _ = prog_node;
}
pub fn cast(step: *Step, comptime T: type) ?*T {