Commit a3419f39 authored by arida's avatar arida Committed by Ben Asher

For fix slow dependency issue(base on 1.0.0).

parent f359bfda
...@@ -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|
cached_dependencys = {}
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, cached_dependencys, node) << node
end end
specs_by_target[target] = specs. specs_by_target[target] = specs.
...@@ -471,13 +472,27 @@ module Pod ...@@ -471,13 +472,27 @@ 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, cached_dependencys, node)
cache_dependency = cached_dependencys[node.name]
if cache_dependency
return cache_dependency
end
validate_platform(node.payload, target) validate_platform(node.payload, target)
dependency_nodes = node.outgoing_edges.select do |edge| dependency_nodes = node.outgoing_edges.select do |edge|
edge_is_valid_for_target?(edge, target) edge_is_valid_for_target?(edge, target)
end.map(&:destination) end.map(&:destination)
dependency_nodes + dependency_nodes.flat_map { |n| valid_dependencies_for_target_from_node(target, n) } dependency_nodes + dependency_nodes.flat_map { |n|
node_result = valid_dependencies_for_target_from_node(target, cached_dependencys, n)
cached_dependencys[node.name] = node_result
node_result
}
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