Class: Pod::AggregateTarget
- Defined in:
- lib/cocoapods/target/aggregate_target.rb
Overview
Stores the information relative to the target used to cluster the targets of the single Pods. The client targets will then depend on this one.
Instance Attribute Summary collapse
-
#client_root ⇒ Pathname
The folder where the client is stored used for computing the relative paths.
-
#pod_targets ⇒ Array<PodTarget>
The dependencies for this target.
-
#user_project_path ⇒ Pathname
The path of the user project that this target will integrate as identified by the analyzer.
-
#user_target_uuids ⇒ Array<String>
The list of the UUIDs of the user targets that will be integrated by this target as identified by the analyzer.
-
#xcconfigs ⇒ Hash<String, Xcodeproj::Config>
readonly
Map from configuration name to configuration file for the target.
Attributes inherited from Target
#archs, #sandbox, #target, #target_definition, #user_build_configurations
Instance Method Summary collapse
-
#acknowledgements_basepath ⇒ Pathname
The absolute path of acknowledgements file.
-
#copy_resources_script_path ⇒ Pathname
The absolute path of the copy resources script.
-
#copy_resources_script_relative_path ⇒ String
The path of the copy resources script relative to the root of the user project.
-
#initialize(target_definition, sandbox) ⇒ AggregateTarget
constructor
A new instance of AggregateTarget.
-
#label ⇒ String
The label for the target.
-
#relative_pods_root ⇒ String
The xcconfig path of the root from the ‘$(SRCROOT)` variable of the user’s project.
-
#spec_consumers ⇒ Array<Specification::Consumer>
The consumers of the Pod.
-
#specs ⇒ Array<Specification>
The specifications used by this aggregate target.
-
#specs_by_build_configuration ⇒ Hash{Symbol => Array<PodTarget>}
The pod targets for each build configuration.
-
#user_targets(project = nil) ⇒ Array<PBXNativeTarget>
The list of all the user targets that will be integrated by this target.
-
#xcconfig_relative_path(config_name) ⇒ String
The path of the xcconfig file relative to the root of the user project.
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(target_definition, sandbox) ⇒ AggregateTarget
Returns a new instance of AggregateTarget.
9 10 11 12 13 14 15 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 9 def initialize(target_definition, sandbox) @target_definition = target_definition @sandbox = sandbox @pod_targets = [] @file_accessors = [] @xcconfigs = {} end |
Instance Attribute Details
#client_root ⇒ Pathname
Returns the folder where the client is stored used for computing the relative paths. If integrating it should be the folder where the user project is stored, otherwise it should be the installation root.
28 29 30 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 28 def client_root @client_root end |
#pod_targets ⇒ Array<PodTarget>
Returns The dependencies for this target.
72 73 74 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 72 def pod_targets @pod_targets end |
#user_project_path ⇒ Pathname
The project instance is not stored to prevent editing different instances.
Returns the path of the user project that this target will integrate as identified by the analyzer.
36 37 38 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 36 def user_project_path @user_project_path end |
#user_target_uuids ⇒ Array<String>
The target instances are not stored to prevent editing different instances.
Returns the list of the UUIDs of the user targets that will be integrated by this target as identified by the analyzer.
44 45 46 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 44 def user_target_uuids @user_target_uuids end |
#xcconfigs ⇒ Hash<String, Xcodeproj::Config> (readonly)
The configurations are generated by the TargetInstaller and used by UserProjectIntegrator to check for any overridden values.
Returns Map from configuration name to configuration file for the target.
68 69 70 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 68 def xcconfigs @xcconfigs end |
Instance Method Details
#acknowledgements_basepath ⇒ Pathname
The acknowledgements generators add the extension according to the file type.
Returns The absolute path of acknowledgements file.
104 105 106 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 104 def acknowledgements_basepath support_files_dir + "#{label}-acknowledgements" end |
#copy_resources_script_path ⇒ Pathname
Returns The absolute path of the copy resources script.
110 111 112 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 110 def copy_resources_script_path support_files_dir + "#{label}-resources.sh" end |
#copy_resources_script_relative_path ⇒ String
Returns The path of the copy resources script relative to the root of the user project.
132 133 134 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 132 def copy_resources_script_relative_path "${SRCROOT}/#{relative_to_srcroot(copy_resources_script_path)}" end |
#label ⇒ String
Returns the label for the target.
19 20 21 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 19 def label target_definition.label.to_s end |
#relative_pods_root ⇒ String
Returns The xcconfig path of the root from the ‘$(SRCROOT)` variable of the user’s project.
117 118 119 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 117 def relative_pods_root "${SRCROOT}/#{sandbox.root.relative_path_from(client_root)}" end |
#spec_consumers ⇒ Array<Specification::Consumer>
Returns The consumers of the Pod.
95 96 97 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 95 def spec_consumers specs.map { |spec| spec.consumer(platform) } end |
#specs ⇒ Array<Specification>
Returns The specifications used by this aggregate target.
76 77 78 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 76 def specs pod_targets.map(&:specs).flatten end |
#specs_by_build_configuration ⇒ Hash{Symbol => Array<PodTarget>}
Returns The pod targets for each build configuration.
83 84 85 86 87 88 89 90 91 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 83 def specs_by_build_configuration result = {} user_build_configurations.keys.each do |build_configuration| result[build_configuration] = pod_targets.select do |pod_target| pod_target.include_in_build_config?(build_configuration) end.map(&:specs).flatten end result end |
#user_targets(project = nil) ⇒ Array<PBXNativeTarget>
Returns The list of all the user targets that will be integrated by this target.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 49 def user_targets(project = nil) project ||= Xcodeproj::Project.open(user_project_path) user_target_uuids.map do |uuid| native_target = project.objects_by_uuid[uuid] unless native_target raise Informative, '[Bug] Unable to find the target with ' \ "the `#{uuid}` UUID for the `#{self}` integration library" end native_target end end |
#xcconfig_relative_path(config_name) ⇒ String
Returns The path of the xcconfig file relative to the root of the user project.
125 126 127 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 125 def xcconfig_relative_path(config_name) relative_to_srcroot(xcconfig_path(config_name)).to_s end |