[rubygems/rubygems] Fix another case of bundle lock --add-platform
doing nothing
https://github.com/rubygems/rubygems/commit/0629e27dda
This commit is contained in:
parent
58aebcbce1
commit
3c3cce13c6
@ -81,7 +81,7 @@ module Bundler
|
|||||||
@resolved_bundler_version = nil
|
@resolved_bundler_version = nil
|
||||||
|
|
||||||
@locked_ruby_version = nil
|
@locked_ruby_version = nil
|
||||||
@new_platform = nil
|
@new_platforms = []
|
||||||
@removed_platform = nil
|
@removed_platform = nil
|
||||||
|
|
||||||
if lockfile_exists?
|
if lockfile_exists?
|
||||||
@ -457,8 +457,10 @@ module Bundler
|
|||||||
end
|
end
|
||||||
|
|
||||||
def add_platform(platform)
|
def add_platform(platform)
|
||||||
@new_platform ||= !@platforms.include?(platform)
|
return if @platforms.include?(platform)
|
||||||
@platforms |= [platform]
|
|
||||||
|
@new_platforms << platform
|
||||||
|
@platforms << platform
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_platform(platform)
|
def remove_platform(platform)
|
||||||
@ -482,7 +484,7 @@ module Bundler
|
|||||||
|
|
||||||
!@source_changes &&
|
!@source_changes &&
|
||||||
!@dependency_changes &&
|
!@dependency_changes &&
|
||||||
!@new_platform &&
|
@new_platforms.empty? &&
|
||||||
!@path_changes &&
|
!@path_changes &&
|
||||||
!@local_changes &&
|
!@local_changes &&
|
||||||
!@missing_lockfile_dep &&
|
!@missing_lockfile_dep &&
|
||||||
@ -703,7 +705,7 @@ module Bundler
|
|||||||
[
|
[
|
||||||
[@source_changes, "the list of sources changed"],
|
[@source_changes, "the list of sources changed"],
|
||||||
[@dependency_changes, "the dependencies in your gemfile changed"],
|
[@dependency_changes, "the dependencies in your gemfile changed"],
|
||||||
[@new_platform, "you added a new platform to your gemfile"],
|
[@new_platforms.any?, "you added a new platform to your gemfile"],
|
||||||
[@path_changes, "the gemspecs for path gems changed"],
|
[@path_changes, "the gemspecs for path gems changed"],
|
||||||
[@local_changes, "the gemspecs for git local gems changed"],
|
[@local_changes, "the gemspecs for git local gems changed"],
|
||||||
[@missing_lockfile_dep, "your lock file is missing \"#{@missing_lockfile_dep}\""],
|
[@missing_lockfile_dep, "your lock file is missing \"#{@missing_lockfile_dep}\""],
|
||||||
@ -1061,7 +1063,7 @@ module Bundler
|
|||||||
|
|
||||||
platforms.reverse_each do |platform|
|
platforms.reverse_each do |platform|
|
||||||
next if local_platform == platform ||
|
next if local_platform == platform ||
|
||||||
(@new_platform && platforms.last == platform) ||
|
@new_platforms.include?(platform) ||
|
||||||
@path_changes ||
|
@path_changes ||
|
||||||
@dependency_changes ||
|
@dependency_changes ||
|
||||||
@locked_spec_with_invalid_deps ||
|
@locked_spec_with_invalid_deps ||
|
||||||
|
@ -629,6 +629,62 @@ RSpec.describe "bundle lock" do
|
|||||||
expect(lockfile.platforms).to match_array(default_platform_list(java, x86_mingw32))
|
expect(lockfile.platforms).to match_array(default_platform_list(java, x86_mingw32))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "supports adding new platforms, when most specific locked platform is not the current platform, and current resolve is not compatible with the target platform" do
|
||||||
|
simulate_platform "arm64-darwin-23" do
|
||||||
|
build_repo4 do
|
||||||
|
build_gem "foo" do |s|
|
||||||
|
s.platform = "arm64-darwin"
|
||||||
|
end
|
||||||
|
|
||||||
|
build_gem "foo" do |s|
|
||||||
|
s.platform = "java"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
gemfile <<-G
|
||||||
|
source "https://gem.repo4"
|
||||||
|
|
||||||
|
gem "foo"
|
||||||
|
G
|
||||||
|
|
||||||
|
lockfile <<-L
|
||||||
|
GEM
|
||||||
|
remote: https://gem.repo4/
|
||||||
|
specs:
|
||||||
|
foo (1.0-arm64-darwin)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
arm64-darwin
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
foo
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
#{Bundler::VERSION}
|
||||||
|
L
|
||||||
|
|
||||||
|
bundle "lock --add-platform java"
|
||||||
|
|
||||||
|
expect(lockfile).to eq <<~L
|
||||||
|
GEM
|
||||||
|
remote: https://gem.repo4/
|
||||||
|
specs:
|
||||||
|
foo (1.0-arm64-darwin)
|
||||||
|
foo (1.0-java)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
arm64-darwin
|
||||||
|
java
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
foo
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
#{Bundler::VERSION}
|
||||||
|
L
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it "supports adding new platforms with force_ruby_platform = true" do
|
it "supports adding new platforms with force_ruby_platform = true" do
|
||||||
lockfile <<-L
|
lockfile <<-L
|
||||||
GEM
|
GEM
|
||||||
|
Loading…
x
Reference in New Issue
Block a user