[前][次][番号順一覧][スレッド一覧]

ruby-changes:57784

From: David <ko1@a...>
Date: Wed, 18 Sep 2019 19:21:43 +0900 (JST)
Subject: [ruby-changes:57784] 0c6529bac2 (master): [bundler/bundler] Revert "Add all platforms to lockfile by default"

https://git.ruby-lang.org/ruby.git/commit/?id=0c6529bac2

From 0c6529bac2c38c536567e443b7da851144e84be8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Wed, 21 Aug 2019 20:53:36 +0200
Subject: [bundler/bundler] Revert "Add all platforms to lockfile by default"

This reverts commit 3dc509e645abb497e4dc92a7c42be471ff87db0b.

https://github.com/bundler/bundler/commit/b5766564fb

diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb
index 5c8cd26..0b710e9 100644
--- a/lib/bundler/cli/outdated.rb
+++ b/lib/bundler/cli/outdated.rb
@@ -169,8 +169,6 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/outdated.rb#L169
     end
 
     def retrieve_active_spec(definition, current_spec)
-      return unless current_spec.match_platform(Bundler.local_platform)
-
       if strict
         active_spec = definition.find_resolved_spec(current_spec)
       else
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 3f5e8ce..01ee86a 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -113,7 +113,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L113
       end
       @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
 
-      add_platforms unless Bundler.frozen_bundle?
+      add_current_platform unless Bundler.frozen_bundle?
 
       converge_path_sources_to_gemspec_sources
       @path_changes = converge_paths
@@ -543,12 +543,6 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L543
 
   private
 
-    def add_platforms
-      (@dependencies.flat_map(&:expanded_platforms) + current_platforms).uniq.each do |platform|
-        add_platform(platform)
-      end
-    end
-
     def current_platforms
       current_platform = Bundler.local_platform
       [].tap do |platforms|
diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb
index 4cbf238..c096531 100644
--- a/spec/bundler/install/gemfile/platform_spec.rb
+++ b/spec/bundler/install/gemfile/platform_spec.rb
@@ -372,7 +372,7 @@ RSpec.describe "bundle install with platform conditionals" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/install/gemfile/platform_spec.rb#L372
     expect(out).not_to match(/Could not find gem 'some_gem/)
   end
 
-  it "resolves all platforms by default and without warning messages" do
+  it "prints a helpful warning when a dependency is unused on any platform" do
     simulate_platform "ruby"
     simulate_ruby_engine "ruby"
 
@@ -384,27 +384,9 @@ RSpec.describe "bundle install with platform conditionals" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/install/gemfile/platform_spec.rb#L384
 
     bundle! "install"
 
-    expect(err).to be_empty
-
-    lockfile_should_be <<-L
-      GEM
-        remote: #{file_uri_for(gem_repo1)}/
-        specs:
-          rack (1.0.0)
-
-      PLATFORMS
-        java
-        ruby
-        x64-mingw32
-        x86-mingw32
-        x86-mswin32
-
-      DEPENDENCIES
-        rack
-
-      BUNDLED WITH
-         #{Bundler::VERSION}
-    L
+    expect(err).to include <<-O.strip
+The dependency #{Gem::Dependency.new("rack", ">= 0")} will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
+    O
   end
 
   context "when disable_platform_warnings is true" do
diff --git a/spec/bundler/runtime/require_spec.rb b/spec/bundler/runtime/require_spec.rb
index 7874a86..42d0c2d 100644
--- a/spec/bundler/runtime/require_spec.rb
+++ b/spec/bundler/runtime/require_spec.rb
@@ -425,7 +425,7 @@ RSpec.describe "Bundler.require with platform specific dependencies" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/runtime/require_spec.rb#L425
       source "#{file_uri_for(gem_repo1)}"
 
       platforms :#{not_local_tag} do
-        gem "platform_specific", :require => "omgomg"
+        gem "fail", :require => "omgomg"
       end
 
       gem "rack", "1.0.0"
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]