Class: Pod::Target

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

AggregateTarget, PodTarget

Information storage collapse

Instance Attribute Summary collapse

Support files collapse

Instance Method Summary collapse

Constructor Details

#initializeTarget

Initialize a new target



21
22
23
# File 'lib/cocoapods/target.rb', line 21

def initialize
  @archs = []
end

Instance Attribute Details

#archsArray<String>

Returns The value for the ARCHS build setting.

Returns:

  • (Array<String>)

    The value for the ARCHS build setting.



116
117
118
# File 'lib/cocoapods/target.rb', line 116

def archs
  @archs
end

#host_requires_frameworksBoolean Also known as: host_requires_frameworks?

Returns Whether the target needs to be implemented as a framework. Computed by analyzer.

Returns:

  • (Boolean)

    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_targetPBXNativeTarget

Returns the target generated in the Pods project for this library.

Returns:

  • (PBXNativeTarget)

    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

#sandboxSandbox (readonly)

Returns The sandbox where the Pods should be installed.

Returns:

  • (Sandbox)

    The sandbox where the Pods should be installed.



11
12
13
# File 'lib/cocoapods/target.rb', line 11

def sandbox
  @sandbox
end

#user_build_configurationsHash{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`).

Returns:

  • (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`).



107
108
109
# File 'lib/cocoapods/target.rb', line 107

def user_build_configurations
  @user_build_configurations
end

Instance Method Details

#bridge_support_pathPathname

Returns the absolute path of the bridge support file.

Returns:

  • (Pathname)

    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_pathPathname

Returns the path of the dummy source generated by CocoaPods.

Returns:

  • (Pathname)

    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_nameString

Note:

This may not depend on #requires_frameworks? indirectly as it is used for migration.

Returns the name of the framework, depends on #label.

Returns:

  • (String)

    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_pathPathname

Returns the absolute path of the Info.plist file.

Returns:

  • (Pathname)

    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

#inspectString

Returns A string suitable for debugging.

Returns:

  • (String)

    A string suitable for debugging.



86
87
88
# File 'lib/cocoapods/target.rb', line 86

def inspect
  "<#{self.class} name=#{name} >"
end

#module_map_pathPathname

Returns the absolute path of the LLVM module map file that defines the module structure for the compiler.

Returns:

  • (Pathname)

    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

#nameString

Returns the name of the library.

Returns:

  • (String)

    the name of the library.



27
28
29
# File 'lib/cocoapods/target.rb', line 27

def name
  label
end

#prefix_header_pathPathname

Returns the absolute path of the prefix header file.

Returns:

  • (Pathname)

    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_basenameString

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.

Returns:

  • (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.



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_nameString

Returns the name of the product.

Returns:

  • (String)

    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_typeSymbol

Returns either :framework or :static_library, depends on #requires_frameworks?.

Returns:

  • (Symbol)

    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.

Returns:

  • (Boolean)

    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_nameString

Note:

This may not depend on #requires_frameworks? indirectly as it is used for migration.

Returns the name of the library, depends on #label.

Returns:

  • (String)

    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_dirPathname

Returns the folder where to store the support files of this library.

Returns:

  • (Pathname)

    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_pathPathname

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.

Returns:

  • (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.



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.

Parameters:

  • variant (String) (defaults to: nil)

    The variant of the xcconfig. Used to differentiate build configurations.

Returns:

  • (Pathname)

    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_prefixString

Returns the XCConfig namespaced prefix.

Returns:

  • (String)

    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_pathPathname

Returns the absolute path of the private xcconfig file.

Returns:

  • (Pathname)

    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