diff --git a/bundler/lib/bundler/gem_helpers.rb b/bundler/lib/bundler/gem_helpers.rb index 75243873f26c..25da0b14d2f6 100644 --- a/bundler/lib/bundler/gem_helpers.rb +++ b/bundler/lib/bundler/gem_helpers.rb @@ -10,8 +10,8 @@ module GemHelpers [Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")], [Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw32")], [Gem::Platform.new("x86_64-mingw32"), Gem::Platform.new("x64-mingw32")], - [Gem::Platform.new("x64-mingw-ucrt"), Gem::Platform.new("x64-mingw-ucrt")], [Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")], + [Gem::Platform.new("mingw"), Gem::Platform.new("mingw")], ].freeze def generic(p) diff --git a/bundler/lib/bundler/rubygems_ext.rb b/bundler/lib/bundler/rubygems_ext.rb index bc7f65c7f7eb..bdca8ea8ee2a 100644 --- a/bundler/lib/bundler/rubygems_ext.rb +++ b/bundler/lib/bundler/rubygems_ext.rb @@ -297,7 +297,8 @@ class Platform MINGW = Gem::Platform.new("x86-mingw32") X64_MINGW = [Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw-ucrt")].freeze - WINDOWS = [MSWIN, MSWIN64, MINGW, X64_MINGW].flatten.freeze + WINDOWS = [Gem::Platform.new("mingw"), + MSWIN, MSWIN64, MINGW, X64_MINGW].flatten.freeze X64_LINUX = Gem::Platform.new("x86_64-linux") X64_LINUX_MUSL = Gem::Platform.new("x86_64-linux-musl") diff --git a/bundler/spec/commands/install_spec.rb b/bundler/spec/commands/install_spec.rb index 1c99a1877ae0..a1344769b013 100644 --- a/bundler/spec/commands/install_spec.rb +++ b/bundler/spec/commands/install_spec.rb @@ -291,6 +291,17 @@ expect(the_bundle).to include_gems("platform_specific 1.0 x86-mswin32") end end + + it "installs gems for aarch64-mingw-ucrt" do + simulate_platform aarch64_mingw_ucrt do + install_gemfile <<-G + source "https://gem.repo1" + gem "platform_specific" + G + + expect(the_bundle).to include_gems("platform_specific 1.0 aarch64-mingw-ucrt") + end + end end describe "doing bundle install foo" do diff --git a/bundler/spec/other/ext_spec.rb b/bundler/spec/other/ext_spec.rb index 9fc0414b4d33..71608f6c0e7c 100644 --- a/bundler/spec/other/ext_spec.rb +++ b/bundler/spec/other/ext_spec.rb @@ -45,8 +45,13 @@ expect(generic(pl("x86_64-mingw32"))).to eq(pl("x64-mingw32")) end - it "converts 64-bit mingw UCRT platform variants into x64-mingw-ucrt" do - expect(generic(pl("x64-mingw-ucrt"))).to eq(pl("x64-mingw-ucrt")) + it "converts 64-bit mingw UCRT platform variants into mingw" do + expect(generic(pl("x64-mingw-ucrt"))).to eq(pl("mingw")) + end + + it "converts aarch64 mingw platform variants into mingw" do + expect(generic(pl("aarch64-mingw"))).to eq(pl("mingw")) + expect(generic(pl("aarch64-mingw-ucrt"))).to eq(pl("mingw")) end end diff --git a/bundler/spec/runtime/platform_spec.rb b/bundler/spec/runtime/platform_spec.rb index 007733d3deb7..08767d7fe368 100644 --- a/bundler/spec/runtime/platform_spec.rb +++ b/bundler/spec/runtime/platform_spec.rb @@ -438,7 +438,7 @@ end end - %w[x86-mswin32 x64-mswin64 x86-mingw32 x64-mingw32 x64-mingw-ucrt].each do |arch| + %w[aarch64-mingw-ucrt x86-mswin32 x64-mswin64 x86-mingw32 x64-mingw32 x64-mingw-ucrt].each do |arch| it "allows specifying platform windows on #{arch} arch" do platform = send(arch.tr("-", "_")) @@ -469,4 +469,26 @@ end end end + + %w[aarch64-mingw x64-mingw x64-mingw-foobar].each do |arch| + it "does not find platform-specific gems on #{arch} arch" do + platform = Gem::Platform.new(arch) + + simulate_windows platform do + lockfile <<-L + PLATFORMS + #{platform} + L + + install_gemfile <<-G + source "https://gem.repo1" + gem "platform_specific", :platforms => [:windows] + G + + bundle "install" + + expect(the_bundle).to_not include_gems "platform_specific 1.0 #{platform}" + end + end + end end diff --git a/bundler/spec/support/builders.rb b/bundler/spec/support/builders.rb index 340b3f5dd9fe..0cbea697805b 100644 --- a/bundler/spec/support/builders.rb +++ b/bundler/spec/support/builders.rb @@ -118,6 +118,10 @@ def build_repo1 s.platform = "x64-mingw-ucrt" end + build_gem "platform_specific" do |s| + s.platform = "aarch64-mingw-ucrt" + end + build_gem "platform_specific" do |s| s.platform = "x86-darwin-100" end diff --git a/bundler/spec/support/platforms.rb b/bundler/spec/support/platforms.rb index 526e1c09a9c0..e3070dd2a444 100644 --- a/bundler/spec/support/platforms.rb +++ b/bundler/spec/support/platforms.rb @@ -44,8 +44,12 @@ def x64_mingw_ucrt Gem::Platform.new(["x64", "mingw", "ucrt"]) end + def aarch64_mingw_ucrt + Gem::Platform.new(["aarch64", "mingw", "ucrt"]) + end + def windows_platforms - [x86_mswin32, x64_mswin64, x86_mingw32, x64_mingw32, x64_mingw_ucrt] + [x86_mswin32, x64_mswin64, x86_mingw32, x64_mingw32, x64_mingw_ucrt, aarch64_mingw_ucrt] end def all_platforms @@ -59,7 +63,7 @@ def not_local def local_tag if RUBY_PLATFORM == "java" :jruby - elsif ["x64-mingw32", "x64-mingw-ucrt"].include?(RUBY_PLATFORM) + elsif RUBY_PLATFORM.match?(/mingw|mswin/) :windows else :ruby @@ -105,7 +109,7 @@ def lockfile_platforms(*extra, defaults: default_locked_platforms) end def default_locked_platforms - [local_platform, generic_local_platform] + [local_platform, generic_local_platform] - [Gem::Platform.new("mingw")] end end end diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb index 070c8007bc00..c95107f5d438 100644 --- a/test/rubygems/test_gem_platform.rb +++ b/test/rubygems/test_gem_platform.rb @@ -123,6 +123,7 @@ def test_initialize "i386-linux-gnu" => ["x86", "linux", "gnu"], "i386-mingw32" => ["x86", "mingw32", nil], "x64-mingw-ucrt" => ["x64", "mingw", "ucrt"], + "aarch64-mingw-ucrt" => ["aarch64", "mingw", "ucrt"], "i386-mswin32" => ["x86", "mswin32", nil], "i386-mswin32_80" => ["x86", "mswin32", "80"], "i386-mswin32-80" => ["x86", "mswin32", "80"],