Class: Pod::AggregateTarget

Inherits:
Target
  • Object
show all
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

Attributes inherited from Target

#archs, #sandbox, #target, #target_definition, #user_build_configurations

Instance Method Summary collapse

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.

Parameters:

  • @see target_definition

  • @see sandbox



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_rootPathname

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.

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_targetsArray<PodTarget>

Returns The dependencies for this target.

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_pathPathname

Note:

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.

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_uuidsArray<String>

Note:

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.

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

#xcconfigsHash<String, Xcodeproj::Config> (readonly)

Note:

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.

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_basepathPathname

Note:

The acknowledgements generators add the extension according to the file type.

Returns The absolute path of acknowledgements file.

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_pathPathname

Returns The absolute path of the copy resources script.

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_pathString

Returns The path of the copy resources script relative to the root of the user project.

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

#labelString

Returns the label for the target.

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_rootString

Returns The xcconfig path of the root from the ‘$(SRCROOT)` variable of the user’s project.

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_consumersArray<Specification::Consumer>

Returns The consumers of the Pod.

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

#specsArray<Specification>

Returns The specifications used by this aggregate target.

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_configurationHash{Symbol => Array<PodTarget>}

Returns The pod targets for each build configuration.

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.

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.

Parameters:

  • The build configuration name to get the xcconfig for

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