diff options
-rw-r--r-- | lib/bundler/resolver.rb | 6 | ||||
-rw-r--r-- | lib/bundler/resolver/spec_group.rb | 17 | ||||
-rw-r--r-- | spec/bundler/bundler/gem_version_promoter_spec.rb | 2 |
3 files changed, 11 insertions, 14 deletions
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index 104e149f6b..80ad39e896 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -136,15 +136,15 @@ module Bundler current_specs[current_platform] = select_best_platform_match(specs, current_platform) end - spec_group_ruby = SpecGroup.create_for(specs_by_platform, [Gem::Platform::RUBY], Gem::Platform::RUBY) - if spec_group_ruby + if specs_by_platform[Gem::Platform::RUBY].any? + spec_group_ruby = SpecGroup.create_for(specs_by_platform, [Gem::Platform::RUBY]) spec_group_ruby.force_ruby_platform = dependency.force_ruby_platform groups << spec_group_ruby end next groups if @resolving_only_for_ruby || dependency.force_ruby_platform - spec_group = SpecGroup.create_for(specs_by_platform, @platforms, platform) + spec_group = SpecGroup.create_for(specs_by_platform, @platforms) groups << spec_group groups diff --git a/lib/bundler/resolver/spec_group.rb b/lib/bundler/resolver/spec_group.rb index 4e5b0082d3..dfe15a5052 100644 --- a/lib/bundler/resolver/spec_group.rb +++ b/lib/bundler/resolver/spec_group.rb @@ -6,20 +6,17 @@ module Bundler attr_accessor :name, :version, :source attr_accessor :activated_platforms, :force_ruby_platform - def self.create_for(specs, all_platforms, specific_platform) - specific_platform_specs = specs[specific_platform] - return unless specific_platform_specs.any? - + def self.create_for(specs, all_platforms) platforms = all_platforms.select {|p| specs[p].any? } - new(specific_platform_specs.first, specs, platforms) + new(specs, platforms) end - def initialize(exemplary_spec, specs, relevant_platforms) - @exemplary_spec = exemplary_spec - @name = exemplary_spec.name - @version = exemplary_spec.version - @source = exemplary_spec.source + def initialize(specs, relevant_platforms) + @exemplary_spec = specs[relevant_platforms.first].first + @name = @exemplary_spec.name + @version = @exemplary_spec.version + @source = @exemplary_spec.source @activated_platforms = relevant_platforms @dependencies = Hash.new do |dependencies, platforms| diff --git a/spec/bundler/bundler/gem_version_promoter_spec.rb b/spec/bundler/bundler/gem_version_promoter_spec.rb index 99e008bfbc..82c325097f 100644 --- a/spec/bundler/bundler/gem_version_promoter_spec.rb +++ b/spec/bundler/bundler/gem_version_promoter_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Bundler::GemVersionPromoter do def build_spec_groups(name, versions) versions.map do |v| - Bundler::Resolver::SpecGroup.create_for({ Gem::Platform::RUBY => build_spec(name, v) }, [Gem::Platform::RUBY], Gem::Platform::RUBY) + Bundler::Resolver::SpecGroup.create_for({ Gem::Platform::RUBY => build_spec(name, v) }, [Gem::Platform::RUBY]) end end |