summaryrefslogtreecommitdiff
path: root/spec/install/gemfile/platform_spec.rb
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2020-01-16 09:53:03 +0000
committerBundlerbot <bot@bundler.io>2020-01-16 09:53:03 +0000
commitd852b30b66165dbb88682f72a8929568af7e7c57 (patch)
tree7283342f31444b20580aedfbc64679bd1ab00a2e /spec/install/gemfile/platform_spec.rb
parent14fb40d464562e2f12cf78a8713f6597cc682b00 (diff)
parente96b6b36146c3fab3a956dddb79c79822ebbb5ab (diff)
downloadbundler-d852b30b66165dbb88682f72a8929568af7e7c57.tar.gz
Merge #7522
7522: Improve platform specific gem resolution r=deivid-rodriguez a=kou ### What was the end-user problem that led to this PR? Platform specific gems aren't resolved when platform specific gems are conflicted. For example, in the following situation, foo-1.0.0-x64-mingw32 that requires bar<1 is conflicted because there is no bar<1. Without this change, Bundler raises a conflict error. But users can use foo-1.0.0 (no x64-mingw32) in this situation. With this change, Bundler resolves to foo-1.0.0 (no x64-mingw32). ```ruby @index = build_index do gem "bar", "1.0.0" gem "foo", "1.0.0" gem "foo", "1.0.0", "x64-mingw32" do dep "bar", "< 1" end end dep "foo" platforms "x64-mingw32" ```` See also #6247. This change includes the specs that were added in #6247. ### What was your diagnosis of the problem? Not platform specific gem (foo-1.0.0 in the above case) isn't tried to be resolved when platform specific gem (foo-1.0.0-x64-mingw32 in the above case) is available. ### What is your fix for the problem, implemented in this PR? In this PR, not platform specific gem (foo-1.0.0 in the above case) is also tried to be resolved even when platform specific gem (foo-1.0.0-x64-mingw32 in the above case) is available. Priority is "platform specific gem" -> "not platform specific gem". So platform specific gem is usable, platform specific gem is used. Not platform specific gem is used as fallback. `search_for` represents this. Here is the `search_for` specification: https://github.com/bundler/bundler/blob/master/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb#L11-L13 > Search for the specifications that match the given dependency. The specifications in the returned array will be considered in reverse order, so the latest version ought to be last. ## Why did you choose this fix out of the possible options? I choose this fix because this is based on Molinillo's specification. Co-authored-by: Lars Kanis <lars@greiz-reinsdorf.de> Co-authored-by: Samuel Giddins <segiddins@segiddins.me> Co-authored-by: Sutou Kouhei <kou@clear-code.com>
Diffstat (limited to 'spec/install/gemfile/platform_spec.rb')
-rw-r--r--spec/install/gemfile/platform_spec.rb4
1 files changed, 0 insertions, 4 deletions
diff --git a/spec/install/gemfile/platform_spec.rb b/spec/install/gemfile/platform_spec.rb
index eab5e7f00c..52e1cf86fa 100644
--- a/spec/install/gemfile/platform_spec.rb
+++ b/spec/install/gemfile/platform_spec.rb
@@ -379,8 +379,6 @@ RSpec.describe "bundle install with platform conditionals" do
end
it "prints a helpful warning when a dependency is unused on any platform" do
- skip "prints warning but bundle install fails" if Gem.win_platform?
-
simulate_platform "ruby"
simulate_ruby_engine "ruby"
@@ -401,8 +399,6 @@ The dependency #{Gem::Dependency.new("rack", ">= 0")} will be unused by any of t
before { bundle! "config set disable_platform_warnings true" }
it "does not print the warning when a dependency is unused on any platform" do
- skip "skips warning but bundle install fails" if Gem.win_platform?
-
simulate_platform "ruby"
simulate_ruby_engine "ruby"