summaryrefslogtreecommitdiff
path: root/lib/bundler/lazy_specification.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-07-23 13:47:58 +0200
committergit <svn-admin@ruby-lang.org>2022-08-02 16:10:16 +0900
commitbc0de1e16250ecb4e8278ec64de86fbc049c5e63 (patch)
tree612e424336797b67099ac27062e88ebfff955f00 /lib/bundler/lazy_specification.rb
parent91b9bd62347dbb0971904593a11320d64076a1ac (diff)
[rubygems/rubygems] Only need to filter platforms when materialization is not strict
https://github.com/rubygems/rubygems/commit/9d878cbda0
Diffstat (limited to 'lib/bundler/lazy_specification.rb')
-rw-r--r--lib/bundler/lazy_specification.rb16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb
index 3d704a7f12..4a7f528119 100644
--- a/lib/bundler/lazy_specification.rb
+++ b/lib/bundler/lazy_specification.rb
@@ -89,21 +89,19 @@ module Bundler
def __materialize__(platform)
@specification = begin
- search_object = if source.is_a?(Source::Path) || !ruby_platform_materializes_to_ruby_platform?
- Dependency.new(name, version)
+ candidates = if source.is_a?(Source::Path) || !ruby_platform_materializes_to_ruby_platform?
+ source.specs.search(Dependency.new(name, version)).select do |spec|
+ MatchPlatform.platforms_match?(spec.platform, platform)
+ end
else
- self
+ source.specs.search(self)
end
- candidates = source.specs.search(search_object)
- same_platform_candidates = candidates.select do |spec|
- MatchPlatform.platforms_match?(spec.platform, platform)
- end
- installable_candidates = same_platform_candidates.select do |spec|
+ installable_candidates = candidates.select do |spec|
spec.is_a?(StubSpecification) ||
(spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version))
end
- search = installable_candidates.last || same_platform_candidates.last
+ search = installable_candidates.last || candidates.last
search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
search
end