lib/bundler/definition.rb in bundler-2.3.17 vs lib/bundler/definition.rb in bundler-2.3.18

- old
+ new

@@ -233,10 +233,18 @@ def locked_dependencies @locked_deps.values end + def new_deps + @new_deps ||= @dependencies - locked_dependencies + end + + def deleted_deps + @deleted_deps ||= locked_dependencies - @dependencies + end + def specs_for(groups) return specs if groups.empty? deps = dependencies_for(groups) materialize(deps) end @@ -257,12 +265,21 @@ def resolve @resolve ||= if Bundler.frozen_bundle? Bundler.ui.debug "Frozen, using resolution from the lockfile" @locked_specs elsif !unlocking? && nothing_changed? - Bundler.ui.debug("Found no changes, using resolution from the lockfile") - SpecSet.new(filter_specs(@locked_specs, @dependencies.select {|dep| @locked_specs[dep].any? })) + if deleted_deps.any? + Bundler.ui.debug("Some dependencies were deleted, using a subset of the resolution from the lockfile") + SpecSet.new(filter_specs(@locked_specs, @dependencies - deleted_deps)) + else + Bundler.ui.debug("Found no changes, using resolution from the lockfile") + if @locked_gems.may_include_redundant_platform_specific_gems? + SpecSet.new(filter_specs(@locked_specs, @dependencies)) + else + @locked_specs + end + end else last_resolve = converge_locked_specs # Run a resolve against the locally available gems Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}") expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, true) @@ -357,13 +374,10 @@ new_platforms = @platforms - @locked_platforms deleted_platforms = @locked_platforms - @platforms added.concat new_platforms.map {|p| "* platform: #{p}" } deleted.concat deleted_platforms.map {|p| "* platform: #{p}" } - new_deps = @dependencies - locked_dependencies - deleted_deps = locked_dependencies - @dependencies - added.concat new_deps.map {|d| "* #{pretty_dep(d)}" } if new_deps.any? deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any? both_sources = Hash.new {|h, k| h[k] = [] } @dependencies.each {|d| both_sources[d.name][0] = d } @@ -804,10 +818,10 @@ def additional_base_requirements_for_resolve return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources) converge_specs(@originally_locked_specs).map do |locked_spec| name = locked_spec.name - dep = Gem::Dependency.new(name, ">= #{locked_spec.version}") + dep = Dependency.new(name, ">= #{locked_spec.version}") DepProxy.get_proxy(dep, locked_spec.platform) end end def source_map