authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-14 22:27:51-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-14 22:27:51-07:00
log445bd7a06fc34c9a59c6458774769bfaa2757a2f
treeaf9b8bd71c260c2e5d9539df6d2371f29cffa224
parent987f63208e4bdd044768465f1581d03ee8964e28

build runner: update watch caption to include subprocesses


3 files changed, 12 insertions(+), 5 deletions(-)

lib/compiler/build_runner.zig+10-3
......@@ -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
447fn 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
448455const Run = struct {
449456 max_rss: u64,
450457 max_rss_is_default: bool,
lib/std/Build.zig+1-1
......@@ -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
126126const AvailableDeps = []const struct { []const u8, []const u8 };
lib/std/Build/Step.zig+1-1
......@@ -603,7 +603,7 @@ fn zigProcessUpdate(s: *Step, zp: *ZigProcess, watch: bool) !?[]const u8 {
603603 return result;
604604}
605605
606fn getZigProcess(s: *Step) ?*ZigProcess {
606pub fn getZigProcess(s: *Step) ?*ZigProcess {
607607 return switch (s.id) {
608608 .compile => s.cast(Compile).?.zig_process,
609609 else => null,