Class: Pod::Target::BuildSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/target/build_settings.rb

Overview

Since:

  • 1.5.0

Direct Known Subclasses

AggregateTargetSettings, PodTargetSettings

Defined Under Namespace

Classes: AggregateTargetSettings, PodTargetSettings

Constants collapse

PLURAL_SETTINGS =

Returns The build settings that should be treated as arrays, rather than strings.

Returns:

  • (Set<String>)

    The build settings that should be treated as arrays, rather than strings.

Since:

  • 1.5.0

%w(
  ALTERNATE_PERMISSIONS_FILES
  ARCHS
  BUILD_VARIANTS
  EXCLUDED_SOURCE_FILE_NAMES
  FRAMEWORK_SEARCH_PATHS
  GCC_PREPROCESSOR_DEFINITIONS
  GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS
  HEADER_SEARCH_PATHS
  INCLUDED_SOURCE_FILE_NAMES
  INFOPLIST_PREPROCESSOR_DEFINITIONS
  LD_RUNPATH_SEARCH_PATHS
  LIBRARY_SEARCH_PATHS
  LOCALIZED_STRING_MACRO_NAMES
  OTHER_CFLAGS
  OTHER_CPLUSPLUSFLAGS
  OTHER_LDFLAGS
  OTHER_SWIFT_FLAGS
  REZ_SEARCH_PATHS
  SECTORDER_FLAGS
  SWIFT_ACTIVE_COMPILATION_CONDITIONS
  SWIFT_INCLUDE_PATHS
  SYSTEM_FRAMEWORK_SEARCH_PATHS
  SYSTEM_HEADER_SEARCH_PATHS
  USER_HEADER_SEARCH_PATHS
  WARNING_CFLAGS
  WARNING_LDFLAGS
).to_set.freeze
CONFIGURATION_BUILD_DIR_VARIABLE =

Returns The variable for the configuration build directory used when building pod targets.

Returns:

  • (String)

    The variable for the configuration build directory used when building pod targets.

Since:

  • 1.5.0

'${PODS_CONFIGURATION_BUILD_DIR}'.freeze

Public API collapse

Public API collapse

Build System collapse

Code Signing collapse

Frameworks collapse

Libraries collapse

Clang collapse

Swift collapse

Linking collapse

Constructor Details

#initialize(target) ⇒ BuildSettings

Initialize a new instance

Parameters:

Since:

  • 1.5.0


162
163
164
165
# File 'lib/cocoapods/target/build_settings.rb', line 162

def initialize(target)
  @target = target
  @__memoized = {}
end

Class Attribute Details

.build_settings_namesSet<String> (readonly)

be present in the #xcconfig

Returns:

  • (Set<String>)

    a set of all the build settings names that will

Since:

  • 1.5.0


145
146
147
# File 'lib/cocoapods/target/build_settings.rb', line 145

def build_settings_names
  @build_settings_names
end

Instance Attribute Details

#targetTarget (readonly)

Returns The target this build settings object is generating build settings for

Returns:

  • (Target)

    The target this build settings object is generating build settings for

Since:

  • 1.5.0


155
156
157
# File 'lib/cocoapods/target/build_settings.rb', line 155

def target
  @target
end

Instance Method Details

#code_sign_identityString

The `code_sign_identity` build setting for the #target.

The return value from this method will be: `code_sign_identity, build_setting`.

Returns:

  • (String)

217
218
219
220
221
# File 'lib/cocoapods/target/build_settings.rb', line 217

define_build_settings_method :code_sign_identity, :build_setting => true do
  return unless target.build_as_dynamic?
  return unless target.platform.to_sym == :osx
  ''
end

#framework_search_pathsArray<String>

The `framework_search_paths` build setting for the #target.

The return value from this method will be: `framework_search_paths, build_setting, memoized`.

Returns:

  • (Array<String>)

238
239
240
# File 'lib/cocoapods/target/build_settings.rb', line 238

define_build_settings_method :framework_search_paths, :build_setting => true, :memoized => true do
  framework_search_paths_to_import_developer_frameworks(frameworks + weak_frameworks)
end

#framework_search_paths_to_import_developer_frameworks(frameworks) ⇒ Array<String>

Returns the `FRAMEWORK_SEARCH_PATHS` needed to import developer frameworks

Parameters:

  • frameworks (Array<String>)

    The list of framework names

Returns:

  • (Array<String>)

    the `FRAMEWORK_SEARCH_PATHS` needed to import developer frameworks

Since:

  • 1.5.0


247
248
249
250
251
252
253
# File 'lib/cocoapods/target/build_settings.rb', line 247

def framework_search_paths_to_import_developer_frameworks(frameworks)
  if frameworks.include?('XCTest') || frameworks.include?('SenTestingKit')
    %w[ $(PLATFORM_DIR)/Developer/Library/Frameworks ]
  else
    []
  end
end

#frameworksArray<String>

The `frameworks` build setting for the #target.

The return value from this method will be: `frameworks`.

Returns:

  • (Array<String>)

228
229
230
# File 'lib/cocoapods/target/build_settings.rb', line 228

define_build_settings_method :frameworks do
  []
end

#gcc_preprocessor_definitionsArray<String>

The `gcc_preprocessor_definitions` build setting for the #target.

The return value from this method will be: `gcc_preprocessor_definitions, build_setting`.

Returns:

  • (Array<String>)

269
270
271
# File 'lib/cocoapods/target/build_settings.rb', line 269

define_build_settings_method :gcc_preprocessor_definitions, :build_setting => true do
  %w( COCOAPODS=1 )
end

#initialize_copy(other) ⇒ Object

Since:

  • 1.5.0


167
168
169
170
# File 'lib/cocoapods/target/build_settings.rb', line 167

def initialize_copy(other)
  super
  @__memoized = {}
end

#librariesArray<String>

The `libraries` build setting for the #target.

The return value from this method will be: `libraries`.

Returns:

  • (Array<String>)

260
261
262
# File 'lib/cocoapods/target/build_settings.rb', line 260

define_build_settings_method :libraries do
  []
end

#module_map_filesArray<String>

The `module_map_files` build setting for the #target.

The return value from this method will be: `module_map_files`.

Returns:

  • (Array<String>)

279
280
281
# File 'lib/cocoapods/target/build_settings.rb', line 279

define_build_settings_method :module_map_files do
  []
end

#other_cflagsArray<String>

The `other_cflags` build setting for the #target.

The return value from this method will be: `other_cflags, build_setting, memoized`.

Returns:

  • (Array<String>)

274
275
276
# File 'lib/cocoapods/target/build_settings.rb', line 274

define_build_settings_method :other_cflags, :build_setting => true, :memoized => true do
  module_map_files.map { |f| "-fmodule-map-file=#{f}" }
end

#other_ldflagsArray<String>

The `other_ldflags` build setting for the #target.

The return value from this method will be: `other_ldflags, build_setting, memoized`.

Returns:

  • (Array<String>)

340
341
342
343
344
345
346
347
348
349
350
# File 'lib/cocoapods/target/build_settings.rb', line 340

define_build_settings_method :other_ldflags, :build_setting => true, :memoized => true do
  ld_flags = []
  ld_flags << '-ObjC' if requires_objc_linker_flag?
  if requires_fobjc_arc?
    ld_flags << '-fobjc-arc'
  end
  libraries.each { |l| ld_flags << %(-l"#{l}") }
  frameworks.each { |f| ld_flags << '-framework' << %("#{f}") }
  weak_frameworks.each { |f| ld_flags << '-weak_framework' << %("#{f}") }
  ld_flags
end

#other_swift_flagsArray<String>

The `other_swift_flags` build setting for the #target.

The return value from this method will be: `other_swift_flags, build_setting, memoized`.

Returns:

  • (Array<String>)

296
297
298
299
300
301
# File 'lib/cocoapods/target/build_settings.rb', line 296

define_build_settings_method :other_swift_flags, :build_setting => true, :memoized => true do
  return unless target.uses_swift? || other_swift_flags_without_swift?
  flags = %w(-D COCOAPODS)
  flags.concat module_map_files.flat_map { |f| ['-Xcc', "-fmodule-map-file=#{f}"] }
  flags
end

#other_swift_flags_without_swift?Boolean

Returns Whether `OTHER_SWIFT_FLAGS` should be generated when the target does not use swift.

Returns:

  • (Boolean)

    Whether `OTHER_SWIFT_FLAGS` should be generated when the target does not use swift.

Since:

  • 1.5.0


291
292
293
# File 'lib/cocoapods/target/build_settings.rb', line 291

def other_swift_flags_without_swift?
  false
end

#pods_build_dirString

The `pods_build_dir` build setting for the #target.

The return value from this method will be: `pods_build_dir, build_setting`.

Returns:

  • (String)

198
199
200
# File 'lib/cocoapods/target/build_settings.rb', line 198

define_build_settings_method :pods_build_dir, :build_setting => true do
  '${BUILD_DIR}'
end

#pods_configuration_build_dirString

The `pods_configuration_build_dir` build setting for the #target.

The return value from this method will be: `pods_configuration_build_dir, build_setting`.

Returns:

  • (String)

203
204
205
# File 'lib/cocoapods/target/build_settings.rb', line 203

define_build_settings_method :pods_configuration_build_dir, :build_setting => true do
  '${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
end

#requires_fobjc_arc?Boolean

The `requires_fobjc_arc?` build setting for the #target.

The return value from this method will be: `requires_fobjc_arc?`.

Returns:

  • (Boolean)

313
314
315
# File 'lib/cocoapods/target/build_settings.rb', line 313

define_build_settings_method :requires_fobjc_arc? do
  false
end

#requires_objc_linker_flag?Boolean

The `requires_objc_linker_flag?` build setting for the #target.

The return value from this method will be: `requires_objc_linker_flag?`.

Returns:

  • (Boolean)

308
309
310
# File 'lib/cocoapods/target/build_settings.rb', line 308

define_build_settings_method :requires_objc_linker_flag? do
  false
end

#save_as(path) ⇒ Xcodeproj::Config

Saves the generated xcconfig to the given path

Parameters:

  • path (String, Pathname)

    The path the xcconfig will be saved to

Returns:

  • (Xcodeproj::Config)

See Also:

Since:

  • 1.5.0


189
190
191
# File 'lib/cocoapods/target/build_settings.rb', line 189

def save_as(path)
  xcconfig.save_as(path)
end

#use_recursive_script_inputs_in_script_phasesString

The `use_recursive_script_inputs_in_script_phases` build setting for the #target.

The return value from this method will be: `use_recursive_script_inputs_in_script_phases, build_setting`.

Returns:

  • (String)

208
209
210
# File 'lib/cocoapods/target/build_settings.rb', line 208

define_build_settings_method :use_recursive_script_inputs_in_script_phases, :build_setting => true do
  'YES'
end

#weak_frameworksArray<String>

The `weak_frameworks` build setting for the #target.

The return value from this method will be: `weak_frameworks`.

Returns:

  • (Array<String>)

233
234
235
# File 'lib/cocoapods/target/build_settings.rb', line 233

define_build_settings_method :weak_frameworks do
  []
end

#xcconfigXcodeproj::Config Also known as: generate

The `xcconfig` build setting for the #target.

The return value from this method will be: `xcconfig, memoized`.

Returns:

  • (Xcodeproj::Config)

173
174
175
176
# File 'lib/cocoapods/target/build_settings.rb', line 173

define_build_settings_method :xcconfig, :memoized => true do
  settings = add_inherited_to_plural(to_h)
  Xcodeproj::Config.new(settings)
end