mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[bundler/bundler] Add all platforms to lockfile by default
https://github.com/bundler/bundler/commit/3dc509e645
This commit is contained in:
parent
d8cd45cb1a
commit
c1ca77281d
4 changed files with 32 additions and 6 deletions
|
@ -172,6 +172,8 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
def retrieve_active_spec(strict, definition, current_spec)
|
def retrieve_active_spec(strict, definition, current_spec)
|
||||||
|
return unless current_spec.match_platform(Bundler.local_platform)
|
||||||
|
|
||||||
if strict
|
if strict
|
||||||
active_spec = definition.find_resolved_spec(current_spec)
|
active_spec = definition.find_resolved_spec(current_spec)
|
||||||
else
|
else
|
||||||
|
|
|
@ -113,7 +113,7 @@ module Bundler
|
||||||
end
|
end
|
||||||
@unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
|
@unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
|
||||||
|
|
||||||
add_current_platform unless Bundler.frozen_bundle?
|
add_platforms unless Bundler.frozen_bundle?
|
||||||
|
|
||||||
converge_path_sources_to_gemspec_sources
|
converge_path_sources_to_gemspec_sources
|
||||||
@path_changes = converge_paths
|
@path_changes = converge_paths
|
||||||
|
@ -543,6 +543,12 @@ module Bundler
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def add_platforms
|
||||||
|
(@dependencies.flat_map(&:expanded_platforms) + current_platforms).uniq.each do |platform|
|
||||||
|
add_platform(platform)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def current_platforms
|
def current_platforms
|
||||||
current_platform = Bundler.local_platform
|
current_platform = Bundler.local_platform
|
||||||
platforms = []
|
platforms = []
|
||||||
|
|
|
@ -372,7 +372,7 @@ RSpec.describe "bundle install with platform conditionals" do
|
||||||
expect(out).not_to match(/Could not find gem 'some_gem/)
|
expect(out).not_to match(/Could not find gem 'some_gem/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "prints a helpful warning when a dependency is unused on any platform" do
|
it "resolves all platforms by default and without warning messages" do
|
||||||
simulate_platform "ruby"
|
simulate_platform "ruby"
|
||||||
simulate_ruby_engine "ruby"
|
simulate_ruby_engine "ruby"
|
||||||
|
|
||||||
|
@ -384,9 +384,27 @@ RSpec.describe "bundle install with platform conditionals" do
|
||||||
|
|
||||||
bundle! "install"
|
bundle! "install"
|
||||||
|
|
||||||
expect(err).to include <<-O.strip
|
expect(err).to be_empty
|
||||||
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
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when disable_platform_warnings is true" do
|
context "when disable_platform_warnings is true" do
|
||||||
|
|
|
@ -425,7 +425,7 @@ RSpec.describe "Bundler.require with platform specific dependencies" do
|
||||||
source "#{file_uri_for(gem_repo1)}"
|
source "#{file_uri_for(gem_repo1)}"
|
||||||
|
|
||||||
platforms :#{not_local_tag} do
|
platforms :#{not_local_tag} do
|
||||||
gem "fail", :require => "omgomg"
|
gem "platform_specific", :require => "omgomg"
|
||||||
end
|
end
|
||||||
|
|
||||||
gem "rack", "1.0.0"
|
gem "rack", "1.0.0"
|
||||||
|
|
Loading…
Add table
Reference in a new issue