Commit 7d445ded authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Resolver] Compare against locked dependency upfront

This adds a forward checking step that proves to be a major optimization when there are unresolvable conflicts involving the Lockfile

Thanks to @pietbrauer
parent a76509f6
...@@ -6,6 +6,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -6,6 +6,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
## Master ## Master
##### Enhancements
* Allow the resolver to fail faster when there are unresolvable conflicts
involving the Lockfile.
[Samuel Giddins](https://github.com/segiddins)
##### Bug Fixes ##### Bug Fixes
* Allows pre-release spec versions when a requirement has an external source * Allows pre-release spec versions when a requirement has an external source
......
...@@ -104,9 +104,10 @@ module Pod ...@@ -104,9 +104,10 @@ module Pod
def search_for(dependency) def search_for(dependency)
@search ||= {} @search ||= {}
@search[dependency] ||= begin @search[dependency] ||= begin
requirement = Requirement.new(dependency.requirement.as_list << requirement_for_locked_pod_named(dependency.name))
specs = find_cached_set(dependency). specs = find_cached_set(dependency).
all_specifications. all_specifications.
select { |s| dependency.requirement.satisfied_by? s.version }. select { |s| requirement.satisfied_by? s.version }.
map { |s| s.subspec_by_name(dependency.name, false) }. map { |s| s.subspec_by_name(dependency.name, false) }.
compact compact
...@@ -313,6 +314,16 @@ module Pod ...@@ -313,6 +314,16 @@ module Pod
cached_sets[name] cached_sets[name]
end end
# @return [Requirement, Nil]
# The {Requirement} that locks the dependency with name `name` in
# {#locked_dependencies}.
#
def requirement_for_locked_pod_named(name)
if vertex = locked_dependencies.vertex_named(name)
vertex.payload.requirement
end
end
# @return [Set] Creates a set for the Pod of the given dependency from the # @return [Set] Creates a set for the Pod of the given dependency from the
# sources. The set will contain all versions from all sources that # sources. The set will contain all versions from all sources that
# include the Pod. # include the Pod.
......
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