aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-01-24 01:17:47 +0000
committerThe Bundler Bot <bot@bundler.io>2017-01-24 01:17:47 +0000
commitdf20d19972f251ec4dec5cb7cba7e178f98df9e9 (patch)
treedb68ec83849580a3d2a44704dba916fafda9408c
parent2aef2700d44d3af0f68c63e58dd57fc126fec054 (diff)
parent38ff42708f5a8d176f66a70d705e513da4a7c5b5 (diff)
downloadbundler-df20d19972f251ec4dec5cb7cba7e178f98df9e9.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
-rw-r--r--lib/bundler/definition.rb3
-rw-r--r--spec/install/gemfile/gemspec_spec.rb17
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 15383a22..1e13794a 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 1972bfe2..4b8e4d6f 100644
--- a/spec/install/gemfile/gemspec_spec.rb
+++ b/spec/install/gemfile/gemspec_spec.rb
@@ -145,6 +145,23 @@ RSpec.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|