summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/current_ruby.rb24
-rw-r--r--lib/bundler/dependency.rb3
-rw-r--r--lib/bundler/man/gemfile.58
-rw-r--r--lib/bundler/man/gemfile.5.ronn4
-rw-r--r--spec/bundler/bundler/dependency_spec.rb9
-rw-r--r--spec/bundler/commands/cache_spec.rb12
-rw-r--r--spec/bundler/install/gemfile/platform_spec.rb2
-rw-r--r--spec/bundler/runtime/platform_spec.rb2
8 files changed, 37 insertions, 27 deletions
diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb
index f009b07ad7..7a5426748c 100644
--- a/lib/bundler/current_ruby.rb
+++ b/lib/bundler/current_ruby.rb
@@ -71,26 +71,10 @@ module Bundler
def windows?
Gem.win_platform?
end
-
- def mswin?
- # For backwards compatibility
- windows?
-
- # TODO: This should correctly be:
- # windows? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin32" && Bundler.local_platform.cpu == "x86"
- end
-
- def mswin64?
- windows? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin64" && Bundler.local_platform.cpu == "x64"
- end
-
- def mingw?
- windows? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu != "x64"
- end
-
- def x64_mingw?
- Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os.start_with?("mingw") && Bundler.local_platform.cpu == "x64"
- end
+ alias mswin? windows?
+ alias mswin64? windows?
+ alias mingw? windows?
+ alias x64_mingw? windows?
(KNOWN_MINOR_VERSIONS + KNOWN_MAJOR_VERSIONS).each do |version|
trimmed_version = version.tr(".", "")
diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb
index 5f17943629..21a4564dcc 100644
--- a/lib/bundler/dependency.rb
+++ b/lib/bundler/dependency.rb
@@ -17,7 +17,8 @@ module Bundler
:truffleruby => [Gem::Platform::RUBY],
:jruby => [Gem::Platform::JAVA, [18, 19]],
:windows => [Gem::Platform::WINDOWS, ALL_RUBY_VERSIONS],
- :mswin => [Gem::Platform::MSWIN, ALL_RUBY_VERSIONS],
+ # deprecated
+ :mswin => [Gem::Platform::MSWIN, ALL_RUBY_VERSIONS],
:mswin64 => [Gem::Platform::MSWIN64, ALL_RUBY_VERSIONS - [18]],
:mingw => [Gem::Platform::MINGW, ALL_RUBY_VERSIONS],
:x64_mingw => [Gem::Platform::X64_MINGW, ALL_RUBY_VERSIONS - [18, 19]],
diff --git a/lib/bundler/man/gemfile.5 b/lib/bundler/man/gemfile.5
index a9124d26ea..8e56506c88 100644
--- a/lib/bundler/man/gemfile.5
+++ b/lib/bundler/man/gemfile.5
@@ -318,6 +318,14 @@ gem "nokogiri", platforms: [:windows_31, :jruby]
.P
All operations involving groups (\fBbundle install\fR \fIbundle\-install\.1\.html\fR, \fBBundler\.setup\fR, \fBBundler\.require\fR) behave exactly the same as if any groups not matching the current platform were explicitly excluded\.
.
+.P
+The following platform values are deprecated and should be replaced with \fBwindows\fR:
+.
+.IP "\(bu" 4
+\fBmswin\fR, \fBmswin64\fR, \fBmingw32\fR, \fBx64_mingw\fR
+.
+.IP "" 0
+.
.SS "FORCE_RUBY_PLATFORM"
If you always want the pure ruby variant of a gem to be chosen over platform specific variants, you can use the \fBforce_ruby_platform\fR option:
.
diff --git a/lib/bundler/man/gemfile.5.ronn b/lib/bundler/man/gemfile.5.ronn
index a3affc30cc..a5d2288b96 100644
--- a/lib/bundler/man/gemfile.5.ronn
+++ b/lib/bundler/man/gemfile.5.ronn
@@ -228,6 +228,10 @@ All operations involving groups ([`bundle install`](bundle-install.1.html), `Bun
`Bundler.require`) behave exactly the same as if any groups not
matching the current platform were explicitly excluded.
+The following platform values are deprecated and should be replaced with `windows`:
+
+ * `mswin`, `mswin64`, `mingw32`, `x64_mingw`
+
### FORCE_RUBY_PLATFORM
If you always want the pure ruby variant of a gem to be chosen over platform
diff --git a/spec/bundler/bundler/dependency_spec.rb b/spec/bundler/bundler/dependency_spec.rb
index 6e346c36c1..1ef511f1aa 100644
--- a/spec/bundler/bundler/dependency_spec.rb
+++ b/spec/bundler/bundler/dependency_spec.rb
@@ -89,8 +89,11 @@ RSpec.describe Bundler::Dependency do
:windows_30 => Gem::Platform::WINDOWS,
:windows_31 => Gem::Platform::WINDOWS,
:windows_32 => Gem::Platform::WINDOWS,
- :windows_33 => Gem::Platform::WINDOWS,
- :mswin => Gem::Platform::MSWIN,
+ :windows_33 => Gem::Platform::WINDOWS }
+ end
+
+ let(:deprecated) do
+ { :mswin => Gem::Platform::MSWIN,
:mswin_18 => Gem::Platform::MSWIN,
:mswin_19 => Gem::Platform::MSWIN,
:mswin_20 => Gem::Platform::MSWIN,
@@ -151,7 +154,7 @@ RSpec.describe Bundler::Dependency do
# rubocop:enable Naming/VariableNumber
it "includes all platforms" do
- expect(subject).to eq(platforms)
+ expect(subject).to eq(platforms.merge(deprecated))
end
end
end
diff --git a/spec/bundler/commands/cache_spec.rb b/spec/bundler/commands/cache_spec.rb
index 356a658e7c..790373be1f 100644
--- a/spec/bundler/commands/cache_spec.rb
+++ b/spec/bundler/commands/cache_spec.rb
@@ -211,7 +211,17 @@ RSpec.describe "bundle cache" do
end
context "with --all-platforms" do
- it "puts the gems in vendor/cache even for other rubies" do
+ it "puts the gems in vendor/cache even for other rubies", :bundler => ">= 2.4.0" do
+ gemfile <<-D
+ source "#{file_uri_for(gem_repo1)}"
+ gem 'rack', :platforms => [:ruby_20, :windows_20]
+ D
+
+ bundle "cache --all-platforms"
+ expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
+ end
+
+ it "puts the gems in vendor/cache even for legacy windows rubies", :bundler => ">= 2.4.0" do
gemfile <<-D
source "#{file_uri_for(gem_repo1)}"
gem 'rack', :platforms => [:ruby_20, :x64_mingw_20]
diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb
index e9cf0cb636..624de6455d 100644
--- a/spec/bundler/install/gemfile/platform_spec.rb
+++ b/spec/bundler/install/gemfile/platform_spec.rb
@@ -550,7 +550,7 @@ RSpec.describe "bundle install with platform conditionals" do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :platform => [:windows, :mingw, :mswin, :x64_mingw, :jruby]
+ gem "rack", :platform => [:windows, :mswin, :mswin64, :mingw, :x64_mingw, :jruby]
G
bundle "install"
diff --git a/spec/bundler/runtime/platform_spec.rb b/spec/bundler/runtime/platform_spec.rb
index caf69bf085..5bdc0ffc4f 100644
--- a/spec/bundler/runtime/platform_spec.rb
+++ b/spec/bundler/runtime/platform_spec.rb
@@ -365,7 +365,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
simulate_windows do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "nokogiri", :platforms => [:mingw, :mswin, :x64_mingw, :jruby]
+ gem "nokogiri", :platforms => [:windows, :mswin, :mswin64, :mingw, :x64_mingw, :jruby]
gem "platform_specific"
G