diff options
-rw-r--r-- | lib/bundler/definition.rb | 2 | ||||
-rw-r--r-- | lib/bundler/feature_flag.rb | 1 | ||||
-rw-r--r-- | lib/bundler/lazy_specification.rb | 2 | ||||
-rw-r--r-- | lib/bundler/settings.rb | 1 | ||||
-rw-r--r-- | spec/install/gemfile/platform_spec.rb | 2 | ||||
-rw-r--r-- | spec/other/platform_spec.rb | 14 | ||||
-rw-r--r-- | spec/support/platforms.rb | 4 |
7 files changed, 19 insertions, 7 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 9a0ee5cf17..71f6df9a69 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -492,7 +492,7 @@ module Bundler def add_current_platform current_platform = Bundler.local_platform - add_platform(current_platform) if Bundler.settings[:specific_platform] + add_platform(current_platform) if Bundler.feature_flag.specific_platform? add_platform(generic(current_platform)) end diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb index e901e047ed..1bc9d0b44c 100644 --- a/lib/bundler/feature_flag.rb +++ b/lib/bundler/feature_flag.rb @@ -39,6 +39,7 @@ module Bundler settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") } settings_flag(:prefer_gems_rb) { bundler_2_mode? } settings_flag(:skip_default_git_sources) { bundler_2_mode? } + settings_flag(:specific_platform) { bundler_2_mode? } settings_flag(:suppress_install_using_messages) { bundler_2_mode? } settings_flag(:unlock_source_unlocks_spec) { !bundler_2_mode? } settings_flag(:update_requires_all_flag) { bundler_2_mode? } diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index 8d9a02c2b8..b4fbba7789 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -68,7 +68,7 @@ module Bundler end def __materialize__ - search_object = Bundler.settings[:specific_platform] || Bundler.settings[:force_ruby_platform] ? self : Dependency.new(name, version) + search_object = Bundler.feature_flag.specific_platform? || Bundler.settings[:force_ruby_platform] ? self : Dependency.new(name, version) @specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name source.gemspec.tap {|s| s.source = source } else diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index afea575bf6..07325636b5 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -37,6 +37,7 @@ module Bundler prefer_gems_rb silence_root_warning skip_default_git_sources + specific_platform suppress_install_using_messages unlock_source_unlocks_spec update_requires_all_flag diff --git a/spec/install/gemfile/platform_spec.rb b/spec/install/gemfile/platform_spec.rb index 156fa5e7d2..2317111e17 100644 --- a/spec/install/gemfile/platform_spec.rb +++ b/spec/install/gemfile/platform_spec.rb @@ -87,7 +87,7 @@ RSpec.describe "bundle install across platforms" do expect(the_bundle).to include_gems "nokogiri 1.4.2 JAVA", "weakling 0.0.3" end - it "works with gems that have extra platform-specific runtime dependencies" do + it "works with gems that have extra platform-specific runtime dependencies", :bundler => "< 2" do simulate_platform x64_mac update_repo2 do diff --git a/spec/other/platform_spec.rb b/spec/other/platform_spec.rb index 4e251cbb0b..7b0c71311f 100644 --- a/spec/other/platform_spec.rb +++ b/spec/other/platform_spec.rb @@ -2,6 +2,12 @@ RSpec.describe "bundle platform" do context "without flags" do + let(:bundle_platform_platforms_string) do + platforms = [rb] + platforms.unshift(specific_local_platform) if Bundler.feature_flag.bundler_2_mode? + platforms.map {|pl| "* #{pl}" }.join("\n") + end + it "returns all the output" do gemfile <<-G source "file://#{gem_repo1}" @@ -16,7 +22,7 @@ RSpec.describe "bundle platform" do Your platform is: #{RUBY_PLATFORM} Your app has gems that work on these platforms: -* ruby +#{bundle_platform_platforms_string} Your Gemfile specifies a Ruby version requirement: * ruby #{RUBY_VERSION} @@ -39,7 +45,7 @@ G Your platform is: #{RUBY_PLATFORM} Your app has gems that work on these platforms: -* ruby +#{bundle_platform_platforms_string} Your Gemfile specifies a Ruby version requirement: * ruby #{RUBY_VERSION}p#{RUBY_PATCHLEVEL} @@ -60,7 +66,7 @@ G Your platform is: #{RUBY_PLATFORM} Your app has gems that work on these platforms: -* ruby +#{bundle_platform_platforms_string} Your Gemfile does not specify a Ruby version requirement. G @@ -80,7 +86,7 @@ G Your platform is: #{RUBY_PLATFORM} Your app has gems that work on these platforms: -* ruby +#{bundle_platform_platforms_string} Your Gemfile specifies a Ruby version requirement: * ruby #{not_local_ruby_version} diff --git a/spec/support/platforms.rb b/spec/support/platforms.rb index a2a3afba00..8d4a21d2d2 100644 --- a/spec/support/platforms.rb +++ b/spec/support/platforms.rb @@ -43,6 +43,10 @@ module Spec generic_local_platform end + def specific_local_platform + Bundler.local_platform + end + def not_local all_platforms.find {|p| p != generic_local_platform } end |