Class: Pod::Target
- Inherits:
-
Object
- Object
- Pod::Target
- Defined in:
- lib/cocoapods/target.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 itβs dependent libraries. This class is used to represent both the targets and their libraries.
Direct Known Subclasses
Information storage collapse
-
#archs ⇒ Array<String>
The value for the ARCHS build setting.
-
#native_target ⇒ PBXNativeTarget
The target generated in the Pods project for this library.
-
#user_build_configurations ⇒ Hash{String=>Symbol}
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`).
Instance Attribute Summary collapse
-
#host_requires_frameworks ⇒ Boolean
(also: #host_requires_frameworks?)
Whether the target needs to be implemented as a framework.
-
#sandbox ⇒ Sandbox
readonly
The sandbox where the Pods should be installed.
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.
-
#prefix_header_path ⇒ Pathname
The absolute path of the prefix header file.
-
#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.
-
#xcconfig_path(variant = nil) ⇒ Pathname
The absolute path of the xcconfig file.
-
#xcconfig_private_path ⇒ Pathname
The absolute path of the private xcconfig file.
Instance Method Summary collapse
-
#framework_name ⇒ String
The name of the framework, depends on #label.
-
#initialize ⇒ Target
constructor
Initialize a new target.
-
#inspect ⇒ String
A string suitable for debugging.
-
#name ⇒ String
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_name ⇒ String
The name of the product.
-
#product_type ⇒ Symbol
Either :framework or :static_library, depends on #requires_frameworks?.
-
#requires_frameworks? ⇒ Boolean
Whether the generated target needs to be implemented as a framework.
-
#static_library_name ⇒ String
The name of the library, depends on #label.
-
#xcconfig_prefix ⇒ String
The XCConfig namespaced prefix.
Constructor Details
#initialize ⇒ Target
Initialize a new target
21 22 23 |
# File 'lib/cocoapods/target.rb', line 21 def initialize @archs = [] end |
Instance Attribute Details
#archs ⇒ Array<String>
Returns The value for the ARCHS build setting.
116 117 118 |
# File 'lib/cocoapods/target.rb', line 116 def archs @archs end |
#host_requires_frameworks ⇒ Boolean Also known as: host_requires_frameworks?
Returns Whether the target needs to be implemented as a framework. Computed by analyzer.
16 17 18 |
# File 'lib/cocoapods/target.rb', line 16 def host_requires_frameworks @host_requires_frameworks end |
#native_target ⇒ PBXNativeTarget
Returns the target generated in the Pods project for this library.
112 113 114 |
# File 'lib/cocoapods/target.rb', line 112 def native_target @native_target end |
#sandbox ⇒ Sandbox (readonly)
Returns The sandbox where the Pods should be installed.
11 12 13 |
# File 'lib/cocoapods/target.rb', line 11 def sandbox @sandbox end |
#user_build_configurations ⇒ Hash{String=>Symbol}
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`).
107 108 109 |
# File 'lib/cocoapods/target.rb', line 107 def user_build_configurations @user_build_configurations end |
Instance Method Details
#bridge_support_path ⇒ Pathname
Returns the absolute path of the bridge support file.
173 174 175 |
# File 'lib/cocoapods/target.rb', line 173 def bridge_support_path support_files_dir + "#{label}.bridgesupport" end |
#dummy_source_path ⇒ Pathname
Returns the path of the dummy source generated by CocoaPods.
185 186 187 |
# File 'lib/cocoapods/target.rb', line 185 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.
58 59 60 |
# File 'lib/cocoapods/target.rb', line 58 def framework_name "#{product_module_name}.framework" end |
#info_plist_path ⇒ Pathname
Returns the absolute path of the Info.plist file.
179 180 181 |
# File 'lib/cocoapods/target.rb', line 179 def info_plist_path support_files_dir + 'Info.plist' end |
#inspect ⇒ String
Returns A string suitable for debugging.
86 87 88 |
# File 'lib/cocoapods/target.rb', line 86 def inspect "<#{self.class} name=#{name} >" end |
#module_map_path ⇒ Pathname
Returns the absolute path of the LLVM module map file that defines the module structure for the compiler.
161 162 163 |
# File 'lib/cocoapods/target.rb', line 161 def module_map_path support_files_dir + "#{label}.modulemap" end |
#name ⇒ String
Returns the name of the library.
27 28 29 |
# File 'lib/cocoapods/target.rb', line 27 def name label end |
#prefix_header_path ⇒ Pathname
Returns the absolute path of the prefix header file.
167 168 169 |
# File 'lib/cocoapods/target.rb', line 167 def prefix_header_path support_files_dir + "#{label}-prefix.pch" 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.
45 46 47 48 49 50 51 |
# File 'lib/cocoapods/target.rb', line 45 def product_basename if requires_frameworks? product_module_name else label end end |
#product_name ⇒ String
Returns the name of the product.
33 34 35 36 37 38 39 |
# File 'lib/cocoapods/target.rb', line 33 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?.
74 75 76 |
# File 'lib/cocoapods/target.rb', line 74 def product_type requires_frameworks? ? :framework : :static_library end |
#requires_frameworks? ⇒ Boolean
Returns whether the generated target needs to be implemented as a framework.
95 96 97 |
# File 'lib/cocoapods/target.rb', line 95 def requires_frameworks? host_requires_frameworks? || 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.
67 68 69 |
# File 'lib/cocoapods/target.rb', line 67 def static_library_name "lib#{label}.a" end |
#support_files_dir ⇒ Pathname
Returns the folder where to store the support files of this library.
125 126 127 |
# File 'lib/cocoapods/target.rb', line 125 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.
154 155 156 |
# File 'lib/cocoapods/target.rb', line 154 def umbrella_header_path support_files_dir + "#{label}-umbrella.h" end |
#xcconfig_path(variant = nil) ⇒ Pathname
Returns the absolute path of the xcconfig file.
135 136 137 138 139 140 141 |
# File 'lib/cocoapods/target.rb', line 135 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 |
#xcconfig_prefix ⇒ String
Returns the XCConfig namespaced prefix.
80 81 82 |
# File 'lib/cocoapods/target.rb', line 80 def xcconfig_prefix label.upcase.gsub(/[^A-Z]/, '_') + '_' end |
#xcconfig_private_path ⇒ Pathname
Returns the absolute path of the private xcconfig file.
145 146 147 |
# File 'lib/cocoapods/target.rb', line 145 def xcconfig_private_path support_files_dir + "#{label}-Private.xcconfig" end |