summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSutou Kouhei <kou@clear-code.com>2020-01-15 14:22:09 +0900
committerSutou Kouhei <kou@clear-code.com>2020-01-15 14:22:09 +0900
commit71f74179718f065ee3eb951dc81cc0cec767d583 (patch)
tree509fec1696b7e093fb57b4267e74c5033b70fb90
parent3144c069458bf74070424e675321887e2105e883 (diff)
downloadbundler-71f74179718f065ee3eb951dc81cc0cec767d583.tar.gz
Sort available platforms
-rw-r--r--lib/bundler/resolver.rb15
-rw-r--r--spec/install/gems/resolving_spec.rb4
2 files changed, 10 insertions, 9 deletions
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index 2d0d63d557..bcde144f76 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -154,14 +154,15 @@ module Bundler
# 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
+ sg_all_platforms = nil
+ self.class.sort_platforms(@platforms).reverse_each do |other_platform|
+ if sg_all_platforms.nil?
+ sg_all_platforms = sg.copy_for(other_platform)
+ else
+ sg_all_platforms.activate_platform!(other_platform)
+ end
end
- selected_sgs << sg_all_platforms
+ selected_sgs << sg_all_platforms if sg_all_platforms
end
selected_sgs
end
diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb
index 0e933bfd8e..547d13134f 100644
--- a/spec/install/gems/resolving_spec.rb
+++ b/spec/install/gems/resolving_spec.rb
@@ -181,8 +181,8 @@ RSpec.describe "bundle install with install-time dependencies" do
In Gemfile:
Ruby\0 (#{error_message_requirement})#{error_message_platform}
- require_ruby was resolved to 1.0, which depends on
- Ruby\0 (> 9000)#{error_message_platform}
+ require_ruby#{error_message_platform} was resolved to 1.0, which depends on
+ Ruby\0 (> 9000)
Ruby\0 (> 9000), which is required by gem 'require_ruby', is not available in the local ruby installation
E