summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Arko <andre@arko.net>2013-08-14 22:07:49 -0700
committerAndré Arko <andre@arko.net>2013-08-14 22:07:49 -0700
commit468fac251877250301546b3554bfb387f883b8ce (patch)
tree3f42b2029460c9bc10e315de7103fbb0d0b8de6f
parente4dbd8f9e7e7e0bf289b2d5ef2122fd60843e428 (diff)
parent3b57eb0b9f05e88d8559f46654b6f3e2a59f3464 (diff)
downloadbundler-468fac251877250301546b3554bfb387f883b8ce.tar.gz
Merge pull request #2590 from larskanis/add_x64-mingw32_support
Add support for the x64-mingw32 platform
-rw-r--r--lib/bundler/current_ruby.rb10
-rw-r--r--lib/bundler/dependency.rb4
-rw-r--r--lib/bundler/gem_helpers.rb13
-rw-r--r--lib/bundler/rubygems_ext.rb1
-rw-r--r--man/gemfile.5.ronn6
-rw-r--r--spec/other/ext_spec.rb23
-rw-r--r--spec/resolver/platform_spec.rb8
-rw-r--r--spec/support/indexes.rb2
-rw-r--r--spec/support/platforms.rb6
9 files changed, 61 insertions, 12 deletions
diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb
index bbb9e41303..c35f55036c 100644
--- a/lib/bundler/current_ruby.rb
+++ b/lib/bundler/current_ruby.rb
@@ -69,7 +69,7 @@ module Bundler
end
def mingw?
- Bundler::WINDOWS && Gem::Platform.local.os == "mingw32"
+ Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu != 'x64'
end
def mingw_18?
@@ -84,5 +84,13 @@ module Bundler
mingw? && on_20?
end
+ def x64_mingw?
+ Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu == 'x64'
+ end
+
+ def x64_mingw_20?
+ x64_mingw? && on_20?
+ end
+
end
end
diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb
index 1fb6d8e1d4..f29b1a9584 100644
--- a/lib/bundler/dependency.rb
+++ b/lib/bundler/dependency.rb
@@ -23,7 +23,9 @@ module Bundler
:mingw => Gem::Platform::MINGW,
:mingw_18 => Gem::Platform::MINGW,
:mingw_19 => Gem::Platform::MINGW,
- :mingw_20 => Gem::Platform::MINGW
+ :mingw_20 => Gem::Platform::MINGW,
+ :x64_mingw => Gem::Platform::X64_MINGW,
+ :x64_mingw_20 => Gem::Platform::X64_MINGW
}.freeze
def initialize(name, version, options = {}, &blk)
diff --git a/lib/bundler/gem_helpers.rb b/lib/bundler/gem_helpers.rb
index 5eff233a56..2040604b78 100644
--- a/lib/bundler/gem_helpers.rb
+++ b/lib/bundler/gem_helpers.rb
@@ -3,18 +3,19 @@ module Bundler
GENERIC_CACHE = {}
GENERICS = [
- Gem::Platform.new('java'),
- Gem::Platform.new('mswin32'),
- Gem::Platform.new('x86-mingw32'),
- Gem::Platform::RUBY
+ [Gem::Platform.new('java'), Gem::Platform.new('java')],
+ [Gem::Platform.new('mswin32'), Gem::Platform.new('mswin32')],
+ [Gem::Platform.new('x64-mingw32'), Gem::Platform.new('x64-mingw32')],
+ [Gem::Platform.new('x86_64-mingw32'), Gem::Platform.new('x64-mingw32')],
+ [Gem::Platform.new('mingw32'), Gem::Platform.new('x86-mingw32')]
]
def generic(p)
return p if p == Gem::Platform::RUBY
GENERIC_CACHE[p] ||= begin
- found = GENERICS.find do |p2|
- p2.is_a?(Gem::Platform) && p.os == p2.os
+ _, found = GENERICS.find do |match, _generic|
+ p.os == match.os && (!match.cpu || p.cpu == match.cpu)
end
found || Gem::Platform::RUBY
end
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index 7b808a69cc..ac4567ac4c 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -136,6 +136,7 @@ module Gem
JAVA = Gem::Platform.new('java') unless defined?(JAVA)
MSWIN = Gem::Platform.new('mswin32') unless defined?(MSWIN)
MINGW = Gem::Platform.new('x86-mingw32') unless defined?(MINGW)
+ X64_MINGW = Gem::Platform.new('x64-mingw32') unless defined?(X64_MINGW)
undef_method :hash if method_defined? :hash
def hash
diff --git a/man/gemfile.5.ronn b/man/gemfile.5.ronn
index 2479b771de..ace9d864d4 100644
--- a/man/gemfile.5.ronn
+++ b/man/gemfile.5.ronn
@@ -164,13 +164,17 @@ There are a number of `Gemfile` platforms:
* `mswin`:
Windows
* `mingw`:
- Windows 'mingw32' platform (aka RubyInstaller)
+ Windows 32 bit 'mingw32' platform (aka RubyInstaller)
* `mingw_18`:
_mingw_ `AND` version 1.8
* `mingw_19`:
_mingw_ `AND` version 1.9
* `mingw_20`:
_mingw_ `AND` version 2.0
+ * `x64_mingw`:
+ Windows 64 bit 'mingw32' platform (aka RubyInstaller x64)
+ * `x64_mingw_20`:
+ _x64_mingw_ `AND` version 2.0
As with groups, you can specify one or more platforms:
diff --git a/spec/other/ext_spec.rb b/spec/other/ext_spec.rb
index 1509bc5f52..8ef5927c11 100644
--- a/spec/other/ext_spec.rb
+++ b/spec/other/ext_spec.rb
@@ -12,6 +12,29 @@ describe "Bundler::GemHelpers#generic" do
it "converts non-windows platforms into ruby" do
expect(generic(pl('x86-darwin-10'))).to eq(pl('ruby'))
+ expect(generic(pl('ruby'))).to eq(pl('ruby'))
+ end
+
+ it "converts java platform variants into java" do
+ expect(generic(pl('universal-java-17'))).to eq(pl('java'))
+ expect(generic(pl('java'))).to eq(pl('java'))
+ end
+
+ it "converts mswin platform variants into x86-mswin32" do
+ expect(generic(pl('mswin32'))).to eq(pl('x86-mswin32'))
+ expect(generic(pl('i386-mswin32'))).to eq(pl('x86-mswin32'))
+ expect(generic(pl('x86-mswin32'))).to eq(pl('x86-mswin32'))
+ end
+
+ it "converts 32-bit mingw platform variants into x86-mingw32" do
+ expect(generic(pl('mingw32'))).to eq(pl('x86-mingw32'))
+ expect(generic(pl('i386-mingw32'))).to eq(pl('x86-mingw32'))
+ expect(generic(pl('x86-mingw32'))).to eq(pl('x86-mingw32'))
+ end
+
+ it "converts 64-bit mingw platform variants into x64-mingw32" do
+ expect(generic(pl('x64-mingw32'))).to eq(pl('x64-mingw32'))
+ expect(generic(pl('x86_64-mingw32'))).to eq(pl('x64-mingw32'))
end
end
diff --git a/spec/resolver/platform_spec.rb b/spec/resolver/platform_spec.rb
index 7608d57e7a..2a126e4836 100644
--- a/spec/resolver/platform_spec.rb
+++ b/spec/resolver/platform_spec.rb
@@ -32,7 +32,7 @@ describe "Resolving platform craziness" do
before :each do
@index = build_index do
- platforms "mingw32 mswin32" do |platform|
+ platforms "mingw32 mswin32 x64-mingw32" do |platform|
gem "thin", "1.2.7", platform
end
end
@@ -51,6 +51,12 @@ describe "Resolving platform craziness" do
dep "thin"
should_resolve_as %w(thin-1.2.7-x86-mingw32)
end
+
+ it "finds x64-mingw gems" do
+ platforms "x64-mingw32"
+ dep "thin"
+ should_resolve_as %w(thin-1.2.7-x64-mingw32)
+ end
end
describe "with conflicting cases" do
diff --git a/spec/support/indexes.rb b/spec/support/indexes.rb
index 418f7f32db..476e393ad8 100644
--- a/spec/support/indexes.rb
+++ b/spec/support/indexes.rb
@@ -87,7 +87,7 @@ module Spec
end
versions '1.0 1.2 1.2.1 1.2.2 1.3 1.3.0.1 1.3.5 1.4.0 1.4.2 1.4.2.1' do |version|
- platforms "ruby java mswin32 mingw32" do |platform|
+ platforms "ruby java mswin32 mingw32 x64-mingw32" do |platform|
next if version == v('1.4.2.1') && platform != pl('x86-mswin32')
next if version == v('1.4.2') && platform == pl('x86-mswin32')
gem "nokogiri", version, platform do
diff --git a/spec/support/platforms.rb b/spec/support/platforms.rb
index a3114585a5..7636395dd2 100644
--- a/spec/support/platforms.rb
+++ b/spec/support/platforms.rb
@@ -26,8 +26,12 @@ module Spec
Gem::Platform.new(['x86', 'mingw32', nil])
end
+ def x64_mingw
+ Gem::Platform.new(['x64', 'mingw32', nil])
+ end
+
def all_platforms
- [rb, java, linux, mswin, mingw]
+ [rb, java, linux, mswin, mingw, x64_mingw]
end
def local