Skip to content

Commit

Permalink
We can now avoid source materialization work
Browse files Browse the repository at this point in the history
No need to fill up missing names from sources anymore since they should
now be properly set up correctly from the beginning.
  • Loading branch information
deivid-rodriguez committed Jul 28, 2021
1 parent dda01b2 commit 706fd28
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions bundler/lib/bundler/spec_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,9 @@ def to_hash
def materialize(deps)
materialized = self.for(deps, false, true)

materialized.group_by(&:source).each do |source, specs|
next unless specs.any?{|s| s.is_a?(LazySpecification) }

source.local!
names = -> { specs.map(&:name).uniq }
source.double_check_for(names)
end

materialized.map! do |s|
next s unless s.is_a?(LazySpecification)
s.source.local!
s.__materialize__ || s
end
SpecSet.new(materialized)
Expand All @@ -88,17 +81,10 @@ def materialize(deps)
# This is in contrast to how for does platform filtering (and specifically different from how `materialize` calls `for` only for the current platform)
# @return [Array<Gem::Specification>]
def materialized_for_all_platforms
@specs.group_by(&:source).each do |source, specs|
next unless specs.any?{|s| s.is_a?(LazySpecification) }

source.local!
source.remote!
names = -> { specs.map(&:name).uniq }
source.double_check_for(names)
end

@specs.map do |s|
next s unless s.is_a?(LazySpecification)
s.source.local!
s.source.remote!
spec = s.__materialize__
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
spec
Expand Down

0 comments on commit 706fd28

Please sign in to comment.