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