Skip to content

Commit 9d878cb

Browse files
Only need to filter platforms when materialization is not strict
1 parent 087e3e4 commit 9d878cb

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

bundler/lib/bundler/lazy_specification.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,19 @@ def materialize_for_resolution
8989

9090
def __materialize__(platform)
9191
@specification = begin
92-
search_object = if source.is_a?(Source::Path) || !ruby_platform_materializes_to_ruby_platform?
93-
Dependency.new(name, version)
92+
candidates = if source.is_a?(Source::Path) || !ruby_platform_materializes_to_ruby_platform?
93+
source.specs.search(Dependency.new(name, version)).select do |spec|
94+
MatchPlatform.platforms_match?(spec.platform, platform)
95+
end
9496
else
95-
self
97+
source.specs.search(self)
9698
end
97-
candidates = source.specs.search(search_object)
98-
same_platform_candidates = candidates.select do |spec|
99-
MatchPlatform.platforms_match?(spec.platform, platform)
100-
end
101-
installable_candidates = same_platform_candidates.select do |spec|
99+
installable_candidates = candidates.select do |spec|
102100
spec.is_a?(StubSpecification) ||
103101
(spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
104102
spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version))
105103
end
106-
search = installable_candidates.last || same_platform_candidates.last
104+
search = installable_candidates.last || candidates.last
107105
search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
108106
search
109107
end

0 commit comments

Comments
 (0)