diff options
author | The Bundler Bot <bot@bundler.io> | 2017-01-24 01:17:47 +0000 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-01-24 15:39:53 -0600 |
commit | 17ab6362af8c1f044f6c0360df8ed0a19d4cf76a (patch) | |
tree | a0b9dd0be4fcb12a71c21abec0fb64cc9d0a036c | |
parent | 27c8cd6a8e73b3b5d72e0fb0ef7475ba65c2b88c (diff) | |
download | bundler-17ab6362af8c1f044f6c0360df8ed0a19d4cf76a.tar.gz |
Auto merge of #5354 - bundler:seg-gemspec-dev-deps-no-resolve, r=indirect
[Definition] Avoid re-resolving when a gemspec has dev deps
Inspired by #5349.
Since dev deps are added with `type: :development`, they are `!=` to the deps retrieved from the lockfile, which have no type. This compares the deps ignoring type completely
(cherry picked from commit df20d19972f251ec4dec5cb7cba7e178f98df9e9)
-rw-r--r-- | lib/bundler/definition.rb | 3 | ||||
-rw-r--r-- | spec/install/gemfile/gemspec_spec.rb | 17 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 15383a22c5..1e13794ae7 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -691,7 +691,8 @@ module Bundler dep.platforms.concat(@platforms.map {|p| Dependency::REVERSE_PLATFORM_MAP[p] }.flatten(1)).uniq! end end - Set.new(@dependencies) != Set.new(@locked_deps) + dependency_without_type = proc {|d| Gem::Dependency.new(d.name, *d.requirement.as_list) } + Set.new(@dependencies.map(&dependency_without_type)) != Set.new(@locked_deps.map(&dependency_without_type)) end # Remove elements from the locked specs that are expired. This will most diff --git a/spec/install/gemfile/gemspec_spec.rb b/spec/install/gemfile/gemspec_spec.rb index c18209cc6f..d935f27f52 100644 --- a/spec/install/gemfile/gemspec_spec.rb +++ b/spec/install/gemfile/gemspec_spec.rb @@ -145,6 +145,23 @@ describe "bundle install from an existing gemspec" do expect(out).to include("Found no changes, using resolution from the lockfile") end + it "should match a lockfile without needing to re-resolve with development dependencies" do + simulate_platform java + + build_lib("foo", :path => tmp.join("foo")) do |s| + s.add_dependency "rack" + s.add_development_dependency "thin" + end + + install_gemfile! <<-G + source "file://#{gem_repo1}" + gemspec :path => '#{tmp.join("foo")}' + G + + bundle! "install", :verbose => true + expect(out).to include("Found no changes, using resolution from the lockfile") + end + it "should evaluate the gemspec in its directory" do build_lib("foo", :path => tmp.join("foo")) File.open(tmp.join("foo/foo.gemspec"), "w") do |s| |