Class: Pod::Installer::SandboxHeaderPathsInstaller

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/installer/sandbox_header_paths_installer.rb

Overview

Adds all the search paths into the sandbox HeaderStore and each pod target's HeaderStore.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sandbox, pod_targets) ⇒ SandboxHeaderPathsInstaller

Initialize a new instance

Parameters:

  • sandbox (Sandbox)

    @see #sandbox

  • pod_targets (Array<PodTarget>)

    @see #pod_targets



19
20
21
22
# File 'lib/cocoapods/installer/sandbox_header_paths_installer.rb', line 19

def initialize(sandbox, pod_targets)
  @pod_targets = pod_targets
  @sandbox = sandbox
end

Instance Attribute Details

#pod_targetsArray<PodTarget> (readonly)

Returns The list of pod targets to analyze.

Returns:

  • (Array<PodTarget>)

    The list of pod targets to analyze.



12
13
14
# File 'lib/cocoapods/installer/sandbox_header_paths_installer.rb', line 12

def pod_targets
  @pod_targets
end

#sandboxSandbox (readonly)

Returns The sandbox to use for this analysis.

Returns:

  • (Sandbox)

    The sandbox to use for this analysis.



8
9
10
# File 'lib/cocoapods/installer/sandbox_header_paths_installer.rb', line 8

def sandbox
  @sandbox
end

Instance Method Details

#install!Object



24
25
26
27
28
29
30
# File 'lib/cocoapods/installer/sandbox_header_paths_installer.rb', line 24

def install!
  # Link all pod target header search paths into the HeaderStore.
  pod_targets.each do |pod_target|
    next if pod_target.build_as_framework? && pod_target.should_build?
    install_target(pod_target)
  end
end

#install_target(pod_target) ⇒ Object (private)



34
35
36
37
38
39
40
41
42
# File 'lib/cocoapods/installer/sandbox_header_paths_installer.rb', line 34

def install_target(pod_target)
  pod_target_header_mappings = pod_target.header_mappings_by_file_accessor.values
  public_header_mappings = pod_target.public_header_mappings_by_file_accessor.values
  added_build_headers = !pod_target_header_mappings.all?(&:empty?)
  added_public_headers = !public_header_mappings.all?(&:empty?)

  pod_target.build_headers.add_search_path(pod_target.headers_sandbox, pod_target.platform) if added_build_headers
  sandbox.public_headers.add_search_path(pod_target.headers_sandbox, pod_target.platform) if added_public_headers
end