| ... | ... | @@ -735,28 +735,34 @@ fn queueJobsForDeps(f: *Fetch) RunError!void { |
| 735 | 735 | // calling run(); no need to add it again. |
| 736 | 736 | // |
| 737 | 737 | // If we add a dep as lazy and then later try to add the same dep as eager, |
| 738 | | // eagerness takes precedence and the existing entry is updated. |
| 738 | // eagerness takes precedence and the existing entry is updated and re-scheduled |
| 739 | // for fetching. |
| 739 | 740 | |
| 740 | 741 | for (dep_names, deps) |dep_name, dep| { |
| 742 | var promoted_existing_to_eager = false; |
| 741 | 743 | const new_fetch = &new_fetches[new_fetch_index]; |
| 742 | 744 | const location: Location = switch (dep.location) { |
| 743 | | .url => |url| .{ .remote = .{ |
| 744 | | .url = url, |
| 745 | | .hash = h: { |
| 746 | | const h = dep.hash orelse break :h null; |
| 747 | | const pkg_hash: Package.Hash = .fromSlice(h); |
| 748 | | if (h.len == 0) break :h pkg_hash; |
| 749 | | const gop = f.job_queue.table.getOrPutAssumeCapacity(pkg_hash); |
| 750 | | if (gop.found_existing) { |
| 751 | | if (!dep.lazy) { |
| 752 | | gop.value_ptr.*.lazy_status = .eager; |
| 745 | .url => |url| .{ |
| 746 | .remote = .{ |
| 747 | .url = url, |
| 748 | .hash = h: { |
| 749 | const h = dep.hash orelse break :h null; |
| 750 | const pkg_hash: Package.Hash = .fromSlice(h); |
| 751 | if (h.len == 0) break :h pkg_hash; |
| 752 | const gop = f.job_queue.table.getOrPutAssumeCapacity(pkg_hash); |
| 753 | if (gop.found_existing) { |
| 754 | if (!dep.lazy and gop.value_ptr.*.lazy_status != .eager) { |
| 755 | gop.value_ptr.*.lazy_status = .eager; |
| 756 | promoted_existing_to_eager = true; |
| 757 | } else { |
| 758 | continue; |
| 759 | } |
| 753 | 760 | } |
| 754 | | continue; |
| 755 | | } |
| 756 | | gop.value_ptr.* = new_fetch; |
| 757 | | break :h pkg_hash; |
| 761 | gop.value_ptr.* = new_fetch; |
| 762 | break :h pkg_hash; |
| 763 | }, |
| 758 | 764 | }, |
| 759 | | } }, |
| 765 | }, |
| 760 | 766 | .path => |rel_path| l: { |
| 761 | 767 | // This might produce an invalid path, which is checked for |
| 762 | 768 | // at the beginning of run(). |
| ... | ... | @@ -764,10 +770,12 @@ fn queueJobsForDeps(f: *Fetch) RunError!void { |
| 764 | 770 | const pkg_hash = relativePathDigest(new_root, cache_root); |
| 765 | 771 | const gop = f.job_queue.table.getOrPutAssumeCapacity(pkg_hash); |
| 766 | 772 | if (gop.found_existing) { |
| 767 | | if (!dep.lazy) { |
| 773 | if (!dep.lazy and gop.value_ptr.*.lazy_status != .eager) { |
| 768 | 774 | gop.value_ptr.*.lazy_status = .eager; |
| 775 | promoted_existing_to_eager = true; |
| 776 | } else { |
| 777 | continue; |
| 769 | 778 | } |
| 770 | | continue; |
| 771 | 779 | } |
| 772 | 780 | gop.value_ptr.* = new_fetch; |
| 773 | 781 | break :l .{ .relative_path = new_root }; |
| ... | ... | @@ -775,7 +783,9 @@ fn queueJobsForDeps(f: *Fetch) RunError!void { |
| 775 | 783 | }; |
| 776 | 784 | prog_names[new_fetch_index] = dep_name; |
| 777 | 785 | new_fetch_index += 1; |
| 778 | | f.job_queue.all_fetches.appendAssumeCapacity(new_fetch); |
| 786 | if (!promoted_existing_to_eager) { |
| 787 | f.job_queue.all_fetches.appendAssumeCapacity(new_fetch); |
| 788 | } |
| 779 | 789 | new_fetch.* = .{ |
| 780 | 790 | .arena = std.heap.ArenaAllocator.init(gpa), |
| 781 | 791 | .location = location, |