From cd57c1294de14a7c6210fd111f40f1ce1fac3288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 27 Jun 2024 12:36:47 +0200 Subject: [rubygems/rubygems] Only remove current platform when added right before resolution If it has been explicitly added by `bundle lock --add-platform`, we don't want to remove it. https://github.com/rubygems/rubygems/commit/09cf921dd6 --- spec/bundler/commands/lock_spec.rb | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'spec') diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb index 3ffe8b90eb..235c2d6756 100644 --- a/spec/bundler/commands/lock_spec.rb +++ b/spec/bundler/commands/lock_spec.rb @@ -1032,6 +1032,60 @@ RSpec.describe "bundle lock" do bundle "lock --add-platform x86_64-linux" end + it "adds platform specific gems as necessary, even when adding the current platform" do + build_repo4 do + build_gem "nokogiri", "1.16.0" + + build_gem "nokogiri", "1.16.0" do |s| + s.platform = "x86_64-linux" + end + end + + gemfile <<-G + source "https://gem.repo4" + + gem "nokogiri" + G + + lockfile <<~L + GEM + remote: https://gem.repo4/ + specs: + nokogiri (1.16.0) + + PLATFORMS + ruby + + DEPENDENCIES + nokogiri + + BUNDLED WITH + #{Bundler::VERSION} + L + + simulate_platform "x86_64-linux" do + bundle "lock --add-platform x86_64-linux" + end + + expect(lockfile).to eq <<~L + GEM + remote: https://gem.repo4/ + specs: + nokogiri (1.16.0) + nokogiri (1.16.0-x86_64-linux) + + PLATFORMS + ruby + x86_64-linux + + DEPENDENCIES + nokogiri + + BUNDLED WITH + #{Bundler::VERSION} + L + end + it "does not crash on conflicting ruby requirements between platform versions in two different gems" do build_repo4 do build_gem "unf_ext", "0.0.8.2" -- cgit v1.2.3