mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 15:12:31 +00:00
Take eagerness into account when deduplicating dependencies
If the same dependency is first found as lazy and then later as eager, the existing entry needs to be updated to eager in order for `b.dependency()` to work.
This commit is contained in:
parent
e5d9d3f8a1
commit
4fc295dc02
@ -662,6 +662,9 @@ fn queueJobsForDeps(f: *Fetch) RunError!void {
|
||||
// * path-based location is used without a hash.
|
||||
// - Hash is added to the table based on the path alone before
|
||||
// calling run(); no need to add it again.
|
||||
//
|
||||
// If we add a dep as lazy and then later try to add the same dep as eager,
|
||||
// eagerness takes precedence and the existing entry is updated.
|
||||
|
||||
for (dep_names, deps) |dep_name, dep| {
|
||||
const new_fetch = &new_fetches[new_fetch_index];
|
||||
@ -673,7 +676,12 @@ fn queueJobsForDeps(f: *Fetch) RunError!void {
|
||||
const digest_len = @typeInfo(Manifest.MultiHashHexDigest).array.len;
|
||||
const multihash_digest = h[0..digest_len].*;
|
||||
const gop = f.job_queue.table.getOrPutAssumeCapacity(multihash_digest);
|
||||
if (gop.found_existing) continue;
|
||||
if (gop.found_existing) {
|
||||
if (!dep.lazy) {
|
||||
gop.value_ptr.*.lazy_status = .eager;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
gop.value_ptr.* = new_fetch;
|
||||
break :h multihash_digest;
|
||||
},
|
||||
@ -684,7 +692,12 @@ fn queueJobsForDeps(f: *Fetch) RunError!void {
|
||||
const new_root = try f.package_root.resolvePosix(parent_arena, rel_path);
|
||||
const multihash_digest = relativePathDigest(new_root, cache_root);
|
||||
const gop = f.job_queue.table.getOrPutAssumeCapacity(multihash_digest);
|
||||
if (gop.found_existing) continue;
|
||||
if (gop.found_existing) {
|
||||
if (!dep.lazy) {
|
||||
gop.value_ptr.*.lazy_status = .eager;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
gop.value_ptr.* = new_fetch;
|
||||
break :l .{ .relative_path = new_root };
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user