summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2025-10-14 14:39:42 +0900
committergit <svn-admin@ruby-lang.org>2025-10-14 07:55:36 +0000
commite326e22eb83f420982dce32347929f538e764204 (patch)
tree66f518bdf7e971a0c5d10ed0dd2ee6764844fa9d
parente94a2f691d67ad98be9036e76c765fcfa7d22552 (diff)
[rubygems/rubygems] Removed deprecated legacy windows platform support
https://github.com/rubygems/rubygems/commit/7d910dd94c Co-authored-by: David Rodríguez <2887858+deivid-rodriguez@users.noreply.github.com>
-rw-r--r--lib/bundler/dsl.rb18
-rw-r--r--lib/bundler/lockfile_parser.rb14
-rw-r--r--spec/bundler/bundler/dsl_spec.rb8
-rw-r--r--spec/bundler/bundler/lockfile_parser_spec.rb128
4 files changed, 13 insertions, 155 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 3bf5dbc115..d98dbd4759 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -411,7 +411,13 @@ module Bundler
next if VALID_PLATFORMS.include?(p)
raise GemfileError, "`#{p}` is not a valid platform. The available options are: #{VALID_PLATFORMS.inspect}"
end
- deprecate_legacy_windows_platforms(platforms)
+
+ windows_platforms = platforms.select {|pl| pl.to_s.match?(/mingw|mswin/) }
+ if windows_platforms.any?
+ windows_platforms = windows_platforms.map! {|pl| ":#{pl}" }.join(", ")
+ removed_message = "Platform #{windows_platforms} has been removed. Please use platform :windows instead."
+ Bundler::SharedHelpers.feature_removed! removed_message
+ end
# Save sources passed in a key
if opts.key?("source")
@@ -492,16 +498,6 @@ module Bundler
end
end
- def deprecate_legacy_windows_platforms(platforms)
- windows_platforms = platforms.select {|pl| pl.to_s.match?(/mingw|mswin/) }
- return if windows_platforms.empty?
-
- windows_platforms = windows_platforms.map! {|pl| ":#{pl}" }.join(", ")
- message = "Platform #{windows_platforms} is deprecated. Please use platform :windows instead."
- removed_message = "Platform #{windows_platforms} has been removed. Please use platform :windows instead."
- Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
- end
-
def check_path_source_safety
return if @sources.global_path_source.nil?
diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb
index 9ab9d73ae2..07b5bd7514 100644
--- a/lib/bundler/lockfile_parser.rb
+++ b/lib/bundler/lockfile_parser.rb
@@ -141,18 +141,8 @@ module Bundler
@pos.advance!(line)
end
- if !Bundler.frozen_bundle? && @platforms.include?(Gem::Platform::X64_MINGW_LEGACY)
- if @platforms.include?(Gem::Platform::X64_MINGW)
- @platforms.delete(Gem::Platform::X64_MINGW_LEGACY)
- SharedHelpers.major_deprecation(2,
- "Found x64-mingw32 in lockfile, which is deprecated. Removing it. Support for x64-mingw32 will be removed in Bundler 4.0.",
- removed_message: "Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0.")
- else
- @platforms[@platforms.index(Gem::Platform::X64_MINGW_LEGACY)] = Gem::Platform::X64_MINGW
- SharedHelpers.major_deprecation(2,
- "Found x64-mingw32 in lockfile, which is deprecated. Using x64-mingw-ucrt, the replacement for x64-mingw32 in modern rubies, instead. Support for x64-mingw32 will be removed in Bundler 4.0.",
- removed_message: "Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0.")
- end
+ if @platforms.include?(Gem::Platform::X64_MINGW_LEGACY)
+ SharedHelpers.feature_removed!("Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0.")
end
@most_specific_locked_platform = @platforms.min_by do |bundle_platform|
diff --git a/spec/bundler/bundler/dsl_spec.rb b/spec/bundler/bundler/dsl_spec.rb
index ac28aea4d7..e88033e955 100644
--- a/spec/bundler/bundler/dsl_spec.rb
+++ b/spec/bundler/bundler/dsl_spec.rb
@@ -221,8 +221,8 @@ RSpec.describe Bundler::Dsl do
to raise_error(Bundler::GemfileError, /is not a valid platform/)
end
- it "raises a deprecation warning for legacy windows platforms" do
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, /\APlatform :mswin, :x64_mingw is deprecated/, removed_message: /\APlatform :mswin, :x64_mingw has been removed/)
+ it "raises an error for legacy windows platforms" do
+ expect(Bundler::SharedHelpers).to receive(:feature_removed!).with(/\APlatform :mswin, :x64_mingw has been removed/)
subject.gem("foo", platforms: [:mswin, :jruby, :x64_mingw])
end
@@ -291,8 +291,8 @@ RSpec.describe Bundler::Dsl do
end
describe "#platforms" do
- it "raises a deprecation warning for legacy windows platforms" do
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, /\APlatform :mswin64, :mingw is deprecated/, removed_message: /\APlatform :mswin64, :mingw has been removed/)
+ it "raises an error for legacy windows platforms" do
+ expect(Bundler::SharedHelpers).to receive(:feature_removed!).with(/\APlatform :mswin64, :mingw has been removed/)
subject.platforms(:mswin64, :jruby, :mingw) do
subject.gem("foo")
end
diff --git a/spec/bundler/bundler/lockfile_parser_spec.rb b/spec/bundler/bundler/lockfile_parser_spec.rb
index 54aa6a0bfe..f38da2c993 100644
--- a/spec/bundler/bundler/lockfile_parser_spec.rb
+++ b/spec/bundler/bundler/lockfile_parser_spec.rb
@@ -95,134 +95,6 @@ RSpec.describe Bundler::LockfileParser do
end
end
- describe "X64_MINGW_LEGACY platform handling" do
- before { allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app("gems.rb")) }
-
- describe "when X64_MINGW_LEGACY is present alone" do
- let(:lockfile_with_legacy_platform) { <<~L }
- GEM
- remote: https://rubygems.org/
- specs:
- rake (10.3.2)
-
- PLATFORMS
- ruby
- x64-mingw32
-
- DEPENDENCIES
- rake
-
- BUNDLED WITH
- 3.6.9
- L
-
- context "when bundle is not frozen" do
- before { allow(Bundler).to receive(:frozen_bundle?).and_return(false) }
- subject { described_class.new(lockfile_with_legacy_platform) }
-
- it "replaces X64_MINGW_LEGACY with X64_MINGW" do
- allow(Bundler::SharedHelpers).to receive(:major_deprecation)
- expect(subject.platforms.map(&:to_s)).to contain_exactly("ruby", "x64-mingw-ucrt")
- expect(subject.platforms.map(&:to_s)).not_to include("x64-mingw32")
- end
-
- it "shows deprecation warning for replacement" do
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(
- 2,
- "Found x64-mingw32 in lockfile, which is deprecated. Using x64-mingw-ucrt, the replacement for x64-mingw32 in modern rubies, instead. Support for x64-mingw32 will be removed in Bundler 4.0.",
- removed_message: "Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0."
- )
- subject
- end
- end
-
- context "when bundle is frozen" do
- before { allow(Bundler).to receive(:frozen_bundle?).and_return(true) }
- subject { described_class.new(lockfile_with_legacy_platform) }
-
- it "preserves X64_MINGW_LEGACY platform without replacement" do
- expect(subject.platforms.map(&:to_s)).to contain_exactly("ruby", "x64-mingw32")
- end
-
- it "does not show any deprecation warnings" do
- expect(Bundler::SharedHelpers).not_to receive(:major_deprecation)
- subject
- end
- end
- end
-
- describe "when both X64_MINGW_LEGACY and X64_MINGW are present" do
- let(:lockfile_with_both_platforms) { <<~L }
- GEM
- remote: https://rubygems.org/
- specs:
- rake (10.3.2)
-
- PLATFORMS
- ruby
- x64-mingw32
- x64-mingw-ucrt
-
- DEPENDENCIES
- rake
-
- BUNDLED WITH
- 3.6.9
- L
-
- context "when bundle is not frozen" do
- before { allow(Bundler).to receive(:frozen_bundle?).and_return(false) }
- subject { described_class.new(lockfile_with_both_platforms) }
-
- it "removes X64_MINGW_LEGACY and keeps X64_MINGW" do
- allow(Bundler::SharedHelpers).to receive(:major_deprecation)
- expect(subject.platforms.map(&:to_s)).to contain_exactly("ruby", "x64-mingw-ucrt")
- expect(subject.platforms.map(&:to_s)).not_to include("x64-mingw32")
- end
-
- it "shows deprecation warning for removing legacy platform" do
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(
- 2,
- "Found x64-mingw32 in lockfile, which is deprecated. Removing it. Support for x64-mingw32 will be removed in Bundler 4.0.",
- removed_message: "Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0."
- )
- subject
- end
- end
- end
-
- describe "when no X64_MINGW_LEGACY platform is present" do
- let(:lockfile_with_modern_platforms) { <<~L }
- GEM
- remote: https://rubygems.org/
- specs:
- rake (10.3.2)
-
- PLATFORMS
- ruby
- x64-mingw-ucrt
-
- DEPENDENCIES
- rake
-
- BUNDLED WITH
- 3.6.9
- L
-
- before { allow(Bundler).to receive(:frozen_bundle?).and_return(false) }
- subject { described_class.new(lockfile_with_modern_platforms) }
-
- it "preserves all modern platforms without changes" do
- expect(subject.platforms.map(&:to_s)).to contain_exactly("ruby", "x64-mingw-ucrt")
- end
-
- it "does not show any deprecation warnings" do
- expect(Bundler::SharedHelpers).not_to receive(:major_deprecation)
- subject
- end
- end
- end
-
describe "#initialize" do
before { allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app("gems.rb")) }
subject { described_class.new(lockfile_contents) }