| ... | ... | @@ -1359,12 +1359,7 @@ fn buildOutputType( |
| 1359 | 1359 | } else if (mem.eql(u8, arg, "--zig-lib-dir")) { |
| 1360 | 1360 | override_lib_dir = args_iter.nextOrFatal(); |
| 1361 | 1361 | } else if (mem.eql(u8, arg, "--debug-log")) { |
| 1362 | | if (!build_options.enable_logging) { |
| 1363 | | warn("Zig was compiled without logging enabled (-Dlog). --debug-log has no effect.", .{}); |
| 1364 | | _ = args_iter.nextOrFatal(); |
| 1365 | | } else { |
| 1366 | | try log_scopes.append(arena, args_iter.nextOrFatal()); |
| 1367 | | } |
| 1362 | try addDebugLog(arena, args_iter.nextOrFatal()); |
| 1368 | 1363 | } else if (mem.eql(u8, arg, "--listen")) { |
| 1369 | 1364 | const next_arg = args_iter.nextOrFatal(); |
| 1370 | 1365 | if (mem.eql(u8, next_arg, "-")) { |
| ... | ... | @@ -5098,11 +5093,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8, |
| 5098 | 5093 | if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); |
| 5099 | 5094 | try child_argv.appendSlice(arena, args[i .. i + 2]); |
| 5100 | 5095 | i += 1; |
| 5101 | | if (!build_options.enable_logging) { |
| 5102 | | warn("Zig was compiled without logging enabled (-Dlog). --debug-log has no effect.", .{}); |
| 5103 | | } else { |
| 5104 | | try log_scopes.append(arena, args[i]); |
| 5105 | | } |
| 5096 | try addDebugLog(arena, args[i]); |
| 5106 | 5097 | continue; |
| 5107 | 5098 | } else if (mem.eql(u8, arg, "--debug-compile-errors")) { |
| 5108 | 5099 | if (build_options.enable_debug_extensions) { |
| ... | ... | @@ -5380,6 +5371,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8, |
| 5380 | 5371 | .hash_tok = .none, |
| 5381 | 5372 | .name_tok = 0, |
| 5382 | 5373 | .lazy_status = .eager, |
| 5374 | .remote_package_root = phantom_package_root, |
| 5383 | 5375 | .parent_package_root = phantom_package_root, |
| 5384 | 5376 | .parent_manifest_ast = null, |
| 5385 | 5377 | .prog_node = fetch_prog_node, |
| ... | ... | @@ -5400,6 +5392,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8, |
| 5400 | 5392 | |
| 5401 | 5393 | .module = build_mod, |
| 5402 | 5394 | }; |
| 5395 | |
| 5403 | 5396 | job_queue.all_fetches.appendAssumeCapacity(&fetch); |
| 5404 | 5397 | |
| 5405 | 5398 | job_queue.table.putAssumeCapacityNoClobber( |
| ... | ... | @@ -7034,6 +7027,7 @@ const usage_fetch = |
| 7034 | 7027 | \\ --cache-dir [path] Override path to local cache directory |
| 7035 | 7028 | \\ --pkg-dir [path] Override path to local package directory |
| 7036 | 7029 | \\ --debug-hash Print verbose hash information to stdout |
| 7030 | \\ --debug-log [scope] Enable printing debug/info log messages for scope |
| 7037 | 7031 | \\ --save Add the fetched package to build.zig.zon |
| 7038 | 7032 | \\ --save=[name] Add the fetched package to build.zig.zon as name |
| 7039 | 7033 | \\ --save-exact Add the fetched package to build.zig.zon, storing the URL verbatim |
| ... | ... | @@ -7071,19 +7065,23 @@ fn cmdFetch( |
| 7071 | 7065 | try Io.File.stdout().writeStreamingAll(io, usage_fetch); |
| 7072 | 7066 | return cleanExit(io); |
| 7073 | 7067 | } else if (mem.eql(u8, arg, "--global-cache-dir")) { |
| 7074 | | if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); |
| 7068 | if (i + 1 >= args.len) fatal("expected argument after: {s}", .{arg}); |
| 7075 | 7069 | i += 1; |
| 7076 | 7070 | override_global_cache_dir = args[i]; |
| 7077 | 7071 | } else if (mem.eql(u8, arg, "--cache-dir")) { |
| 7078 | | if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); |
| 7072 | if (i + 1 >= args.len) fatal("expected argument after: {s}", .{arg}); |
| 7079 | 7073 | i += 1; |
| 7080 | 7074 | override_local_cache_dir = args[i]; |
| 7081 | 7075 | } else if (mem.eql(u8, arg, "--pkg-dir")) { |
| 7082 | | if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); |
| 7076 | if (i + 1 >= args.len) fatal("expected argument after: {s}", .{arg}); |
| 7083 | 7077 | i += 1; |
| 7084 | 7078 | override_pkg_dir = args[i]; |
| 7085 | 7079 | } else if (mem.eql(u8, arg, "--debug-hash")) { |
| 7086 | 7080 | debug_hash = true; |
| 7081 | } else if (mem.eql(u8, arg, "--debug-log")) { |
| 7082 | if (i + 1 >= args.len) fatal("expected argument after: {s}", .{arg}); |
| 7083 | i += 1; |
| 7084 | try addDebugLog(arena, args[i]); |
| 7087 | 7085 | } else if (mem.eql(u8, arg, "--save")) { |
| 7088 | 7086 | save = .{ .yes = null }; |
| 7089 | 7087 | } else if (mem.cutPrefix(u8, arg, "--save=")) |rest| { |
| ... | ... | @@ -7172,6 +7170,7 @@ fn cmdFetch( |
| 7172 | 7170 | .hash_tok = .none, |
| 7173 | 7171 | .name_tok = 0, |
| 7174 | 7172 | .lazy_status = .eager, |
| 7173 | .remote_package_root = undefined, |
| 7175 | 7174 | .parent_package_root = undefined, |
| 7176 | 7175 | .parent_manifest_ast = null, |
| 7177 | 7176 | .prog_node = root_prog_node, |
| ... | ... | @@ -7816,3 +7815,11 @@ fn randInt(io: Io, comptime T: type) T { |
| 7816 | 7815 | io.random(@ptrCast(&x)); |
| 7817 | 7816 | return x; |
| 7818 | 7817 | } |
| 7818 | |
| 7819 | fn addDebugLog(arena: Allocator, scope_name: []const u8) error{OutOfMemory}!void { |
| 7820 | if (!build_options.enable_logging) { |
| 7821 | warn("Zig was compiled without logging enabled (-Dlog). --debug-log has no effect.", .{}); |
| 7822 | } else { |
| 7823 | try log_scopes.append(arena, scope_name); |
| 7824 | } |
| 7825 | } |