summaryrefslogtreecommitdiff
path: root/lib/bundler/resolver.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-12-14 14:29:04 +0100
committergit <svn-admin@ruby-lang.org>2021-12-17 16:35:18 +0900
commit79f72a4540212fd7d6af47f57d1a426ac99335bd (patch)
tree5266fe9ba1e254859e8b58ac1564c72baab098c6 /lib/bundler/resolver.rb
parentc710cdb905a58b4ef0c7b5a9a8e867b382ccfd66 (diff)
downloadruby-79f72a4540212fd7d6af47f57d1a426ac99335bd.tar.gz
[rubygems/rubygems] Fix crash when no matching variants are found for the current platform
If we are resolving a dependency against a particular platform, and there are no platform specific variants of the candidates that match that platform, we should not consider those candidates. https://github.com/rubygems/rubygems/commit/f6077fe27d
Diffstat (limited to 'lib/bundler/resolver.rb')
-rw-r--r--lib/bundler/resolver.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index dfea95e30a..fdb297d677 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -134,6 +134,7 @@ module Bundler
end
nested.reduce([]) do |groups, (version, specs)|
next groups if locked_requirement && !locked_requirement.satisfied_by?(version)
+ next groups unless specs.any? {|spec| spec.match_platform(platform) }
specs_by_platform = Hash.new do |current_specs, current_platform|
current_specs[current_platform] = select_best_platform_match(specs, current_platform)
@@ -145,7 +146,7 @@ module Bundler
next groups if @resolving_only_for_ruby
spec_group = SpecGroup.create_for(specs_by_platform, @platforms, platform)
- groups << spec_group if spec_group
+ groups << spec_group
groups
end