Method: Pod::Podfile::TargetDefinition#podspec_dependencies

Defined in:
lib/cocoapods-core/podfile/target_definition.rb

#podspec_dependenciesArray<Dependency> (private)

Note:

The podspec directive is intended to include the dependencies of a spec in the project where it is developed. For this reason the spec, or any of it subspecs, cannot be included in the dependencies. Otherwise it would generate a chicken-and-egg problem.

Returns The dependencies inherited by the podspecs.

Returns:

  • (Array<Dependency>)

    The dependencies inherited by the podspecs.



994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 994

def podspec_dependencies
  podspecs = get_hash_value('podspecs') || []
  podspecs.map do |options|
    file = podspec_path_from_options(options)
    spec = Specification.from_file(file)
    subspec_names = options[:subspecs] || options[:subspec]
    specs = if subspec_names.blank?
              [spec]
            else
              subspec_names = [subspec_names] if subspec_names.is_a?(String)
              subspec_names.map { |subspec_name| spec.subspec_by_name("#{spec.name}/#{subspec_name}") }
            end
    specs.map do |subspec|
      all_specs = [subspec, *subspec.recursive_subspecs]
      all_deps = all_specs.map { |s| s.dependencies(platform) }.flatten
      all_deps.reject { |dep| dep.root_name == subspec.root.name }
    end.flatten
  end.flatten.uniq
end