| ... | ... | @@ -5003,11 +5003,14 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8, |
| 5003 | 5003 | }); |
| 5004 | 5004 | } else if (mem.cutPrefix(u8, arg, "--fork=")) |sub_arg| { |
| 5005 | 5005 | try forks.append(arena, .{ |
| 5006 | | .project_id = undefined, |
| 5006 | .manifest_ast = undefined, |
| 5007 | .manifest = undefined, |
| 5008 | .error_bundle = undefined, |
| 5007 | 5009 | .path = .{ |
| 5008 | 5010 | .root_dir = .cwd(), |
| 5009 | 5011 | .sub_path = sub_arg, |
| 5010 | 5012 | }, |
| 5013 | .failed = false, |
| 5011 | 5014 | }); |
| 5012 | 5015 | } else if (mem.eql(u8, arg, "--system")) { |
| 5013 | 5016 | if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); |
| ... | ... | @@ -5204,10 +5207,12 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8, |
| 5204 | 5207 | try group.await(io); |
| 5205 | 5208 | |
| 5206 | 5209 | for (forks.items) |*fork| { |
| 5207 | | const project_id = fork.project_id catch |err| switch (err) { |
| 5208 | | error.AlreadyReported => process.exit(1), |
| 5209 | | }; |
| 5210 | | try fork_set.put(arena, project_id, fork.path); |
| 5210 | if (fork.failed) process.exit(1); |
| 5211 | try fork_set.put(arena, .{ |
| 5212 | .path = fork.path, |
| 5213 | .manifest_ast = fork.manifest_ast, |
| 5214 | .manifest = fork.manifest, |
| 5215 | }, {}); |
| 5211 | 5216 | } |
| 5212 | 5217 | } |
| 5213 | 5218 | |
| ... | ... | @@ -5548,21 +5553,24 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8, |
| 5548 | 5553 | |
| 5549 | 5554 | const Fork = struct { |
| 5550 | 5555 | path: Path, |
| 5551 | | project_id: error{AlreadyReported}!Package.ProjectId, |
| 5556 | manifest_ast: std.zig.Ast, |
| 5557 | manifest: Package.Manifest, |
| 5558 | error_bundle: std.zig.ErrorBundle.Wip, |
| 5559 | failed: bool, |
| 5552 | 5560 | }; |
| 5553 | 5561 | |
| 5554 | 5562 | fn loadFork(io: Io, gpa: Allocator, fork: *Fork, color: Color) Io.Cancelable!void { |
| 5555 | | fork.project_id = loadForkFallible(io, gpa, fork, color) catch |err| switch (err) { |
| 5563 | loadForkFallible(io, gpa, fork, color) catch |err| switch (err) { |
| 5556 | 5564 | error.Canceled => |e| return e, |
| 5557 | | error.AlreadyReported => |e| e, |
| 5558 | | else => |e| e: { |
| 5565 | error.AlreadyReported => fork.failed = true, |
| 5566 | else => |e| { |
| 5559 | 5567 | std.log.err("failed to load fork at {f}: {t}", .{ fork.path, e }); |
| 5560 | | break :e error.AlreadyReported; |
| 5568 | fork.failed = true; |
| 5561 | 5569 | }, |
| 5562 | 5570 | }; |
| 5563 | 5571 | } |
| 5564 | 5572 | |
| 5565 | | fn loadForkFallible(io: Io, gpa: Allocator, fork: *Fork, color: Color) !Package.ProjectId { |
| 5573 | fn loadForkFallible(io: Io, gpa: Allocator, fork: *Fork, color: Color) !void { |
| 5566 | 5574 | var arena_instance = std.heap.ArenaAllocator.init(gpa); |
| 5567 | 5575 | defer arena_instance.deinit(); |
| 5568 | 5576 | const arena = arena_instance.allocator(); |
| ... | ... | @@ -5573,16 +5581,13 @@ fn loadForkFallible(io: Io, gpa: Allocator, fork: *Fork, color: Color) !Package. |
| 5573 | 5581 | |
| 5574 | 5582 | const manifest_path = try fork.path.join(arena, Package.Manifest.basename); |
| 5575 | 5583 | |
| 5576 | | var manifest_ast: std.zig.Ast = undefined; |
| 5577 | | var manifest: Package.Manifest = undefined; |
| 5578 | | |
| 5579 | 5584 | Package.Manifest.load( |
| 5580 | 5585 | io, |
| 5581 | 5586 | arena, |
| 5582 | 5587 | manifest_path, |
| 5583 | | &manifest_ast, |
| 5588 | &fork.manifest_ast, |
| 5584 | 5589 | &error_bundle, |
| 5585 | | &manifest, |
| 5590 | &fork.manifest, |
| 5586 | 5591 | true, |
| 5587 | 5592 | ) catch |err| switch (err) { |
| 5588 | 5593 | error.Canceled => |e| return e, |
| ... | ... | @@ -5597,8 +5602,6 @@ fn loadForkFallible(io: Io, gpa: Allocator, fork: *Fork, color: Color) !Package. |
| 5597 | 5602 | return error.AlreadyReported; |
| 5598 | 5603 | }, |
| 5599 | 5604 | }; |
| 5600 | | |
| 5601 | | return .init(manifest.name, manifest.id); |
| 5602 | 5605 | } |
| 5603 | 5606 | |
| 5604 | 5607 | const JitCmdOptions = struct { |