Skip to content

Commit

Permalink
Merge pull request #4052 from rubygems/revert_automultiplatform_again
Browse files Browse the repository at this point in the history
Revert resolving all Gemfile platforms automatically

(cherry picked from commit a9b3694)
  • Loading branch information
deivid-rodriguez committed Dec 7, 2020
1 parent 9ac9cbf commit 073bef7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
6 changes: 2 additions & 4 deletions bundler/lib/bundler/cli/outdated.rb
Expand Up @@ -76,8 +76,6 @@ def run
next unless gems.empty? || gems.include?(current_spec.name)

active_spec = retrieve_active_spec(definition, current_spec)
next unless active_spec

next unless filter_options_patch.empty? || update_present_via_semver_portions(current_spec, active_spec, options)

gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
Expand Down Expand Up @@ -146,8 +144,6 @@ def nothing_outdated_message
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
Expand Down Expand Up @@ -233,6 +229,8 @@ def check_for_deployment_mode!
end

def update_present_via_semver_portions(current_spec, active_spec, options)
return false if active_spec.nil?

current_major = current_spec.version.segments.first
active_major = active_spec.version.segments.first

Expand Down
8 changes: 3 additions & 5 deletions bundler/lib/bundler/definition.rb
Expand Up @@ -118,7 +118,7 @@ def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil, opti
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
Expand Down Expand Up @@ -547,10 +547,8 @@ def unlocking?

private

def add_platforms
(@dependencies.flat_map(&:expanded_platforms) + current_platforms).uniq.each do |platform|
add_platform(platform)
end
def add_current_platform
current_platforms.each {|platform| add_platform(platform) }
end

def current_platforms
Expand Down
7 changes: 1 addition & 6 deletions bundler/spec/install/gemfile/platform_spec.rb
Expand Up @@ -430,7 +430,7 @@
expect(out).not_to match(/Could not find gem 'some_gem/)
end

it "resolves all platforms by default and without warning messages" do
it "does not print a warning when a dependency is unused on a platform different from the current one" do
simulate_platform "ruby"

gemfile <<-G
Expand All @@ -447,14 +447,9 @@
GEM
remote: #{file_uri_for(gem_repo1)}/
specs:
rack (1.0.0)
PLATFORMS
java
ruby
x64-mingw32
x86-mingw32
x86-mswin32
DEPENDENCIES
rack
Expand Down

0 comments on commit 073bef7

Please sign in to comment.