Skip to content

Commit 445bd7a

Browse files
committed
build runner: update watch caption to include subprocesses
1 parent 987f632 commit 445bd7a

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

lib/compiler/build_runner.zig

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ pub fn main() !void {
7272
.query = .{},
7373
.result = try std.zig.system.resolveTargetQuery(.{}),
7474
},
75-
.incremental = null,
7675
};
7776

7877
graph.cache.addPrefix(.{ .path = null, .handle = std.fs.cwd() });
@@ -411,8 +410,8 @@ pub fn main() !void {
411410
// trigger a rebuild on all steps with modified inputs, as well as their
412411
// recursive dependants.
413412
var caption_buf: [std.Progress.Node.max_name_len]u8 = undefined;
414-
const caption = std.fmt.bufPrint(&caption_buf, "Watching {d} Directories", .{
415-
w.dir_table.entries.len,
413+
const caption = std.fmt.bufPrint(&caption_buf, "watching {d} directories, {d} processes", .{
414+
w.dir_table.entries.len, countSubProcesses(run.step_stack.keys()),
416415
}) catch &caption_buf;
417416
var debouncing_node = main_progress_node.start(caption, 0);
418417
var debounce_timeout: Watch.Timeout = .none;
@@ -445,6 +444,14 @@ fn markFailedStepsDirty(gpa: Allocator, all_steps: []const *Step) void {
445444
};
446445
}
447446

447+
fn countSubProcesses(all_steps: []const *Step) usize {
448+
var count: usize = 0;
449+
for (all_steps) |s| {
450+
count += @intFromBool(s.getZigProcess() != null);
451+
}
452+
return count;
453+
}
454+
448455
const Run = struct {
449456
max_rss: u64,
450457
max_rss_is_default: bool,

lib/std/Build.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub const Graph = struct {
120120
needed_lazy_dependencies: std.StringArrayHashMapUnmanaged(void) = .{},
121121
/// Information about the native target. Computed before build() is invoked.
122122
host: ResolvedTarget,
123-
incremental: ?bool,
123+
incremental: ?bool = null,
124124
};
125125

126126
const AvailableDeps = []const struct { []const u8, []const u8 };

lib/std/Build/Step.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ fn zigProcessUpdate(s: *Step, zp: *ZigProcess, watch: bool) !?[]const u8 {
603603
return result;
604604
}
605605

606-
fn getZigProcess(s: *Step) ?*ZigProcess {
606+
pub fn getZigProcess(s: *Step) ?*ZigProcess {
607607
return switch (s.id) {
608608
.compile => s.cast(Compile).?.zig_process,
609609
else => null,

0 commit comments

Comments
 (0)