| ... | ... | @@ -149,7 +149,7 @@ const ErrorStyle = enum { |
| 149 | 149 | }; |
| 150 | 150 | const MultilineErrors = enum { indent, newline, none }; |
| 151 | 151 | const Summary = enum { all, new, failures, line, none }; |
| 152 | | const PrintConfiguration = enum { none, zon, path, tree }; |
| 152 | const PrintConfiguration = enum { none, zon, path, tree, stop }; |
| 153 | 153 | |
| 154 | 154 | const GeneratedFile = struct { |
| 155 | 155 | data: ?[]const u8, |
| ... | ... | @@ -300,7 +300,6 @@ pub fn main(init: process.Init.Minimal) !void { |
| 300 | 300 | var cached_passthru_configure: std.ArrayList(u32) = .empty; |
| 301 | 301 | var forks: std.ArrayList(Fork) = .empty; |
| 302 | 302 | var system_pkg_dir_path: ?[]const u8 = null; |
| 303 | | var fetch_only = false; |
| 304 | 303 | var fetch_mode: Fetch.JobQueue.Mode = .needed; |
| 305 | 304 | var debug_target: ?[]const u8 = null; |
| 306 | 305 | var cache_poison: std.Build.Graph.CachePoison = .pure; |
| ... | ... | @@ -387,12 +386,10 @@ pub fn main(init: process.Init.Minimal) !void { |
| 387 | 386 | override_pkg_dir = nextArgOrFatal(args, &arg_i); |
| 388 | 387 | } else if (mem.eql(u8, arg, "--print-tree")) { |
| 389 | 388 | print_configuration = .tree; |
| 389 | } else if (mem.eql(u8, arg, "--configure")) { |
| 390 | print_configuration = .stop; |
| 390 | 391 | } else if (mem.eql(u8, arg, "--fetch")) { |
| 391 | | fetch_only = true; |
| 392 | | } else if (mem.cutPrefix(u8, arg, "--fetch=")) |rest| { |
| 393 | | fetch_only = true; |
| 394 | | fetch_mode = stringToEnum(Fetch.JobQueue.Mode, rest) orelse |
| 395 | | fatal("expected [needed|all] after \"--fetch=\", found {q}", .{rest}); |
| 392 | fetch_mode = .all; |
| 396 | 393 | } else if (mem.cutPrefix(u8, arg, "--fork=")) |rest| { |
| 397 | 394 | try forks.append(arena, .init(rest)); |
| 398 | 395 | } else if (mem.eql(u8, arg, "--fork")) { |
| ... | ... | @@ -619,7 +616,7 @@ pub fn main(init: process.Init.Minimal) !void { |
| 619 | 616 | } |
| 620 | 617 | } |
| 621 | 618 | |
| 622 | | const early_exit_mode = fetch_only or help_menu or steps_menu or print_configuration != .none; |
| 619 | const early_exit_mode = fetch_mode == .all or help_menu or steps_menu or print_configuration != .none; |
| 623 | 620 | const server_mode = !early_exit_mode and (watch_flag or webui_listen != null or fuzz != null or listen); |
| 624 | 621 | |
| 625 | 622 | process.raiseFileDescriptorLimit(); |
| ... | ... | @@ -793,7 +790,6 @@ pub fn main(init: process.Init.Minimal) !void { |
| 793 | 790 | .parent_progress_node = main_progress_node, |
| 794 | 791 | .fetch_mode = fetch_mode, |
| 795 | 792 | .system_pkg_dir_path = system_pkg_dir_path, |
| 796 | | .fetch_only = fetch_only, |
| 797 | 793 | .print_configuration = print_configuration, |
| 798 | 794 | .forks = forks.items, |
| 799 | 795 | .src_files = &configure_source_files, |
| ... | ... | @@ -822,6 +818,7 @@ pub fn main(init: process.Init.Minimal) !void { |
| 822 | 818 | }, |
| 823 | 819 | .path => unreachable, |
| 824 | 820 | .tree => unreachable, |
| 821 | .stop => return cleanExit(io, &scanned_config), |
| 825 | 822 | } |
| 826 | 823 | |
| 827 | 824 | var maker: Maker = .{ |
| ... | ... | @@ -1134,7 +1131,6 @@ const ConfigureOptions = struct { |
| 1134 | 1131 | parent_progress_node: std.Progress.Node, |
| 1135 | 1132 | fetch_mode: Fetch.JobQueue.Mode, |
| 1136 | 1133 | system_pkg_dir_path: ?[]const u8, |
| 1137 | | fetch_only: bool, |
| 1138 | 1134 | print_configuration: PrintConfiguration, |
| 1139 | 1135 | forks: []Fork, |
| 1140 | 1136 | src_files: *Cache.Manifest.SelfContainedFiles, |
| ... | ... | @@ -1382,20 +1378,22 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { |
| 1382 | 1378 | return error.FailedButCacheIntact; |
| 1383 | 1379 | } |
| 1384 | 1380 | |
| 1385 | | if (options.fetch_only or options.print_configuration == .tree) { |
| 1381 | if (options.fetch_mode == .all) { |
| 1386 | 1382 | _ = io.lockStderr(&.{}, .no_color) catch {}; |
| 1387 | | if (options.print_configuration == .tree) { |
| 1388 | | const NO_COLOR = EnvVar.NO_COLOR.isSet(&graph.environ_map); |
| 1389 | | const CLICOLOR_FORCE = EnvVar.CLICOLOR_FORCE.isSet(&graph.environ_map); |
| 1390 | | printPkgTree(.{ |
| 1391 | | .writer = initStdoutWriter(io), |
| 1392 | | .mode = try .detect(io, .stdout(), NO_COLOR, CLICOLOR_FORCE), |
| 1393 | | }, arena, &job_queue, &fetch) catch |err| switch (err) { |
| 1394 | | error.WriteFailed => return stdout_writer_allocation.err.?, |
| 1395 | | else => |e| return e, |
| 1396 | | }; |
| 1397 | | try stdout_writer_allocation.flush(); |
| 1398 | | } |
| 1383 | process.exit(0); |
| 1384 | } |
| 1385 | |
| 1386 | if (options.print_configuration == .tree) { |
| 1387 | const NO_COLOR = EnvVar.NO_COLOR.isSet(&graph.environ_map); |
| 1388 | const CLICOLOR_FORCE = EnvVar.CLICOLOR_FORCE.isSet(&graph.environ_map); |
| 1389 | printPkgTree(.{ |
| 1390 | .writer = initStdoutWriter(io), |
| 1391 | .mode = try .detect(io, .stdout(), NO_COLOR, CLICOLOR_FORCE), |
| 1392 | }, arena, &job_queue, &fetch) catch |err| switch (err) { |
| 1393 | error.WriteFailed => return stdout_writer_allocation.err.?, |
| 1394 | else => |e| return e, |
| 1395 | }; |
| 1396 | try stdout_writer_allocation.flush(); |
| 1399 | 1397 | process.exit(0); |
| 1400 | 1398 | } |
| 1401 | 1399 | |
| ... | ... | @@ -1677,7 +1675,7 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { |
| 1677 | 1675 | _ = io.lockStderr(&.{}, .no_color) catch {}; |
| 1678 | 1676 | process.exit(0); |
| 1679 | 1677 | }, |
| 1680 | | .none, .zon => {}, |
| 1678 | .none, .zon, .stop => {}, |
| 1681 | 1679 | .tree => unreachable, |
| 1682 | 1680 | } |
| 1683 | 1681 | |