summaryrefslogtreecommitdiff
path: root/lib/bundler/resolver.rb
diff options
context:
space:
mode:
authorSutou Kouhei <kou@clear-code.com>2020-01-15 12:51:00 +0900
committerSutou Kouhei <kou@clear-code.com>2020-01-15 12:58:42 +0900
commit3144c069458bf74070424e675321887e2105e883 (patch)
tree0eb1722536c989d070f9cce4748cdc67b4a56f97 /lib/bundler/resolver.rb
parent1ada1b737ba06af402cd9bb3d9d870761a0f649c (diff)
downloadbundler-3144c069458bf74070424e675321887e2105e883.tar.gz
Always add a spec group for all platforms to candidates
Diffstat (limited to 'lib/bundler/resolver.rb')
-rw-r--r--lib/bundler/resolver.rb37
1 files changed, 11 insertions, 26 deletions
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index 357d9a312a..2d0d63d557 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -150,33 +150,18 @@ module Bundler
search.each do |sg|
spec = sg.spec_for(platform)
next if spec.nil?
- spec_platform = spec.platform
- if (platform != Gem::Platform::RUBY) ||
- (spec_platform && spec_platform != Gem::Platform::RUBY)
- # Add a spec group for "non platform specific spec" as the fallback
- # spec group.
- sg_ruby = sg.copy_for(Gem::Platform::RUBY)
- selected_sgs << sg_ruby if sg_ruby
+ # Add a spec group for "non platform specific spec" as the fallback
+ # spec group.
+ sg_ruby = sg.copy_for(Gem::Platform::RUBY)
+ selected_sgs << sg_ruby if sg_ruby
+ sg_all_platforms = sg.copy_for(platform)
+ activated_platforms = [platform]
+ @platforms.each do |other_platform|
+ next if platform == other_platform
+ sg_all_platforms.activate_platform!(other_platform)
+ activated_platforms << other_platform
end
- if platform != Gem::Platform::RUBY
- # Add a spec group for ["non platform specific spec", "platform
- # specific spec"] to resolve a spec for multiple platforms.
- # If Gemfile.lock file has the following entries, we need a ffi-1.9.14
- # spec group for ["ruby", "x86-mingw32"].
- #
- # GEM
- # specs:
- # ffi (1.9.14)
- # ffi (1.9.14-x86-mingw32)
- sg_ruby_platform = sg.copy_for(Gem::Platform::RUBY)
- if sg_ruby_platform
- sg_ruby_platform.activate_platform!(platform)
- selected_sgs << sg_ruby_platform
- end
- end
- sg_platform = sg.copy_for(platform)
- sg_platform.activate_platform!(platform)
- selected_sgs << sg_platform
+ selected_sgs << sg_all_platforms
end
selected_sgs
end