Commit 7563e8b8 authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Resolver] Use tuned search method to ensure that finding sets is fast

parent 794ccf4b
...@@ -76,6 +76,7 @@ module Pod ...@@ -76,6 +76,7 @@ module Pod
specs_by_target specs_by_target
end end
# @return [Hash{Podfile::TargetDefinition => Array<Specification>}] # @return [Hash{Podfile::TargetDefinition => Array<Specification>}]
# returns the resolved specifications grouped by target. # returns the resolved specifications grouped by target.
# #
...@@ -149,11 +150,9 @@ module Pod ...@@ -149,11 +150,9 @@ module Pod
set = find_cached_set(dependency, dependent_spec) set = find_cached_set(dependency, dependent_spec)
set.required_by(dependency, dependent_spec.to_s) set.required_by(dependency, dependent_spec.to_s)
unless set.sources.empty? if (paths = set.specification_paths_for_version(set.required_version)).length > 1
unless set.specification_paths_for_version(set.required_version).length == 1 UI.warn "Found multiple specifications for #{dependency}:\n" \
UI.message("Found multiple specifications for #{dependency}: " \ "- #{paths.join("\n")}"
"#{set.specification_paths_for_version(set.required_version).join(', ')}")
end
end end
unless @loaded_specs.include?(dependency.name) unless @loaded_specs.include?(dependency.name)
...@@ -215,11 +214,13 @@ module Pod ...@@ -215,11 +214,13 @@ module Pod
# The dependency for which the set is needed. # The dependency for which the set is needed.
# #
def create_set_from_sources(dependency) def create_set_from_sources(dependency)
matching_sources = sources.select { |source| source.pods.include? dependency.root_name } aggregate.search(dependency)
end
unless matching_sources.empty? # @return [Source::Aggregate] The aggregate of the {#sources}.
return Specification::Set.new(dependency.root_name, matching_sources) #
end def aggregate
@aggregate ||= Source::Aggregate.new(sources.map(&:repo))
end end
# Ensures that a specification is compatible with the platform of a target. # Ensures that a specification is compatible with the platform of a target.
......
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