class Pod::Installer::Xcode::AggregateTargetDependencyInstaller

Wires up the dependencies for aggregate targets from the target installation results

Attributes

aggregate_target_installation_results[R]

@return [Hash{String => TargetInstallationResult}] The target installation results for aggregate targets.

metadata_cache[R]

@return [ProjectMetadataCache] The project metadata cache.

pod_target_installation_results[R]

@return [Hash{String => TargetInstallationResult}] The target installation results for pod targets.

sandbox[R]

@return [Sandbox] The sandbox used for this installation.

Public Class Methods

new(sandbox, aggregate_target_installation_results, pod_target_installation_results, metadata_cache) click to toggle source

Initialize a new instance.

@param [Sandbox] sandbox @see sandbox @param [Hash{String => TargetInstallationResult}] aggregate_target_installation_results @see aggregate_target_installation_results @param [Hash{String => TargetInstallationResult}] pod_target_installation_results @see pod_target_installation_results @param [ProjectMetadataCache] metadata_cache @see metadata_cache

# File lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_dependency_installer.rb, line 32
def initialize(sandbox, aggregate_target_installation_results, pod_target_installation_results, metadata_cache)
  @sandbox = sandbox
  @aggregate_target_installation_results = aggregate_target_installation_results
  @pod_target_installation_results = pod_target_installation_results
  @metadata_cache = metadata_cache
end

Public Instance Methods

install!() click to toggle source
# File lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_dependency_installer.rb, line 39
def install!
  aggregate_target_installation_results.values.each do |aggregate_target_installation_result|
    aggregate_target = aggregate_target_installation_result.target
    aggregate_native_target = aggregate_target_installation_result.native_target
    project = aggregate_native_target.project
    # Wire up dependencies that are part of inherit search paths for this aggregate target.
    aggregate_target.search_paths_aggregate_targets.each do |search_paths_target|
      aggregate_native_target.add_dependency(aggregate_target_installation_results[search_paths_target.name].native_target)
    end
    # Wire up all pod target dependencies to aggregate target.
    aggregate_target.pod_targets.each do |pod_target|
      if pod_target_installation_result = pod_target_installation_results[pod_target.name]
        pod_target_native_target = pod_target_installation_result.native_target
        aggregate_native_target.add_dependency(pod_target_native_target)
      else
        # Hit the cache
        is_local = sandbox.local?(pod_target.pod_name)
        cached_dependency = metadata_cache.target_label_by_metadata[pod_target.label]
        project.add_cached_pod_subproject(sandbox, cached_dependency, is_local)
        Project.add_cached_dependency(sandbox, aggregate_native_target, cached_dependency)
      end
    end
  end
end