diff options
author | Bundlerbot <bot@bundler.io> | 2020-01-16 09:53:03 +0000 |
---|---|---|
committer | Bundlerbot <bot@bundler.io> | 2020-01-16 09:53:03 +0000 |
commit | d852b30b66165dbb88682f72a8929568af7e7c57 (patch) | |
tree | 7283342f31444b20580aedfbc64679bd1ab00a2e /spec/runtime/platform_spec.rb | |
parent | 14fb40d464562e2f12cf78a8713f6597cc682b00 (diff) | |
parent | e96b6b36146c3fab3a956dddb79c79822ebbb5ab (diff) | |
download | bundler-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/runtime/platform_spec.rb')
-rw-r--r-- | spec/runtime/platform_spec.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/spec/runtime/platform_spec.rb b/spec/runtime/platform_spec.rb index ad9c56d14e..70c7594395 100644 --- a/spec/runtime/platform_spec.rb +++ b/spec/runtime/platform_spec.rb @@ -113,6 +113,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do bundle! "install" expect(the_bundle).to include_gems "platform_specific 1.0 RUBY" + expect(the_bundle).to not_include_gems "nokogiri" end end |