Commit 31dee085 authored by Samuel Giddins's avatar Samuel Giddins

Preserve external sources on locked dependencies in the resolver

parent 1bee09aa
...@@ -66,6 +66,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -66,6 +66,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
* Speed up `pod install` times by up to 50% for very large project. * Speed up `pod install` times by up to 50% for very large project.
[Samuel Giddins](https://github.com/segiddins) [Samuel Giddins](https://github.com/segiddins)
* Avoid dependency resolution conflicts when a pod depends upon a local pod.
[Samuel Giddins](https://github.com/segiddins)
## 1.4.0 (2018-01-18) ## 1.4.0 (2018-01-18)
......
...@@ -250,7 +250,7 @@ GEM ...@@ -250,7 +250,7 @@ GEM
terminal-table (1.6.0) terminal-table (1.6.0)
thread_safe (0.3.6) thread_safe (0.3.6)
tins (1.8.1) tins (1.8.1)
tzinfo (1.2.4) tzinfo (1.2.5)
thread_safe (~> 0.1) thread_safe (~> 0.1)
unicode-display_width (0.3.1) unicode-display_width (0.3.1)
webmock (2.3.1) webmock (2.3.1)
......
...@@ -33,10 +33,9 @@ module Pod ...@@ -33,10 +33,9 @@ module Pod
dependency_graph = Molinillo::DependencyGraph.new dependency_graph = Molinillo::DependencyGraph.new
if lockfile if lockfile
explicit_dependencies = lockfile.to_hash['DEPENDENCIES'] || [] explicit_dependencies = lockfile.dependencies
explicit_dependencies.each do |string| explicit_dependencies.each do |dependency|
dependency = Dependency.new(string) dependency_graph.add_vertex(dependency.name, dependency, true)
dependency_graph.add_vertex(dependency.name, nil, true)
end end
pods = lockfile.to_hash['PODS'] || [] pods = lockfile.to_hash['PODS'] || []
...@@ -46,7 +45,7 @@ module Pod ...@@ -46,7 +45,7 @@ module Pod
pods_to_update = pods_to_update.flat_map do |u| pods_to_update = pods_to_update.flat_map do |u|
root_name = Specification.root_name(u).downcase root_name = Specification.root_name(u).downcase
dependency_graph.vertices.keys.select { |n| Specification.root_name(n).downcase == root_name } dependency_graph.vertices.each_key.select { |n| Specification.root_name(n).downcase == root_name }
end end
pods_to_update.each do |u| pods_to_update.each do |u|
...@@ -73,7 +72,9 @@ module Pod ...@@ -73,7 +72,9 @@ module Pod
if pods_to_unlock.include?(dependency.root_name) if pods_to_unlock.include?(dependency.root_name)
dependency = Dependency.new(dependency.name) dependency = Dependency.new(dependency.name)
end end
dependency_graph.add_child_vertex(dependency.name, parents.empty? ? dependency : nil, parents, nil) vertex = dependency_graph.add_child_vertex(dependency.name, nil, parents, nil)
dependency = vertex.payload.merge(dependency) if vertex.payload
vertex.payload = dependency
dependency dependency
end end
......
...@@ -163,7 +163,9 @@ module Pod ...@@ -163,7 +163,9 @@ module Pod
def search_for(dependency) def search_for(dependency)
@search ||= {} @search ||= {}
@search[dependency] ||= begin @search[dependency] ||= begin
specifications_for_dependency(dependency, [requirement_for_locked_pod_named(dependency.name)]) locked_requirement = requirement_for_locked_pod_named(dependency.name)
additional_requirements = Array(locked_requirement)
specifications_for_dependency(dependency, additional_requirements)
end end
@search[dependency].dup @search[dependency].dup
end end
...@@ -357,7 +359,7 @@ module Pod ...@@ -357,7 +359,7 @@ module Pod
# @return [Array<Specification>] List of specifications satisfying given requirements. # @return [Array<Specification>] List of specifications satisfying given requirements.
# #
def specifications_for_dependency(dependency, additional_requirements = []) def specifications_for_dependency(dependency, additional_requirements = [])
requirement = Requirement.new(dependency.requirement.as_list + additional_requirements) requirement = Requirement.new(dependency.requirement.as_list + additional_requirements.flat_map(&:as_list))
find_cached_set(dependency). find_cached_set(dependency).
all_specifications(installation_options.warn_for_multiple_pod_sources). all_specifications(installation_options.warn_for_multiple_pod_sources).
select { |s| requirement.satisfied_by? s.version }. select { |s| requirement.satisfied_by? s.version }.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment