[rubygems/rubygems] Fix another regression for sorbet
Recently a changed was introduced to update the resolver platforms after it has been created, in order to remove the "ruby" platform from it if it's to be removed from the lockfile. However, it did not update the `@resolving_only_for_ruby` instance variable in that case, so the resolver was not properly doing the right thing anymore. To fix this, I tweaked the code to restore not changing resolver platforms after the resolver has been instantiated. https://github.com/rubygems/rubygems/commit/8fbc30a1d0
This commit is contained in:
parent
f5f81bb777
commit
ad8774f8e5
@ -484,15 +484,13 @@ module Bundler
|
||||
def resolver
|
||||
@resolver ||= begin
|
||||
last_resolve = converge_locked_specs
|
||||
remove_ruby_from_platforms_if_necessary!(dependencies)
|
||||
Resolver.new(source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
|
||||
end
|
||||
end
|
||||
|
||||
def expanded_dependencies
|
||||
@expanded_dependencies ||= begin
|
||||
remove_ruby_from_platforms_if_necessary!(dependencies)
|
||||
expand_dependencies(dependencies + metadata_dependencies, true)
|
||||
end
|
||||
@expanded_dependencies ||= expand_dependencies(dependencies + metadata_dependencies, true)
|
||||
end
|
||||
|
||||
def filter_specs(specs, deps)
|
||||
@ -896,7 +894,6 @@ module Bundler
|
||||
|
||||
remove_platform(Gem::Platform::RUBY)
|
||||
add_current_platform
|
||||
resolver.platforms = @platforms
|
||||
end
|
||||
|
||||
def source_map
|
||||
|
@ -7,8 +7,6 @@ module Bundler
|
||||
|
||||
include GemHelpers
|
||||
|
||||
attr_writer :platforms
|
||||
|
||||
# Figures out the best possible configuration of gems that satisfies
|
||||
# the list of passed dependencies and any child dependencies without
|
||||
# causing any gem activation errors.
|
||||
|
@ -445,6 +445,77 @@ RSpec.describe "bundle install with specific platforms" do
|
||||
L
|
||||
end
|
||||
|
||||
it "automatically fixes the lockfile if only RUBY platform is locked and some gem has no RUBY variant available" do
|
||||
build_repo4 do
|
||||
build_gem("sorbet-static-and-runtime", "0.5.10160") do |s|
|
||||
s.add_runtime_dependency "sorbet", "= 0.5.10160"
|
||||
s.add_runtime_dependency "sorbet-runtime", "= 0.5.10160"
|
||||
end
|
||||
|
||||
build_gem("sorbet", "0.5.10160") do |s|
|
||||
s.add_runtime_dependency "sorbet-static", "= 0.5.10160"
|
||||
end
|
||||
|
||||
build_gem("sorbet-runtime", "0.5.10160")
|
||||
|
||||
build_gem("sorbet-static", "0.5.10160") do |s|
|
||||
s.platform = Gem::Platform.local
|
||||
end
|
||||
end
|
||||
|
||||
gemfile <<~G
|
||||
source "#{file_uri_for(gem_repo4)}"
|
||||
|
||||
gem "sorbet-static-and-runtime"
|
||||
G
|
||||
|
||||
lockfile <<~L
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo4)}/
|
||||
specs:
|
||||
sorbet (0.5.10160)
|
||||
sorbet-static (= 0.5.10160)
|
||||
sorbet-runtime (0.5.10160)
|
||||
sorbet-static (0.5.10160-#{Gem::Platform.local})
|
||||
sorbet-static-and-runtime (0.5.10160)
|
||||
sorbet (= 0.5.10160)
|
||||
sorbet-runtime (= 0.5.10160)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
sorbet-static-and-runtime
|
||||
|
||||
BUNDLED WITH
|
||||
#{Bundler::VERSION}
|
||||
L
|
||||
|
||||
bundle "update"
|
||||
|
||||
expect(lockfile).to eq <<~L
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo4)}/
|
||||
specs:
|
||||
sorbet (0.5.10160)
|
||||
sorbet-static (= 0.5.10160)
|
||||
sorbet-runtime (0.5.10160)
|
||||
sorbet-static (0.5.10160-#{Gem::Platform.local})
|
||||
sorbet-static-and-runtime (0.5.10160)
|
||||
sorbet (= 0.5.10160)
|
||||
sorbet-runtime (= 0.5.10160)
|
||||
|
||||
PLATFORMS
|
||||
#{lockfile_platforms}
|
||||
|
||||
DEPENDENCIES
|
||||
sorbet-static-and-runtime
|
||||
|
||||
BUNDLED WITH
|
||||
#{Bundler::VERSION}
|
||||
L
|
||||
end
|
||||
|
||||
it "does not remove ruby if gems for other platforms, and not present in the lockfile, exist in the Gemfile" do
|
||||
build_repo4 do
|
||||
build_gem "nokogiri", "1.13.8"
|
||||
|
Loading…
x
Reference in New Issue
Block a user