Class: Pod::Generator::XCConfig::AggregateXCConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb

Overview

Generates the xcconfigs for the aggregate targets.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, configuration_name) ⇒ AggregateXCConfig

Initialize a new instance

Parameters:

  • target (Target)

    @see target

  • configuration_name (String)

    The name of the build configuration to generate this xcconfig for.



19
20
21
22
# File 'lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb', line 19

def initialize(target, configuration_name)
  @target = target
  @configuration_name = configuration_name
end

Instance Attribute Details

#targetTarget (readonly)

Returns the target represented by this xcconfig.

Returns:

  • (Target)

    the target represented by this xcconfig.



9
10
11
# File 'lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb', line 9

def target
  @target
end

#xcconfigXcodeproj::Config (readonly)

Returns The generated xcconfig.

Returns:

  • (Xcodeproj::Config)

    The generated xcconfig.



26
27
28
# File 'lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb', line 26

def xcconfig
  @xcconfig
end

Instance Method Details

#generateXcodeproj::Config

TODO:

This doesn’t include the specs xcconfigs anymore and now the logic is duplicated.

Note:

The xcconfig file for a Pods integration target includes the namespaced xcconfig files for each spec target dependency. Each namespaced configuration value is merged into the Pod xcconfig file.

Generates the xcconfig.

Returns:

  • (Xcodeproj::Config)


51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb', line 51

def generate
  includes_static_libs = !target.requires_frameworks?
  includes_static_libs ||= target.pod_targets.flat_map(&:file_accessors).any? { |fa| !fa.vendored_libraries.empty? }
  config = {
    'OTHER_LDFLAGS' => '$(inherited) ' + XCConfigHelper.default_ld_flags(target, includes_static_libs),
    'PODS_ROOT' => target.relative_pods_root,
    'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
  }
  @xcconfig = Xcodeproj::Config.new(config)

  @xcconfig.merge!(merged_user_target_xcconfigs)

  generate_settings_to_import_pod_targets

  XCConfigHelper.add_target_specific_settings(target, @xcconfig)

  generate_vendored_build_settings
  generate_other_ld_flags

  # TODO: Need to decide how we are going to ensure settings like these
  # are always excluded from the user's project.
  #
  # See https://github.com/CocoaPods/CocoaPods/issues/1216
  @xcconfig.attributes.delete('USE_HEADERMAP')

  generate_ld_runpath_search_paths if target.requires_frameworks?

  @xcconfig
end

#save_as(path) ⇒ void

This method returns an undefined value.

Generates and saves the xcconfig to the given path.

Parameters:

  • path (Pathname)

    the path where the xcconfig should be stored.



35
36
37
# File 'lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb', line 35

def save_as(path)
  generate.save_as(path)
end