lib/bundler/definition.rb in bundler-2.5.16 vs lib/bundler/definition.rb in bundler-2.5.17

- old
+ new

@@ -113,11 +113,11 @@ @locked_specs = SpecSet.new([]) @originally_locked_deps = {} @originally_locked_specs = @locked_specs @locked_sources = [] @locked_platforms = [] - @locked_checksums = nil + @locked_checksums = Bundler.feature_flag.bundler_3_mode? end locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) } @multisource_allowed = locked_gem_sources.size == 1 && locked_gem_sources.first.multiple_remotes? && Bundler.frozen_bundle? @@ -135,11 +135,11 @@ @unlock[:ruby] ||= if @ruby_version && locked_ruby_version_object @ruby_version.diff(locked_ruby_version_object) end @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version) - add_current_platform unless Bundler.frozen_bundle? + @current_platform_missing = add_current_platform unless Bundler.frozen_bundle? converge_path_sources_to_gemspec_sources @path_changes = converge_paths @source_changes = converge_sources @@ -482,10 +482,11 @@ def nothing_changed? return false unless lockfile_exists? !@source_changes && !@dependency_changes && + !@current_platform_missing && @new_platforms.empty? && !@path_changes && !@local_changes && !@missing_lockfile_dep && !@unlocking_bundler && @@ -627,10 +628,11 @@ end def start_resolution local_platform_needed_for_resolvability = @most_specific_non_local_locked_ruby_platform && !@platforms.include?(local_platform) @platforms << local_platform if local_platform_needed_for_resolvability + add_platform(Gem::Platform::RUBY) if RUBY_ENGINE == "truffleruby" result = SpecSet.new(resolver.start) @resolved_bundler_version = result.find {|spec| spec.name == "bundler" }&.version @@ -669,23 +671,23 @@ MatchPlatform.platforms_match?(bundle_platform, local_platform) end end def add_current_platform - @most_specific_non_local_locked_ruby_platform = find_most_specific_non_local_locked_ruby_platform + return if @platforms.include?(local_platform) + + @most_specific_non_local_locked_ruby_platform = find_most_specific_locked_ruby_platform return if @most_specific_non_local_locked_ruby_platform - add_platform(local_platform) + @platforms << local_platform + true end - def find_most_specific_non_local_locked_ruby_platform + def find_most_specific_locked_ruby_platform return unless generic_local_platform_is_ruby? && current_platform_locked? - most_specific_locked_ruby_platform = most_specific_locked_platform - return unless most_specific_locked_ruby_platform != local_platform - - most_specific_locked_ruby_platform + most_specific_locked_platform end def change_reason if unlocking? unlock_targets = if @gems_to_unlock.any? @@ -703,9 +705,10 @@ return "bundler is unlocking #{unlock_reason}" end [ [@source_changes, "the list of sources changed"], [@dependency_changes, "the dependencies in your gemfile changed"], + [@current_platform_missing, "your lockfile does not include the current platform"], [@new_platforms.any?, "you added a new platform to your gemfile"], [@path_changes, "the gemspecs for path gems changed"], [@local_changes, "the gemspecs for git local gems changed"], [@missing_lockfile_dep, "your lock file is missing \"#{@missing_lockfile_dep}\""], [@unlocking_bundler, "an update to the version of Bundler itself was requested"],