Class: Pod::Target
- Inherits:
-
Object
- Object
- Pod::Target
- Defined in:
- lib/cocoapods/target.rb,
lib/cocoapods/target/build_settings.rb
Overview
Model class which describes a Pods target.
The Target class stores and provides the information necessary for working with a target in the Podfile and its dependent libraries. This class is used to represent both the targets and their libraries.
Direct Known Subclasses
Defined Under Namespace
Classes: BuildSettings
Constant Summary collapse
- DEFAULT_VERSION =
'1.0.0'.freeze
- DEFAULT_NAME =
'Default'.freeze
- DEFAULT_BUILD_CONFIGURATIONS =
{ 'Release' => :release, 'Debug' => :debug }.freeze
Instance Attribute Summary collapse
-
#archs ⇒ Array<String>
readonly
The value for the ARCHS build setting.
-
#build_settings ⇒ BuildSettings
readonly
The build settings for this target.
-
#host_requires_frameworks ⇒ Boolean
(also: #host_requires_frameworks?)
readonly
Whether the target needs to be implemented as a framework.
-
#platform ⇒ Platform
readonly
The platform of this target.
-
#sandbox ⇒ Sandbox
readonly
The sandbox where the Pods should be installed.
-
#user_build_configurations ⇒ Hash{String=>Symbol}
readonly
A hash representing the user build configurations where each key corresponds to the name of a configuration and its value to its type (‘:debug` or `:release`).
Framework support collapse
-
#requires_frameworks? ⇒ Boolean
Whether the generated target needs to be implemented as a framework.
Support files collapse
-
#bridge_support_path ⇒ Pathname
The absolute path of the bridge support file.
-
#dummy_source_path ⇒ Pathname
The path of the dummy source generated by CocoaPods.
-
#info_plist_path ⇒ Pathname
The absolute path of the Info.plist file.
-
#module_map_path ⇒ Pathname
The absolute path of the LLVM module map file that defines the module structure for the compiler.
-
#module_map_path_to_write ⇒ Pathname
The absolute path of the module map file that CocoaPods writes.
-
#support_files_dir ⇒ Pathname
The folder where to store the support files of this library.
-
#umbrella_header_path ⇒ Pathname
The absolute path of the header file which contains the exported foundation constants with framework version information and all headers, which should been exported in the module map.
- #umbrella_header_path_to_write ⇒ Object
-
#xcconfig_path(variant = nil) ⇒ Pathname
The absolute path of the xcconfig file.
Instance Method Summary collapse
-
#framework_name ⇒ String
The name of the framework, depends on #label.
-
#initialize(sandbox, host_requires_frameworks, user_build_configurations, archs, platform) ⇒ Target
constructor
Initialize a new target.
-
#inspect ⇒ String
A string suitable for debugging.
-
#label ⇒ String
The label for the target.
-
#name ⇒ String
(also: #to_s)
The name of the library.
-
#product_basename ⇒ String
The name of the product excluding the file extension or a product type specific prefix, depends on #requires_frameworks? and #product_module_name or #label.
-
#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.
-
#product_name ⇒ String
The name of the product.
-
#product_type ⇒ Symbol
Either :framework or :static_library, depends on #requires_frameworks?.
-
#static_framework? ⇒ Boolean
Whether the target should build a static framework.
-
#static_library_name ⇒ String
The name of the library, depends on #label.
-
#uses_swift? ⇒ Boolean
Whether the target uses Swift code.
-
#version ⇒ String
The version associated with this target.
Constructor Details
#initialize(sandbox, host_requires_frameworks, user_build_configurations, archs, platform) ⇒ Target
Initialize a new target
51 52 53 54 55 56 57 58 59 |
# File 'lib/cocoapods/target.rb', line 51 def initialize(sandbox, host_requires_frameworks, user_build_configurations, archs, platform) @sandbox = sandbox @host_requires_frameworks = host_requires_frameworks @user_build_configurations = user_build_configurations @archs = archs @platform = platform @build_settings = create_build_settings end |
Instance Attribute Details
#archs ⇒ Array<String> (readonly)
Returns The value for the ARCHS build setting.
33 34 35 |
# File 'lib/cocoapods/target.rb', line 33 def archs @archs end |
#build_settings ⇒ BuildSettings (readonly)
Returns the build settings for this target.
41 42 43 |
# File 'lib/cocoapods/target.rb', line 41 def build_settings @build_settings end |
#host_requires_frameworks ⇒ Boolean (readonly) Also known as: host_requires_frameworks?
Returns Whether the target needs to be implemented as a framework. Computed by analyzer.
22 23 24 |
# File 'lib/cocoapods/target.rb', line 22 def host_requires_frameworks @host_requires_frameworks end |
#platform ⇒ Platform (readonly)
Returns the platform of this target.
37 38 39 |
# File 'lib/cocoapods/target.rb', line 37 def platform @platform end |
#sandbox ⇒ Sandbox (readonly)
Returns The sandbox where the Pods should be installed.
17 18 19 |
# File 'lib/cocoapods/target.rb', line 17 def sandbox @sandbox end |
#user_build_configurations ⇒ Hash{String=>Symbol} (readonly)
Returns A hash representing the user build configurations where each key corresponds to the name of a configuration and its value to its type (‘:debug` or `:release`).
29 30 31 |
# File 'lib/cocoapods/target.rb', line 29 def user_build_configurations @user_build_configurations end |
Instance Method Details
#bridge_support_path ⇒ Pathname
Returns the absolute path of the bridge support file.
223 224 225 |
# File 'lib/cocoapods/target.rb', line 223 def bridge_support_path support_files_dir + "#{label}.bridgesupport" end |
#dummy_source_path ⇒ Pathname
Returns the path of the dummy source generated by CocoaPods.
235 236 237 |
# File 'lib/cocoapods/target.rb', line 235 def dummy_source_path support_files_dir + "#{label}-dummy.m" end |
#framework_name ⇒ String
This may not depend on #requires_frameworks? indirectly as it is used for migration.
Returns the name of the framework, depends on #label.
128 129 130 |
# File 'lib/cocoapods/target.rb', line 128 def framework_name "#{product_module_name}.framework" end |
#info_plist_path ⇒ Pathname
Returns the absolute path of the Info.plist file.
229 230 231 |
# File 'lib/cocoapods/target.rb', line 229 def info_plist_path support_files_dir + "#{label}-Info.plist" end |
#inspect ⇒ String
Returns A string suitable for debugging.
150 151 152 |
# File 'lib/cocoapods/target.rb', line 150 def inspect "<#{self.class} name=#{name} >" end |
#label ⇒ String
Returns the label for the target.
71 72 73 |
# File 'lib/cocoapods/target.rb', line 71 def label DEFAULT_NAME end |
#module_map_path ⇒ Pathname
Returns the absolute path of the LLVM module map file that defines the module structure for the compiler.
206 207 208 |
# File 'lib/cocoapods/target.rb', line 206 def module_map_path module_map_path_to_write end |
#module_map_path_to_write ⇒ Pathname
Returns the absolute path of the module map file that CocoaPods writes. This can be different from ‘module_map_path` if the module map gets symlinked.
216 217 218 219 |
# File 'lib/cocoapods/target.rb', line 216 def module_map_path_to_write basename = "#{label}.modulemap" support_files_dir + basename end |
#name ⇒ String Also known as: to_s
Returns the name of the library.
63 64 65 |
# File 'lib/cocoapods/target.rb', line 63 def name label end |
#product_basename ⇒ String
Returns the name of the product excluding the file extension or a product type specific prefix, depends on #requires_frameworks? and #product_module_name or #label.
115 116 117 118 119 120 121 |
# File 'lib/cocoapods/target.rb', line 115 def product_basename if requires_frameworks? product_module_name else label end 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.
97 98 99 |
# File 'lib/cocoapods/target.rb', line 97 def product_module_name c99ext_identifier(label) end |
#product_name ⇒ String
Returns the name of the product.
103 104 105 106 107 108 109 |
# File 'lib/cocoapods/target.rb', line 103 def product_name if requires_frameworks? framework_name else static_library_name end end |
#product_type ⇒ Symbol
Returns either :framework or :static_library, depends on #requires_frameworks?.
144 145 146 |
# File 'lib/cocoapods/target.rb', line 144 def product_type requires_frameworks? ? :framework : :static_library end |
#requires_frameworks? ⇒ Boolean
Returns whether the generated target needs to be implemented as a framework.
161 162 163 |
# File 'lib/cocoapods/target.rb', line 161 def requires_frameworks? host_requires_frameworks? || false end |
#static_framework? ⇒ Boolean
Returns Whether the target should build a static framework.
89 90 91 |
# File 'lib/cocoapods/target.rb', line 89 def static_framework? false end |
#static_library_name ⇒ String
This may not depend on #requires_frameworks? indirectly as it is used for migration.
Returns the name of the library, depends on #label.
137 138 139 |
# File 'lib/cocoapods/target.rb', line 137 def static_library_name "lib#{label}.a" end |
#support_files_dir ⇒ Pathname
Returns the folder where to store the support files of this library.
172 173 174 |
# File 'lib/cocoapods/target.rb', line 172 def support_files_dir sandbox.target_support_files_dir(name) end |
#umbrella_header_path ⇒ Pathname
Returns the absolute path of the header file which contains the exported foundation constants with framework version information and all headers, which should been exported in the module map.
195 196 197 |
# File 'lib/cocoapods/target.rb', line 195 def umbrella_header_path module_map_path.parent + "#{label}-umbrella.h" end |
#umbrella_header_path_to_write ⇒ Object
199 200 201 |
# File 'lib/cocoapods/target.rb', line 199 def umbrella_header_path_to_write module_map_path_to_write.parent + "#{label}-umbrella.h" end |
#uses_swift? ⇒ Boolean
Returns Whether the target uses Swift code.
83 84 85 |
# File 'lib/cocoapods/target.rb', line 83 def uses_swift? false end |
#version ⇒ String
Returns The version associated with this target.
77 78 79 |
# File 'lib/cocoapods/target.rb', line 77 def version DEFAULT_VERSION end |
#xcconfig_path(variant = nil) ⇒ Pathname
Returns the absolute path of the xcconfig file.
182 183 184 185 186 187 188 |
# File 'lib/cocoapods/target.rb', line 182 def xcconfig_path(variant = nil) if variant support_files_dir + "#{label}.#{variant.gsub(File::SEPARATOR, '-').downcase}.xcconfig" else support_files_dir + "#{label}.xcconfig" end end |