lib/cocoapods/resolver.rb
# Resolves recursively the dependencies of a specification and stores them
# in the @cached_specs ivar.
#
# @param  [Podfile, Specification, #to_s] dependent_spec
#         the specification whose dependencies are being resolved. Used
#         only for UI purposes.
#
# @param  [Array<Dependency>] dependencies
#         the dependencies of the specification.
#
# @param  [TargetDefinition] target_definition
#         the target definition that owns the specification.
#
# @note   If there is a locked dependency with the same name of a
#         given dependency the locked one is used in place of the
#         dependency of the specification. In this way it is possible to
#         prevent the update of the version of installed pods not changed
#         in the Podfile.
#
# @note   The recursive process checks if a dependency has already been
#         loaded to prevent an infinite loop.
#
# @note   The set class merges all (of all the target definitions) the
#         dependencies and thus it keeps track of whether it is in head
#         mode or from an external source because {Dependency#merge}
#         preserves this information.
#
# @return [void]
#
Resolves recursively the dependencies of a specification and stores them
in the @cached_specs ivar.
Resolves recursively the dependencies of a specification and stores them in the @cached_specs ivar .
def find_dependency_specs(dependent_spec, dependencies, target_definition)
      dependencies.each do |dependency|
        locked_dep = locked_dependencies.find { |ld| ld.name == dependency.name }
        dependency = locked_dep if locked_dep
        UI.message("- #{dependency}", '', 2) do
          set = find_cached_set(dependency)
          set.required_by(dependency, dependent_spec.to_s)
          unless @loaded_specs.include?(dependency.name)
            spec = set.specification.subspec_by_name(dependency.name)
            @loaded_specs << spec.name
            cached_specs[spec.name] = spec
            validate_platform(spec, target_definition)
            spec.version.head = dependency.head?
            spec_dependencies = spec.all_dependencies(target_definition.platform)
            find_dependency_specs(spec, spec_dependencies, target_definition)
          end
        end
      end
    end
def find_dependency_specs ( dependent_spec , dependencies , target_definition ) dependencies . each do | dependency | locked_dep = locked_dependencies . find { | ld | ld . name == dependency . name } dependency = locked_dep if locked_dep UI . message ( "- #{dependency}" , '' , 2 ) do set = find_cached_set ( dependency ) set . required_by ( dependency , dependent_spec . to_s ) unless @loaded_specs . include? ( dependency . name ) spec = set . specification . subspec_by_name ( dependency . name ) @loaded_specs << spec . name cached_specs [ spec . name ] = spec validate_platform ( spec , target_definition ) spec . version . head = dependency . head? spec_dependencies = spec . all_dependencies ( target_definition . platform ) find_dependency_specs ( spec , spec_dependencies , target_definition ) end end end end
Resolves recursively the dependencies of a specification and stores them
in the @cached_specs ivar.
Resolves recursively the dependencies of a specification and stores them in the @cached_specs ivar .
None
void
dependent_spec
dependencies
target_definition
target_definition the target definition that owns the specification.
target_definition the target definition that owns the specification .
note
If there is a locked dependency with the same name of a given dependency the locked one is used in place of the dependency of the specification. In this way it is possible to prevent the update of the version of installed pods not changed in the Podfile.
If there is a locked dependency with the same name of a given dependency the locked one is used in place of the dependency of the specification . In this way it is possible to prevent the update of the version of installed pods not changed in the Podfile .
note
The recursive process checks if a dependency has already been loaded to prevent an infinite loop.
The recursive process checks if a dependency has already been loaded to prevent an infinite loop .
note
The set class merges all (of all the target definitions) the dependencies and thus it keeps track of whether it is in head mode or from an external source because {Dependency#merge} preserves this information.
The set class merges all ( of all the target definitions ) the dependencies and thus it keeps track of whether it is in head mode or from an external source because { Dependency#merge } preserves this information .