summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/definition.rb4
-rw-r--r--lib/bundler/lazy_specification.rb9
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 3e5186039a..efd7618194 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -860,8 +860,8 @@ module Bundler
@metadata_dependencies ||= begin
ruby_versions = concat_ruby_version_requirements(@ruby_version)
if ruby_versions.empty? || !@ruby_version.exact?
- concat_ruby_version_requirements(RubyVersion.system)
- concat_ruby_version_requirements(locked_ruby_version_object) unless @unlock[:ruby]
+ concat_ruby_version_requirements(RubyVersion.system, ruby_versions)
+ concat_ruby_version_requirements(locked_ruby_version_object, ruby_versions) unless @unlock[:ruby]
end
[
Dependency.new("Ruby\0", ruby_versions),
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."