diff options
author | Sutou Kouhei <kou@clear-code.com> | 2020-01-17 09:03:47 +0900 |
---|---|---|
committer | Sutou Kouhei <kou@clear-code.com> | 2020-01-17 09:03:47 +0900 |
commit | 3ca83a01484351fd4158a8b077409a4cc026e8dd (patch) | |
tree | aaca4648ae207fd2f8fe703daa33fe5f37f3c106 /lib | |
parent | d852b30b66165dbb88682f72a8929568af7e7c57 (diff) | |
download | bundler-3ca83a01484351fd4158a8b077409a4cc026e8dd.tar.gz |
Don't ignore resolved platform information
This is a follow-up change of #7522.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/lazy_specification.rb | 9 | ||||
-rw-r--r-- | lib/bundler/match_platform.rb | 5 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index 7a6f5614ef..a6aeb16648 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -80,8 +80,13 @@ module Bundler @specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name source.gemspec.tap {|s| s.source = source } else - search = source.specs.search(search_object).last - if search && Gem::Platform.new(search.platform) != Gem::Platform.new(platform) && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty? + platform_object = Gem::Platform.new(platform) + candidates = source.specs.search(search_object) + same_platform_candidates = candidates.select do |spec| + MatchPlatform.platforms_match?(spec.platform, platform_object) + end + search = same_platform_candidates.last || candidates.last + if search && Gem::Platform.new(search.platform) != platform_object && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty? Bundler.ui.warn "Unable to use the platform-specific (#{search.platform}) version of #{name} (#{version}) " \ "because it has different dependencies from the #{platform} version. " \ "To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again." diff --git a/lib/bundler/match_platform.rb b/lib/bundler/match_platform.rb index 69074925a6..81d85d8e46 100644 --- a/lib/bundler/match_platform.rb +++ b/lib/bundler/match_platform.rb @@ -15,7 +15,10 @@ module Bundler return true if Gem::Platform::RUBY == gemspec_platform return true if local_platform == gemspec_platform gemspec_platform = Gem::Platform.new(gemspec_platform) - return true if GemHelpers.generic(gemspec_platform) === local_platform + generic_gemspec_platform = GemHelpers.generic(gemspec_platform) + unless generic_gemspec_platform == Gem::Platform::RUBY + return true if generic_gemspec_platform === local_platform + end return true if gemspec_platform === local_platform false |