summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/lazy_specification.rb31
1 files changed, 18 insertions, 13 deletions
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb
index 808a4cc722..061e4bb91e 100644
--- a/lib/bundler/lazy_specification.rb
+++ b/lib/bundler/lazy_specification.rb
@@ -216,23 +216,28 @@ module Bundler
end
if search
- if search.platform == platform
- # We don't validate dependencies of locally installed gems but accept
- # what's in the lockfile instead for performance, since loading
- # dependencies of locally installed gems would mean evaluating all
- # gemspecs, which would affect `bundler/setup` performance
- if search.is_a?(StubSpecification)
- search.dependencies = dependencies
- else
- if !source.is_a?(Source::Path) && search.runtime_dependencies.sort != dependencies.sort
- raise IncorrectLockfileDependencies.new(self)
- end
- end
- end
+ validate_dependencies(search) if search.platform == platform
search.locked_platform = platform if search.instance_of?(RemoteSpecification) || search.instance_of?(EndpointSpecification)
end
search
end
+
+ # Validate dependencies of this locked spec are consistent with dependencies
+ # of the actual spec that was materialized.
+ #
+ # Note that we don't validate dependencies of locally installed gems but
+ # accept what's in the lockfile instead for performance, since loading
+ # dependencies of locally installed gems would mean evaluating all gemspecs,
+ # which would affect `bundler/setup` performance.
+ def validate_dependencies(spec)
+ if spec.is_a?(StubSpecification)
+ spec.dependencies = dependencies
+ else
+ if !source.is_a?(Source::Path) && spec.runtime_dependencies.sort != dependencies.sort
+ raise IncorrectLockfileDependencies.new(self)
+ end
+ end
+ end
end
end