Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert resolving all Gemfile platforms automatically #4052

Merged
merged 1 commit into from Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -123,7 +123,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 @@ -554,10 +554,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