diff --git a/lib/compiler/Maker/ScannedConfig.zig b/lib/compiler/Maker/ScannedConfig.zig index 5bb3a9871f53a1c50bb994cd73483315673f23c5..0f40833fc33e0672efdb46e1ef88427c91e78492 100644 --- a/lib/compiler/Maker/ScannedConfig.zig +++ b/lib/compiler/Maker/ScannedConfig.zig @@ -343,7 +343,7 @@ pub fn printUsage(sc: *const ScannedConfig, graph: *Graph, w: *Writer) !void { \\ --fetch[=mode] Fetch dependency tree (optionally choose laziness) and exit \\ needed (Default) Lazy dependencies are fetched as needed \\ all Lazy dependencies are always fetched - \\ --fork=[path] Override one or more projects from dependency tree + \\ --fork=[path], --fork [path] Override one or more projects from dependency tree \\ \\Advanced Options: \\ -freference-trace[=num] How many lines of reference trace should be shown per compile error diff --git a/lib/compiler/Maker/Step.zig b/lib/compiler/Maker/Step.zig index 1f1a1a7ec4a6ee994b7b6860f2d200ddf536cf18..a4760274cdeb5ab6b64651b2e79be61e1d8ebae6 100644 --- a/lib/compiler/Maker/Step.zig +++ b/lib/compiler/Maker/Step.zig @@ -728,19 +728,19 @@ fn failWithCacheError( switch (err) { error.CacheCheckFailed => switch (man.diagnostic) { .none => unreachable, - .manifest_create, .manifest_read, .manifest_lock => |e| return s.fail(maker, "failed to check cache: {t} {t}", .{ + .manifest_create, .manifest_read, .manifest_lock => |e| return s.fail(maker, "failed checking cache: {t} {t}", .{ man.diagnostic, e, }), .file_open, .file_stat, .file_read, .file_hash => |op| { const pp = man.files.keys()[op.file_index].prefixed_path; const prefix = man.cache.prefixes()[pp.prefix].path orelse ""; - return s.fail(maker, "failed to check cache: '{s}{c}{s}' {t} {t}", .{ + return s.fail(maker, "failed checking cache: {s}{c}{s} {t} {t}", .{ prefix, Dir.path.sep, pp.sub_path, man.diagnostic, op.err, }); }, }, error.OutOfMemory, error.Canceled => |e| return e, - error.InvalidFormat => return s.fail(maker, "failed to check cache: invalid manifest file format", .{}), + error.InvalidFormat => return s.fail(maker, "failed checking cache: invalid manifest file format", .{}), } } diff --git a/src/main.zig b/src/main.zig index cd2ec3c28e53923c20f0297aed6b72cd14284ba0..1567ae0a11f0c5082c7ceebf01960cfc65d65b84 100644 --- a/src/main.zig +++ b/src/main.zig @@ -5082,17 +5082,12 @@ fn cmdBuild( fetch_mode = std.meta.stringToEnum(Package.Fetch.JobQueue.Mode, sub_arg) orelse fatal("expected [needed|all] after '--fetch=', found '{s}'", .{sub_arg}); } else if (mem.cutPrefix(u8, arg, "--fork=")) |sub_arg| { - try forks.append(arena, .{ - .manifest_ast = undefined, - .manifest = undefined, - .error_bundle = undefined, - .arena_allocator = undefined, - .path = .{ - .root_dir = .cwd(), - .sub_path = sub_arg, - }, - .failed = false, - }); + try forks.append(arena, .init(sub_arg)); + continue; + } else if (mem.eql(u8, arg, "--fork")) { + if (i + 1 >= args.len) fatal("expected argument after: {s}", .{arg}); + i += 1; + try forks.append(arena, .init(args[i])); continue; } else if (mem.cutPrefix(u8, arg, "-freference-trace=")) |num| { reference_trace = std.fmt.parseUnsigned(u32, num, 10) catch |err| { @@ -5874,6 +5869,20 @@ const Fork = struct { failed: bool, arena_allocator: std.heap.ArenaAllocator, + fn init(cwd_relative_path: []const u8) Fork { + return .{ + .manifest_ast = undefined, + .manifest = undefined, + .error_bundle = undefined, + .arena_allocator = undefined, + .path = .{ + .root_dir = .cwd(), + .sub_path = cwd_relative_path, + }, + .failed = false, + }; + } + fn load(io: Io, gpa: Allocator, fork: *Fork, color: Color) Io.Cancelable!void { loadFallible(io, gpa, fork, color) catch |err| switch (err) { error.Canceled => |e| return e,