summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSutou Kouhei <kou@clear-code.com>2020-01-15 06:45:25 +0900
committerSutou Kouhei <kou@clear-code.com>2020-01-15 06:45:25 +0900
commitfd11bd3089122ea332e0637fa00d4b0149c2b53f (patch)
tree388e492e5a476a521d073aa7a63ac38305c27e44
parent637b695640b147061a04b5c11ed3de4ec7a656c0 (diff)
downloadbundler-fd11bd3089122ea332e0637fa00d4b0149c2b53f.tar.gz
Always add "ruby" version to selected spec groups as fallback
-rw-r--r--lib/bundler/resolver.rb8
-rw-r--r--spec/resolver/platform_spec.rb8
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index 8a95273a0f..d9c31a7645 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -151,7 +151,8 @@ module Bundler
spec = sg.spec_for(platform)
next if spec.nil?
spec_platform = spec.platform
- if spec_platform && spec_platform != Gem::Platform::RUBY
+ if (spec_platform && spec_platform != Gem::Platform::RUBY) ||
+ 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)
@@ -173,8 +174,9 @@ module Bundler
selected_sgs << sg_ruby_platform
end
end
- sg.activate_platform!(platform)
- selected_sgs << sg
+ sg_platform = sg.copy_for(platform)
+ sg_platform.activate_platform!(platform)
+ selected_sgs << sg_platform
end
selected_sgs
end
diff --git a/spec/resolver/platform_spec.rb b/spec/resolver/platform_spec.rb
index b650f12b88..1f39e77117 100644
--- a/spec/resolver/platform_spec.rb
+++ b/spec/resolver/platform_spec.rb
@@ -69,7 +69,9 @@ RSpec.describe "Resolving platform craziness" do
@index = build_index do
gem "foo", "1.0.0"
gem "foo", "1.0.0", "x64-mingw32"
- gem "foo", "1.1.0"
+ gem "foo", "1.1.0" do |s|
+ s.required_ruby_version = [">= 2.0"]
+ end
gem "foo", "1.1.0", "x64-mingw32" do |s|
s.required_ruby_version = [">= 2.0", "< 2.4"]
end
@@ -144,11 +146,11 @@ RSpec.describe "Resolving platform craziness" do
end
end
- it "reports on the conflict" do
+ it "takes the ruby version as fallback" do
platforms "ruby", "java"
dep "foo"
- should_conflict_on "baz"
+ should_resolve_as %w[bar-1.0.0 baz-1.0.0 foo-1.0.0]
end
end
end