summaryrefslogtreecommitdiff
path: root/lib/bundler/spec_set.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2022-07-13 12:56:36 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-07-13 14:11:55 +0900
commit437a5ae9d6d60bd1972641167a98204007bd1c0b (patch)
tree79b9ea49442fe896dbd8ef59a8622ea010fb3fb7 /lib/bundler/spec_set.rb
parente3a988a29c2cfa4a7e2e045d82989a7342955be8 (diff)
Merge RubyGems and Bundler master
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6124
Diffstat (limited to 'lib/bundler/spec_set.rb')
-rw-r--r--lib/bundler/spec_set.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index 85a9d1537b..06257ac93f 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -24,13 +24,13 @@ module Bundler
# use a hash here to ensure constant lookup time in the `any?` call above
handled[dep.name] << dep
- specs_for_dep = spec_for_dependency(dep, match_current_platform)
+ specs_for_dep = specs_for_dependency(dep, match_current_platform)
if specs_for_dep.any?
specs.concat(specs_for_dep)
specs_for_dep.first.dependencies.each do |d|
next if d.type == :development
- d = DepProxy.get_proxy(d, dep.__platform) unless match_current_platform
+ d = DepProxy.get_proxy(Dependency.new(d.name, d.requirement), dep.__platform) unless match_current_platform
deps << d
end
elsif check
@@ -173,12 +173,13 @@ module Bundler
@specs.sort_by(&:name).each {|s| yield s }
end
- def spec_for_dependency(dep, match_current_platform)
- specs_for_platforms = lookup[dep.name]
+ def specs_for_dependency(dep, match_current_platform)
+ specs_for_name = lookup[dep.name]
if match_current_platform
- GemHelpers.select_best_platform_match(specs_for_platforms.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
+ GemHelpers.select_best_platform_match(specs_for_name, Bundler.local_platform)
else
- GemHelpers.select_best_platform_match(specs_for_platforms, dep.__platform)
+ specs_for_name_and_platform = GemHelpers.select_best_platform_match(specs_for_name, dep.force_ruby_platform ? Gem::Platform::RUBY : dep.__platform)
+ specs_for_name_and_platform.any? ? specs_for_name_and_platform : specs_for_name
end
end