Commit a2be2d30 authored by Samuel Giddins's avatar Samuel Giddins Committed by GitHub

Merge pull request #5578 from SlowDepend/master

For fix slow dependency issue(base on 1.0.0).
parents eef5ab33 ce1f2a73
...@@ -10,7 +10,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -10,7 +10,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
* Remove references to the pre-1.0 Migrator. * Remove references to the pre-1.0 Migrator.
[Danielle Tomlinson](https://github.com/dantoml) [Danielle Tomlinson](https://github.com/dantoml)
[#5635](https://github.com/CocoaPods/CocoaPods/pull/5635) [#5635](https://github.com/CocoaPods/CocoaPods/pull/5635)
* Improve performance of dependency resolution.
[yanzhiwei147](https://github.com/yanzhiwei147)
[#5510](https://github.com/CocoaPods/CocoaPods/pull/5510)
##### Bug Fixes ##### Bug Fixes
......
...@@ -73,9 +73,10 @@ module Pod ...@@ -73,9 +73,10 @@ module Pod
def specs_by_target def specs_by_target
@specs_by_target ||= {}.tap do |specs_by_target| @specs_by_target ||= {}.tap do |specs_by_target|
podfile.target_definition_list.each do |target| podfile.target_definition_list.each do |target|
dependencies = {}
specs = target.dependencies.map(&:name).flat_map do |name| specs = target.dependencies.map(&:name).flat_map do |name|
node = @activated.vertex_named(name) node = @activated.vertex_named(name)
valid_dependencies_for_target_from_node(target, node) << node valid_dependencies_for_target_from_node(target, dependencies, node) << node
end end
specs_by_target[target] = specs. specs_by_target[target] = specs.
...@@ -471,13 +472,19 @@ module Pod ...@@ -471,13 +472,19 @@ module Pod
# An array of target-appropriate nodes whose `payload`s are # An array of target-appropriate nodes whose `payload`s are
# dependencies for `target`. # dependencies for `target`.
# #
def valid_dependencies_for_target_from_node(target, node) def valid_dependencies_for_target_from_node(target, dependencies, node)
validate_platform(node.payload, target) dependencies[node.name] ||= begin
dependency_nodes = node.outgoing_edges.select do |edge| validate_platform(node.payload, target)
edge_is_valid_for_target?(edge, target) dependency_nodes = node.outgoing_edges.select do |edge|
end.map(&:destination) edge_is_valid_for_target?(edge, target)
end.map(&:destination)
dependency_nodes + dependency_nodes.flat_map { |n| valid_dependencies_for_target_from_node(target, n) } dependency_nodes + dependency_nodes.flat_map do |item|
node_result = valid_dependencies_for_target_from_node(target, dependencies, item)
node_result
end
end
end end
# Whether the given `edge` should be followed to find dependencies for the # Whether the given `edge` should be followed to find dependencies for the
......
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