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