Skip to content

Commit fb2a3c3

Browse files
Support install arm native gems on Windows
Co-authored-by: Johnny Shields <johnny.shields@gmail.com>
1 parent cc2cb16 commit fb2a3c3

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

bundler/lib/bundler/gem_helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module GemHelpers
1111
def generic(p)
1212
GENERIC_CACHE[p] ||= begin
1313
found = GENERICS.find do |match|
14-
p.os == match.os && (!match.cpu || p.cpu == match.cpu)
14+
p === match
1515
end
1616
found || Gem::Platform::RUBY
1717
end

bundler/lib/bundler/rubygems_ext.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ class Platform
6767
MINGW = Gem::Platform.new("x86-mingw32")
6868
X64_MINGW = [Gem::Platform.new("x64-mingw32"),
6969
Gem::Platform.new("x64-mingw-ucrt")].freeze
70-
WINDOWS = [MSWIN, MSWIN64, MINGW, X64_MINGW].flatten.freeze
70+
UNIVERSAL_MINGW = Gem::Platform.new("universal-mingw")
71+
WINDOWS = [MSWIN, MSWIN64, UNIVERSAL_MINGW].flatten.freeze
7172
X64_LINUX = Gem::Platform.new("x86_64-linux")
7273
X64_LINUX_MUSL = Gem::Platform.new("x86_64-linux-musl")
7374

bundler/spec/commands/install_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,23 @@
290290
expect(the_bundle).to include_gems("platform_specific 1.0 x86-mswin32")
291291
end
292292
end
293+
294+
it "installs gems for aarch64-mingw-ucrt" do
295+
build_repo2 do
296+
build_gem "platform_specific" do |s|
297+
s.platform = "aarch64-mingw-ucrt"
298+
end
299+
end
300+
301+
simulate_platform "aarch64-mingw-ucrt" do
302+
install_gemfile <<-G
303+
source "https://gem.repo2"
304+
gem "platform_specific"
305+
G
306+
end
307+
308+
expect(out).to include("Installing platform_specific 1.0 (aarch64-mingw-ucrt)")
309+
end
293310
end
294311

295312
describe "doing bundle install foo" do

bundler/spec/other/ext_spec.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,21 @@
3434
expect(generic(pl("x86-mswin32"))).to eq(pl("x86-mswin32"))
3535
end
3636

37-
it "converts 32-bit mingw platform variants into x86-mingw32" do
38-
expect(generic(pl("i386-mingw32"))).to eq(pl("x86-mingw32"))
39-
expect(generic(pl("x86-mingw32"))).to eq(pl("x86-mingw32"))
37+
it "converts 32-bit mingw platform variants into universal-mingw" do
38+
expect(generic(pl("i386-mingw32"))).to eq(pl("universal-mingw"))
39+
expect(generic(pl("x86-mingw32"))).to eq(pl("universal-mingw"))
4040
end
4141

42-
it "converts 64-bit mingw platform variants into x64-mingw32" do
43-
expect(generic(pl("x64-mingw32"))).to eq(pl("x64-mingw32"))
42+
it "converts 64-bit mingw platform variants into universal-mingw" do
43+
expect(generic(pl("x64-mingw32"))).to eq(pl("universal-mingw"))
4444
end
4545

46-
it "converts 64-bit mingw UCRT platform variants into x64-mingw-ucrt" do
47-
expect(generic(pl("x64-mingw-ucrt"))).to eq(pl("x64-mingw-ucrt"))
46+
it "converts x64 mingw UCRT platform variants into universal-mingw" do
47+
expect(generic(pl("x64-mingw-ucrt"))).to eq(pl("universal-mingw"))
48+
end
49+
50+
it "converts aarch64 mingw UCRT platform variants into aarch64-mingw-ucrt" do
51+
expect(generic(pl("aarch64-mingw-ucrt"))).to eq(pl("universal-mingw"))
4852
end
4953
end
5054

0 commit comments

Comments
 (0)