[rubygems/rubygems] Fix lockfile platforms inconveniently added on JRuby
When working with our repository on JRuby locally, I get the following changes when running `bin/rake setup` in all of our lockfiles ```diff diff --git a/tool/bundler/dev_gems.rb.lock b/tool/bundler/dev_gems.rb.lock index https://github.com/rubygems/rubygems/commit/362bf25690d..https://github.com/rubygems/rubygems/commit/74550b2a408 100644 --- a/tool/bundler/dev_gems.rb.lock +++ b/tool/bundler/dev_gems.rb.lock @@ -66,6 +66,7 @@ PLATFORMS java ruby universal-java + universal-java-22 x64-mingw-ucrt x86-linux x86_64-darwin ``` This is inconvenient, so I applied the same strategy we already use on non JRuby implementations to not add the current platform to the lockfile if a less specific platform is already there. https://github.com/rubygems/rubygems/commit/812b9cd1e8
This commit is contained in:
parent
8619520570
commit
63600d79dc
@ -490,7 +490,7 @@ module Bundler
|
||||
end
|
||||
|
||||
def validate_platforms!
|
||||
return if current_platform_locked?
|
||||
return if current_platform_locked? || @platforms.include?(Gem::Platform::RUBY)
|
||||
|
||||
raise ProductionError, "Your bundle only supports platforms #{@platforms.map(&:to_s)} " \
|
||||
"but your local platform is #{local_platform}. " \
|
||||
@ -731,7 +731,7 @@ module Bundler
|
||||
end
|
||||
|
||||
def start_resolution
|
||||
local_platform_needed_for_resolvability = @most_specific_non_local_locked_ruby_platform && !@platforms.include?(local_platform)
|
||||
local_platform_needed_for_resolvability = @most_specific_non_local_locked_platform && !@platforms.include?(local_platform)
|
||||
@platforms << local_platform if local_platform_needed_for_resolvability
|
||||
add_platform(Gem::Platform::RUBY) if RUBY_ENGINE == "truffleruby"
|
||||
|
||||
@ -739,9 +739,9 @@ module Bundler
|
||||
|
||||
@resolved_bundler_version = result.find {|spec| spec.name == "bundler" }&.version
|
||||
|
||||
if @most_specific_non_local_locked_ruby_platform
|
||||
if spec_set_incomplete_for_platform?(result, @most_specific_non_local_locked_ruby_platform)
|
||||
@platforms.delete(@most_specific_non_local_locked_ruby_platform)
|
||||
if @most_specific_non_local_locked_platform
|
||||
if spec_set_incomplete_for_platform?(result, @most_specific_non_local_locked_platform)
|
||||
@platforms.delete(@most_specific_non_local_locked_platform)
|
||||
elsif local_platform_needed_for_resolvability
|
||||
@platforms.delete(local_platform)
|
||||
end
|
||||
@ -758,23 +758,23 @@ module Bundler
|
||||
|
||||
def current_platform_locked?
|
||||
@platforms.any? do |bundle_platform|
|
||||
MatchPlatform.platforms_match?(bundle_platform, local_platform)
|
||||
generic_local_platform == bundle_platform || local_platform === bundle_platform
|
||||
end
|
||||
end
|
||||
|
||||
def add_current_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
|
||||
@most_specific_non_local_locked_platform = find_most_specific_locked_platform
|
||||
return if @most_specific_non_local_locked_platform
|
||||
|
||||
@new_platforms << local_platform
|
||||
@platforms << local_platform
|
||||
true
|
||||
end
|
||||
|
||||
def find_most_specific_locked_ruby_platform
|
||||
return unless generic_local_platform_is_ruby? && current_platform_locked?
|
||||
def find_most_specific_locked_platform
|
||||
return unless current_platform_locked?
|
||||
|
||||
@most_specific_locked_platform
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user