diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-05-08 14:19:04 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-05-13 07:54:37 +0900 |
commit | 0e60b59d5884edb8f9aea023efd9b24f1ff02049 (patch) | |
tree | e52935ce510440872ca5ce6b0e092cbc94f18bc9 /lib/bundler/resolver.rb | |
parent | 68224651a4d4dc3ce0cea666f5423dd8b6ba6cfc (diff) | |
download | ruby-0e60b59d5884edb8f9aea023efd9b24f1ff02049.tar.gz |
Update the bundler version with master branch
Diffstat (limited to 'lib/bundler/resolver.rb')
-rw-r--r-- | lib/bundler/resolver.rb | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index c7caf01c7d..61bb648598 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -75,12 +75,17 @@ module Bundler return unless debug? debug_info = yield debug_info = debug_info.inspect unless debug_info.is_a?(String) - warn debug_info.split("\n").map {|s| " " * depth + s } + warn debug_info.split("\n").map {|s| "BUNDLER: " + " " * depth + s } end def debug? return @debug_mode if defined?(@debug_mode) - @debug_mode = ENV["DEBUG_RESOLVER"] || ENV["DEBUG_RESOLVER_TREE"] || false + @debug_mode = + ENV["BUNDLER_DEBUG_RESOLVER"] || + ENV["BUNDLER_DEBUG_RESOLVER_TREE"] || + ENV["DEBUG_RESOLVER"] || + ENV["DEBUG_RESOLVER_TREE"] || + false end def before_resolution @@ -146,7 +151,26 @@ module Bundler @gem_version_promoter.sort_versions(dependency, spec_groups) end end - search.select {|sg| sg.for?(platform) }.each {|sg| sg.activate_platform!(platform) } + selected_sgs = [] + search.each do |sg| + next unless sg.for?(platform) + # Add a spec group for "non platform specific spec" as the fallback + # spec group. + sg_ruby = sg.copy_for(Gem::Platform::RUBY) + selected_sgs << sg_ruby if sg_ruby + sg_all_platforms = nil + all_platforms = @platforms + [platform] + sorted_all_platforms = self.class.sort_platforms(all_platforms) + sorted_all_platforms.reverse_each do |other_platform| + if sg_all_platforms.nil? + sg_all_platforms = sg.copy_for(other_platform) + else + sg_all_platforms.activate_platform!(other_platform) + end + end + selected_sgs << sg_all_platforms + end + selected_sgs end def index_for(dependency) @@ -183,9 +207,7 @@ module Bundler end def requirement_satisfied_by?(requirement, activated, spec) - return false unless requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec) - spec.activate_platform!(requirement.__platform) if !@platforms || @platforms.include?(requirement.__platform) - true + requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec) end def relevant_sources_for_vertex(vertex) @@ -223,8 +245,9 @@ module Bundler end def self.platform_sort_key(platform) - return ["", "", ""] if Gem::Platform::RUBY == platform - platform.to_a.map {|part| part || "" } + # Prefer specific platform to not specific platform + return ["99-LAST", "", "", ""] if Gem::Platform::RUBY == platform + ["00", *platform.to_a.map {|part| part || "" }] end private |