Class: Pod::PodTarget
- Defined in:
- lib/cocoapods/target/pod_target.rb
Overview
Stores the information relative to the target used to compile a single Pod. A pod can have one or more activated spec/subspecs.
Instance Attribute Summary collapse
-
#build_headers ⇒ HeadersStore
readonly
The header directory for the target.
-
#file_accessors ⇒ Array<Sandbox::FileAccessor>
The file accessors for the specifications of this target.
-
#specs ⇒ Specification
readonly
The spec for the target.
Attributes inherited from Target
#archs, #sandbox, #target, #target_definition, #user_build_configurations
Instance Method Summary collapse
-
#dependencies ⇒ Array<String>
The names of the Pods on which this target depends.
-
#include_in_build_config?(configuration_name) ⇒ Boolean
Checks if the target should be included in the build configuration with the given name.
-
#initialize(specs, target_definition, sandbox) ⇒ PodTarget
constructor
A new instance of PodTarget.
-
#label ⇒ String
The label for the target.
-
#pod_name ⇒ String
The name of the Pod that this target refers to.
-
#root_spec ⇒ Specification
The root specification for the target.
-
#spec_consumers ⇒ Array<Specification::Consumer>
The specification consumers for the target.
Methods inherited from Target
#bridge_support_path, #dummy_source_path, #inspect, #name, #platform, #prefix_header_path, #product_name, #support_files_dir, #target_environment_header_path, #xcconfig_path, #xcconfig_prefix, #xcconfig_private_path
Constructor Details
#initialize(specs, target_definition, sandbox) ⇒ PodTarget
Returns a new instance of PodTarget.
18 19 20 21 22 23 24 |
# File 'lib/cocoapods/target/pod_target.rb', line 18 def initialize(specs, target_definition, sandbox) @specs = specs @target_definition = target_definition @sandbox = sandbox @build_headers = Sandbox::HeadersStore.new(sandbox, 'Build') @file_accessors = [] end |
Instance Attribute Details
#build_headers ⇒ HeadersStore (readonly)
Returns the header directory for the target.
12 13 14 |
# File 'lib/cocoapods/target/pod_target.rb', line 12 def build_headers @build_headers end |
#file_accessors ⇒ Array<Sandbox::FileAccessor>
Returns the file accessors for the specifications of this target.
35 36 37 |
# File 'lib/cocoapods/target/pod_target.rb', line 35 def file_accessors @file_accessors end |
#specs ⇒ Specification (readonly)
Returns the spec for the target.
8 9 10 |
# File 'lib/cocoapods/target/pod_target.rb', line 8 def specs @specs end |
Instance Method Details
#dependencies ⇒ Array<String>
Returns The names of the Pods on which this target depends.
59 60 61 62 63 |
# File 'lib/cocoapods/target/pod_target.rb', line 59 def dependencies specs.map do |spec| spec.consumer(platform).dependencies.map { |dep| Specification.root_name(dep.name) } end.flatten end |
#include_in_build_config?(configuration_name) ⇒ Boolean
Checks if the target should be included in the build configuration with the given name.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/cocoapods/target/pod_target.rb', line 71 def include_in_build_config?(configuration_name) whitelists = target_definition_dependencies.map do |dependency| target_definition.pod_whitelisted_for_configuration?(dependency.name, configuration_name) end.uniq if whitelists.empty? return true elsif whitelists.count == 1 whitelists.first else raise Informative, "The subspecs of `#{pod_name}` are linked to " \ "different build configurations for the `#{target_definition}` " \ 'target. CocoaPods does not currently support subspecs across ' \ 'different build configurations.' end end |
#label ⇒ String
Returns the label for the target.
28 29 30 |
# File 'lib/cocoapods/target/pod_target.rb', line 28 def label "#{target_definition.label}-#{root_spec.name}" end |
#pod_name ⇒ String
Returns The name of the Pod that this target refers to.
52 53 54 |
# File 'lib/cocoapods/target/pod_target.rb', line 52 def pod_name root_spec.name end |
#root_spec ⇒ Specification
Returns The root specification for the target.
46 47 48 |
# File 'lib/cocoapods/target/pod_target.rb', line 46 def root_spec specs.first.root end |
#spec_consumers ⇒ Array<Specification::Consumer>
Returns the specification consumers for the target.
40 41 42 |
# File 'lib/cocoapods/target/pod_target.rb', line 40 def spec_consumers specs.map { |spec| spec.consumer(platform) } end |