diff options
author | Bundlerbot <bot@bundler.io> | 2019-08-27 06:49:23 +0000 |
---|---|---|
committer | Bundlerbot <bot@bundler.io> | 2019-08-27 06:49:23 +0000 |
commit | b3e1177d4b64cc154b85a3b70bf0b7acd44d98bc (patch) | |
tree | 2a2ce7cca2ce4fea33c41385f0c31a203859face /lib | |
parent | 31414dd7768d6492b5174a349cbf0ab5c12c9989 (diff) | |
parent | b5766564fb6ad9c74c3b87ad6b2965f3b9095d08 (diff) | |
download | bundler-b3e1177d4b64cc154b85a3b70bf0b7acd44d98bc.tar.gz |
Merge #7329
7329: Undo auto multiplatform r=deivid-rodriguez a=deivid-rodriguez
### What was the end-user problem that led to this PR?
The problem was that since #7215, more Gemfiles are going to fail resolution because of the current issues with multiplatform support, and that we'll be pushing current multiplatform problems into all users because bundler will resolve and lock all platforms included on a Gemfile by default.
### What was your diagnosis of the problem?
My diagnosis was that we probably need better multiplatform support before we start resolving all platforms by default.
### What is your fix for the problem, implemented in this PR?
My fix is to revert the relevant commits from #7215. I'll try to revisit in the future.
### Why did you choose this fix out of the possible options?
I chose this fix because it goes back to how things were before.
Closes #7315.
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/cli/outdated.rb | 2 | ||||
-rw-r--r-- | lib/bundler/definition.rb | 24 | ||||
-rw-r--r-- | lib/bundler/inline.rb | 2 | ||||
-rw-r--r-- | lib/bundler/settings.rb | 1 |
4 files changed, 18 insertions, 11 deletions
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb index 5c8cd26d88..0b710e9782 100644 --- a/lib/bundler/cli/outdated.rb +++ b/lib/bundler/cli/outdated.rb @@ -169,8 +169,6 @@ module Bundler 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 de3950a744..01ee86a358 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -113,7 +113,7 @@ module Bundler 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 @@ -518,6 +518,10 @@ module Bundler raise InvalidOption, "Unable to remove the platform `#{platform}` since the only platforms are #{@platforms.join ", "}" end + def add_current_platform + current_platforms.each {|platform| add_platform(platform) } + end + def find_resolved_spec(current_spec) specs.find_by_name_and_platform(current_spec.name, current_spec.platform) end @@ -539,12 +543,6 @@ module Bundler 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| @@ -892,7 +890,17 @@ module Bundler dependencies.each do |dep| dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name) next if !remote && !dep.current_platform? - dep.gem_platforms(sorted_platforms).each do |p| + platforms = dep.gem_platforms(sorted_platforms) + if platforms.empty? && !Bundler.settings[:disable_platform_warnings] + mapped_platforms = dep.expanded_platforms + Bundler.ui.warn \ + "The dependency #{dep} will be unused by any of the platforms Bundler is installing for. " \ + "Bundler is installing for #{@platforms.join ", "} but the dependency " \ + "is only for #{mapped_platforms.join ", "}. " \ + "To add those platforms to the bundle, " \ + "run `bundle lock --add-platform #{mapped_platforms.join " "}`." + end + platforms.each do |p| deps << DepProxy.new(dep, p) if remote || p == generic_local_platform end end diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb index c7c58de52b..dbf737c7ee 100644 --- a/lib/bundler/inline.rb +++ b/lib/bundler/inline.rb @@ -58,7 +58,7 @@ def gemfile(install = false, options = {}, &gemfile) Bundler.ui = ui if install if install || missing_specs.call - Bundler.settings.temporary(:inline => true) do + Bundler.settings.temporary(:inline => true, :disable_platform_warnings => true) do installer = Bundler::Installer.install(Bundler.root, definition, :system => true) installer.post_install_messages.each do |name, message| Bundler.ui.info "Post-install message from #{name}:\n#{message}" diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 166e494f0e..2074070e3e 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -24,6 +24,7 @@ module Bundler disable_exec_load disable_local_branch_check disable_multisource + disable_platform_warnings disable_shared_gems disable_version_check force_ruby_platform |