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.
-
#target_definition ⇒ TargetDefinition
readonly
The target definition of the Podfile that generated 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, #host_requires_frameworks, #native_target, #sandbox, #user_build_configurations
Support files 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.
-
#embed_frameworks_script_path ⇒ Pathname
The absolute path of the embed frameworks script.
-
#embed_frameworks_script_relative_path ⇒ String
The path of the embed frameworks relative to the root of the user project.
-
#relative_pods_root ⇒ String
The xcconfig path of the root from the ‘$(SRCROOT)` variable of the user’s project.
-
#scoped_configuration_build_dir ⇒ String
The scoped configuration build dir, relevant if the target is integrated as framework.
-
#xcconfig_relative_path(config_name) ⇒ String
The path of the xcconfig file relative to the root of the user project.
Instance Method Summary collapse
-
#initialize(target_definition, sandbox) ⇒ AggregateTarget
constructor
Initialize a new instance.
-
#label ⇒ String
The label for the target.
-
#platform ⇒ Platform
The platform for this target.
-
#pod_targets_for_build_configuration(build_configuration) ⇒ Array<PodTarget>
The pod targets for the given build configuration.
-
#podfile ⇒ Podfile
The podfile which declares the dependency.
-
#product_module_name ⇒ String
The name to use for the source code module constructed for this target, and which will be used to import the module in implementation source files.
-
#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<Specification>}
The pod targets for each build configuration.
-
#user_targets(project = nil) ⇒ Array<PBXNativeTarget>
List all user targets that will be integrated by this #target.
-
#uses_swift? ⇒ Boolean
Whether the target uses Swift code.
Methods inherited from Target
#bridge_support_path, #dummy_source_path, #framework_name, #info_plist_path, #inspect, #module_map_path, #name, #prefix_header_path, #product_basename, #product_name, #product_type, #requires_frameworks?, #static_library_name, #support_files_dir, #umbrella_header_path, #xcconfig_path, #xcconfig_prefix, #xcconfig_private_path
Constructor Details
#initialize(target_definition, sandbox) ⇒ AggregateTarget
Initialize a new instance
15 16 17 18 19 20 21 22 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 15 def initialize(target_definition, sandbox) super() @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.
55 56 57 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 55 def client_root @client_root end |
#pod_targets ⇒ Array<PodTarget>
Returns The dependencies for this target.
104 105 106 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 104 def pod_targets @pod_targets end |
#target_definition ⇒ TargetDefinition (readonly)
Returns the target definition of the Podfile that generated this target.
8 9 10 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 8 def target_definition @target_definition 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.
63 64 65 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 63 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.
71 72 73 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 71 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.
100 101 102 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 100 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.
157 158 159 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 157 def acknowledgements_basepath support_files_dir + "#{label}-acknowledgements" end |
#copy_resources_script_path ⇒ Pathname
Returns The absolute path of the copy resources script.
163 164 165 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 163 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.
191 192 193 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 191 def copy_resources_script_relative_path "${SRCROOT}/#{relative_to_srcroot(copy_resources_script_path)}" end |
#embed_frameworks_script_path ⇒ Pathname
Returns The absolute path of the embed frameworks script.
169 170 171 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 169 def support_files_dir + "#{label}-frameworks.sh" end |
#embed_frameworks_script_relative_path ⇒ String
Returns The path of the embed frameworks relative to the root of the user project.
198 199 200 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 198 def "${SRCROOT}/#{relative_to_srcroot()}" end |
#label ⇒ String
Returns the label for the target.
26 27 28 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 26 def label target_definition.label.to_s end |
#platform ⇒ Platform
Returns the platform for this target.
40 41 42 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 40 def platform @platform ||= target_definition.platform end |
#pod_targets_for_build_configuration(build_configuration) ⇒ Array<PodTarget>
Returns the pod targets for the given build configuration.
112 113 114 115 116 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 112 def pod_targets_for_build_configuration(build_configuration) pod_targets.select do |pod_target| pod_target.include_in_build_config?(target_definition, build_configuration) end end |
#podfile ⇒ Podfile
Returns The podfile which declares the dependency.
46 47 48 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 46 def podfile target_definition.podfile end |
#product_module_name ⇒ String
Returns the name to use for the source code module constructed for this target, and which will be used to import the module in implementation source files.
34 35 36 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 34 def product_module_name c99ext_identifier(label) end |
#relative_pods_root ⇒ String
Returns The xcconfig path of the root from the ‘$(SRCROOT)` variable of the user’s project.
176 177 178 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 176 def relative_pods_root "${SRCROOT}/#{sandbox.root.relative_path_from(client_root)}" end |
#scoped_configuration_build_dir ⇒ String
Returns The scoped configuration build dir, relevant if the target is integrated as framework.
205 206 207 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 205 def scoped_configuration_build_dir "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/#{target_definition.label}" end |
#spec_consumers ⇒ Array<Specification::Consumer>
Returns The consumers of the Pod.
138 139 140 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 138 def spec_consumers specs.map { |spec| spec.consumer(platform) } end |
#specs ⇒ Array<Specification>
Returns The specifications used by this aggregate target.
120 121 122 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 120 def specs pod_targets.map(&:specs).flatten end |
#specs_by_build_configuration ⇒ Hash{Symbol => Array<Specification>}
Returns The pod targets for each build configuration.
127 128 129 130 131 132 133 134 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 127 def specs_by_build_configuration result = {} user_build_configurations.keys.each do |build_configuration| result[build_configuration] = pod_targets_for_build_configuration(build_configuration). flat_map(&:specs) end result end |
#user_targets(project = nil) ⇒ Array<PBXNativeTarget>
List all user targets that will be integrated by this #target.
80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 80 def user_targets(project = nil) return [] unless user_project_path 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 |
#uses_swift? ⇒ Boolean
Returns Whether the target uses Swift code.
144 145 146 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 144 def uses_swift? pod_targets.any?(&:uses_swift?) end |
#xcconfig_relative_path(config_name) ⇒ String
Returns The path of the xcconfig file relative to the root of the user project.
184 185 186 |
# File 'lib/cocoapods/target/aggregate_target.rb', line 184 def xcconfig_relative_path(config_name) relative_to_srcroot(xcconfig_path(config_name)).to_s end |