| ... | @@ -1444,17 +1444,34 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { | ... | @@ -1444,17 +1444,34 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { |
| 1444 | // The first one is a dummy package for the current project. | 1444 | // The first one is a dummy package for the current project. |
| 1445 | continue; | 1445 | continue; |
| 1446 | } | 1446 | } |
| 1447 | if (!f.has_build_zig) | 1447 | if (!f.has_build_zig) continue; |
| 1448 | continue; | 1448 | |
| 1449 | const hash_slice = try arena.dupe(u8, hash.toSlice()); | 1449 | const project_id: Package.ProjectId = .init(f.manifest.name, f.manifest.id); |
| 1450 | | 1450 | if (fork_set.getKeyPtrAdapted(project_id, @as(Fetch.JobQueue.Fork.Adapter, .{}))) |fork| { |
| 1451 | const m = try arena.create(CliModule); | 1451 | const path = try fork.path.toString(arena); |
| 1452 | m.* = .{ | 1452 | const gop = deps_mod.deps.getOrPutAssumeCapacity(path); |
| 1453 | .root_path = try f.package_root.toString(arena), | 1453 | if (gop.found_existing) { |
| 1454 | .name = hash_slice, | 1454 | assert(fork.uses > 1); |
| 1455 | }; | 1455 | f.cli_module = gop.value_ptr.*; |
| 1456 | deps_mod.deps.putAssumeCapacityNoClobber(hash_slice, m); | 1456 | } else { |
| 1457 | f.cli_module = m; | 1457 | const m = try arena.create(CliModule); |
| | 1458 | m.* = .{ |
| | 1459 | .root_path = try f.package_root.toString(arena), |
| | 1460 | .name = path, |
| | 1461 | }; |
| | 1462 | gop.value_ptr.* = m; |
| | 1463 | f.cli_module = m; |
| | 1464 | } |
| | 1465 | } else { |
| | 1466 | const hash_slice = try arena.dupe(u8, hash.toSlice()); |
| | 1467 | const m = try arena.create(CliModule); |
| | 1468 | m.* = .{ |
| | 1469 | .root_path = try f.package_root.toString(arena), |
| | 1470 | .name = hash_slice, |
| | 1471 | }; |
| | 1472 | deps_mod.deps.putAssumeCapacityNoClobber(hash_slice, m); |
| | 1473 | f.cli_module = m; |
| | 1474 | } |
| 1458 | } | 1475 | } |
| 1459 | | 1476 | |
| 1460 | // Each build.zig module needs access to each of its dependencies' build.zig modules by | 1477 | // Each build.zig module needs access to each of its dependencies' build.zig modules by |