lib/bundler/definition.rb in bundler-2.3.23 vs lib/bundler/definition.rb in bundler-2.3.24

- old
+ new

@@ -137,12 +137,12 @@ @source_changes = converge_sources if @unlock[:conservative] @unlock[:gems] ||= @dependencies.map(&:name) else - eager_unlock = expand_dependencies(@unlock[:gems] || [], true) - @unlock[:gems] = @locked_specs.for(eager_unlock, false, platforms).map(&:name) + eager_unlock = (@unlock[:gems] || []).map {|name| Dependency.new(name, ">= 0") } + @unlock[:gems] = @locked_specs.for(eager_unlock, false, platforms).map(&:name).uniq end @dependency_changes = converge_dependencies @local_changes = converge_locals @@ -222,11 +222,11 @@ dependencies_for(requested_groups) end def current_dependencies dependencies.select do |d| - d.should_include? && !d.gem_platforms(@platforms).empty? + d.should_include? && !d.gem_platforms([generic_local_platform]).empty? end end def locked_dependencies @locked_deps.values @@ -246,14 +246,13 @@ materialize(deps) end def dependencies_for(groups) groups.map!(&:to_sym) - deps = current_dependencies.reject do |d| + current_dependencies.reject do |d| (d.groups & groups).empty? end - expand_dependencies(deps) end # Resolve all the dependencies specified in Gemfile. It ensures that # dependencies that have been already resolved via locked file and are fresh # are reused when resolving dependencies @@ -472,21 +471,21 @@ private def resolver @resolver ||= begin last_resolve = converge_locked_specs - remove_ruby_from_platforms_if_necessary!(dependencies) + remove_ruby_from_platforms_if_necessary!(current_dependencies) Resolver.new(source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve(last_resolve), platforms) end end def expanded_dependencies - @expanded_dependencies ||= expand_dependencies(dependencies + metadata_dependencies, true) + @expanded_dependencies ||= dependencies + metadata_dependencies end def filter_specs(specs, deps) - SpecSet.new(specs).for(expand_dependencies(deps, true), false, platforms) + SpecSet.new(specs).for(deps, false, platforms) end def materialize(dependencies) specs = resolve.materialize(dependencies) missing_specs = specs.missing_specs @@ -576,12 +575,12 @@ [@path_changes, "the gemspecs for path gems changed"], [@local_changes, "the gemspecs for git local gems changed"], ].select(&:first).map(&:last).join(", ") end - def pretty_dep(dep, source = false) - SharedHelpers.pretty_dependency(dep, source) + def pretty_dep(dep) + SharedHelpers.pretty_dependency(dep) end # Check if the specs of the given source changed # according to the locked source. def specs_changed?(source) @@ -790,27 +789,10 @@ Dependency.new("Ruby\0", Gem.ruby_version), Dependency.new("RubyGems\0", Gem::VERSION), ] end - def expand_dependencies(dependencies, remote = false) - deps = [] - dependencies.each do |dep| - dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name) - next unless remote || dep.current_platform? - target_platforms = dep.gem_platforms(remote ? @platforms : [generic_local_platform]) - deps += expand_dependency_with_platforms(dep, target_platforms) - end - deps - end - - def expand_dependency_with_platforms(dep, platforms) - platforms.map do |p| - DepProxy.get_proxy(dep, p) - end - end - def source_requirements # Record the specs available in each gem's source, so that those # specs will be available later when the resolver knows where to # look for that gemspec (or its dependencies) source_requirements = if precompute_source_requirements_for_indirect_dependencies? @@ -878,10 +860,10 @@ def remove_ruby_from_platforms_if_necessary!(dependencies) return if Bundler.frozen_bundle? || Bundler.local_platform == Gem::Platform::RUBY || !platforms.include?(Gem::Platform::RUBY) || (@new_platform && platforms.last == Gem::Platform::RUBY) || - !@originally_locked_specs.incomplete_ruby_specs?(expand_dependencies(dependencies)) + !@originally_locked_specs.incomplete_ruby_specs?(dependencies) remove_platform(Gem::Platform::RUBY) add_current_platform end