Class: Pod::Target::BuildSettings::AggregateTargetSettings

Inherits:
Pod::Target::BuildSettings show all
Defined in:
lib/cocoapods/target/build_settings.rb

Overview

A subclass that generates build settings for a `PodTarget`

Since:

  • 1.5.0

Constant Summary

Constants inherited from Pod::Target::BuildSettings

CONFIGURATION_BUILD_DIR_VARIABLE, PLURAL_SETTINGS

Public API collapse

Attributes inherited from Pod::Target::BuildSettings

#target

Public API collapse

Paths collapse

Frameworks collapse

Libraries collapse

Clang collapse

Swift collapse

Linking collapse

Target Properties collapse

Methods inherited from Pod::Target::BuildSettings

#code_sign_identity, #framework_search_paths_to_import_developer_frameworks, #gcc_preprocessor_definitions, #initialize_copy, #other_ldflags, #other_swift_flags, #pods_build_dir, #pods_configuration_build_dir, #save_as, #use_recursive_script_inputs_in_script_phases

Constructor Details

#initialize(target, configuration_name, configuration: nil) ⇒ AggregateTargetSettings

Initializes a new instance

Parameters:

Since:

  • 1.5.0


1024
1025
1026
1027
1028
# File 'lib/cocoapods/target/build_settings.rb', line 1024

def initialize(target, configuration_name, configuration: nil)
  super(target)
  @configuration_name = configuration_name
  (@configuration = configuration) || raise("No configuration for #{self}.")
end

Instance Attribute Details

#configuration_nameSymbol (readonly)

Returns The build configuration these settings will be used for.

Returns:

  • (Symbol)

    The build configuration these settings will be used for

Since:

  • 1.5.0


1014
1015
1016
# File 'lib/cocoapods/target/build_settings.rb', line 1014

def configuration_name
  @configuration_name
end

Class Method Details

.build_settings_namesObject


1008
1009
1010
# File 'lib/cocoapods/target/build_settings.rb', line 1008

def self.build_settings_names
  @build_settings_names | BuildSettings.build_settings_names
end

Instance Method Details

#always_embed_swift_standard_librariesString

The `always_embed_swift_standard_libraries` build setting for the Pod::Target::BuildSettings#target.

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

Returns:

  • (String)

1149
1150
1151
1152
1153
1154
# File 'lib/cocoapods/target/build_settings.rb', line 1149

define_build_settings_method :always_embed_swift_standard_libraries, :build_setting => true, :memoized => true do
  return unless must_embed_swift?
  return if target_swift_version < EMBED_STANDARD_LIBRARIES_MINIMUM_VERSION

  'YES'
end

#any_vendored_dynamic_artifacts?Boolean

The `any_vendored_dynamic_artifacts?` build setting for the Pod::Target::BuildSettings#target.

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

Returns:

  • (Boolean)

1182
1183
1184
1185
1186
1187
1188
# File 'lib/cocoapods/target/build_settings.rb', line 1182

define_build_settings_method :any_vendored_dynamic_artifacts?, :memoized => true do
  pod_targets.any? do |pt|
    pt.file_accessors.any? do |fa|
      !fa.vendored_dynamic_artifacts.empty?
    end
  end
end

#any_vendored_static_artifacts?Boolean

The `any_vendored_static_artifacts?` build setting for the Pod::Target::BuildSettings#target.

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

Returns:

  • (Boolean)

1191
1192
1193
1194
1195
1196
1197
# File 'lib/cocoapods/target/build_settings.rb', line 1191

define_build_settings_method :any_vendored_static_artifacts?, :memoized => true do
  pod_targets.any? do |pt|
    pt.file_accessors.any? do |fa|
      !fa.vendored_static_artifacts.empty?
    end
  end
end

#embedded_content_contains_swiftString

The `embedded_content_contains_swift` build setting for the Pod::Target::BuildSettings#target.

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

Returns:

  • (String)

1157
1158
1159
1160
1161
1162
# File 'lib/cocoapods/target/build_settings.rb', line 1157

define_build_settings_method :embedded_content_contains_swift, :build_setting => true, :memoized => true do
  return unless must_embed_swift?
  return if target_swift_version >= EMBED_STANDARD_LIBRARIES_MINIMUM_VERSION

  'YES'
end

#framework_search_pathsArray<String>

The `framework_search_paths` build setting for the Pod::Target::BuildSettings#target.

The return value from this method will be: `framework_search_paths, build_setting, memoized, sorted, uniqued, from_pod_targets_to_link, from_search_paths_aggregate_targets`.

Returns:

  • (Array<String>)

1065
1066
1067
# File 'lib/cocoapods/target/build_settings.rb', line 1065

define_build_settings_method :framework_search_paths, :build_setting => true, :memoized => true, :sorted => true, :uniqued => true, :from_pod_targets_to_link => true, :from_search_paths_aggregate_targets => :framework_search_paths_to_import do
  []
end

#frameworksArray<String>

The `frameworks` build setting for the Pod::Target::BuildSettings#target.

The return value from this method will be: `frameworks, memoized, sorted, uniqued, from_pod_targets_to_link, from_search_paths_aggregate_targets`.

Returns:

  • (Array<String>)

1055
1056
1057
# File 'lib/cocoapods/target/build_settings.rb', line 1055

define_build_settings_method :frameworks, :memoized => true, :sorted => true, :uniqued => true, :from_pod_targets_to_link => true, :from_search_paths_aggregate_targets => :dynamic_frameworks_to_import do
  []
end

#header_search_pathsArray<String>

The `header_search_paths` build setting for the Pod::Target::BuildSettings#target.

The return value from this method will be: `header_search_paths, build_setting, memoized, sorted, uniqued`.

Returns:

  • (Array<String>)

1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
# File 'lib/cocoapods/target/build_settings.rb', line 1088

define_build_settings_method :header_search_paths, :build_setting => true, :memoized => true, :sorted => true, :uniqued => true do
  paths = []

  if !target.build_as_framework? || !pod_targets.all?(&:should_build?)
    paths.concat target.sandbox.public_headers.search_paths(target.platform)
  end

  # Make frameworks headers discoverable with any syntax (quotes,
  # brackets, @import, etc.)
  paths.concat pod_targets.
    select { |pt| pt.build_as_framework? && pt.should_build? }.
    map { |pt| pt.build_settings[@configuration].framework_header_search_path }

  paths.concat target.search_paths_aggregate_targets.flat_map { |at| at.build_settings(configuration_name).header_search_paths }

  paths
end

#ld_runpath_search_pathsArray<String>

The `ld_runpath_search_paths` build setting for the Pod::Target::BuildSettings#target.

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

Returns:

  • (Array<String>)

1174
1175
1176
1177
1178
1179
# File 'lib/cocoapods/target/build_settings.rb', line 1174

define_build_settings_method :ld_runpath_search_paths, :build_setting => true, :memoized => true, :uniqued => true do
  return unless pod_targets.any?(&:build_as_dynamic?) || any_vendored_dynamic_artifacts?
  symbol_type = target.user_targets.map(&:symbol_type).uniq.first
  test_bundle = symbol_type == :octest_bundle || symbol_type == :unit_test_bundle || symbol_type == :ui_test_bundle
  _ld_runpath_search_paths(:requires_host_target => target.requires_host_target?, :test_bundle => test_bundle)
end

#librariesArray<String>

The `libraries` build setting for the Pod::Target::BuildSettings#target.

The return value from this method will be: `libraries, memoized, sorted, uniqued, from_pod_targets_to_link, from_search_paths_aggregate_targets`.

Returns:

  • (Array<String>)

1074
1075
1076
# File 'lib/cocoapods/target/build_settings.rb', line 1074

define_build_settings_method :libraries, :memoized => true, :sorted => true, :uniqued => true, :from_pod_targets_to_link => true, :from_search_paths_aggregate_targets => :dynamic_libraries_to_import do
  []
end

#library_search_pathsArray<String>

The `library_search_paths` build setting for the Pod::Target::BuildSettings#target.

The return value from this method will be: `library_search_paths, build_setting, memoized, sorted, uniqued, from_pod_targets_to_link, from_search_paths_aggregate_targets`.

Returns:

  • (Array<String>)

1079
1080
1081
# File 'lib/cocoapods/target/build_settings.rb', line 1079

define_build_settings_method :library_search_paths, :build_setting => true, :memoized => true, :sorted => true, :uniqued => true, :from_pod_targets_to_link => true, :from_search_paths_aggregate_targets => :vendored_dynamic_library_search_paths do
  []
end

#merged_user_target_xcconfigsHash{String, String}

Merges the user_target_xcconfig for all pod targets into a single hash and warns on conflicting definitions.

The `merged_user_target_xcconfigs` build setting for the Pod::Target::BuildSettings#target.

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

Returns:

  • (Hash{String, String})

1274
1275
1276
# File 'lib/cocoapods/target/build_settings.rb', line 1274

define_build_settings_method :merged_user_target_xcconfigs, :memoized => true do
  merged_xcconfigs(user_target_xcconfig_values_by_consumer_by_key, :user_target_xcconfig)
end

#module_map_filesArray<String>

The `module_map_files` build setting for the Pod::Target::BuildSettings#target.

The return value from this method will be: `module_map_files, memoized, sorted, uniqued, compacted, from_search_paths_aggregate_targets`.

Returns:

  • (Array<String>)

1130
1131
1132
# File 'lib/cocoapods/target/build_settings.rb', line 1130

define_build_settings_method :module_map_files, :memoized => true, :sorted => true, :uniqued => true, :compacted => true, :from_search_paths_aggregate_targets => :module_map_file_to_import do
  pod_targets.map { |pt| pt.build_settings[@configuration].module_map_file_to_import }
end

#must_embed_swift?Boolean

The `must_embed_swift?` build setting for the Pod::Target::BuildSettings#target.

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

Returns:

  • (Boolean)

1165
1166
1167
# File 'lib/cocoapods/target/build_settings.rb', line 1165

define_build_settings_method :must_embed_swift?, :memoized => true do
  !target.requires_host_target? && pod_targets.any?(&:uses_swift?)
end

#other_cflagsArray<String>

The `other_cflags` build setting for the Pod::Target::BuildSettings#target.

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

Returns:

  • (Array<String>)

1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
# File 'lib/cocoapods/target/build_settings.rb', line 1107

define_build_settings_method :other_cflags, :build_setting => true, :memoized => true do
  flags = super()

  pod_targets_inhibiting_warnings = pod_targets.select(&:inhibit_warnings?)

  silenced_headers = []
  silenced_frameworks = []
  pod_targets_inhibiting_warnings.each do |pt|
    if pt.build_as_framework? && pt.should_build?
      silenced_headers.append pt.build_settings[@configuration].framework_header_search_path
    else
      silenced_headers.concat pt.build_settings[@configuration].public_header_search_paths
    end
    silenced_frameworks.concat pt.build_settings[@configuration].framework_search_paths_to_import
  end

  flags += silenced_headers.uniq.flat_map { |p| ['-isystem', p] }
  flags += silenced_frameworks.uniq.flat_map { |p| ['-iframework', p] }

  flags
end

#other_swift_flags_without_swift?Boolean

Returns:

  • (Boolean)

See Also:

Since:

  • 1.5.0


1139
1140
1141
# File 'lib/cocoapods/target/build_settings.rb', line 1139

def other_swift_flags_without_swift?
  module_map_files.any?
end

#pod_targetsArray<PodTarget>

Returns the PodTargets which are active for the current configuration name.

The `pod_targets` build setting for the Pod::Target::BuildSettings#target.

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

Returns:


1231
1232
1233
# File 'lib/cocoapods/target/build_settings.rb', line 1231

define_build_settings_method :pod_targets, :memoized => true do
  target.pod_targets_for_build_configuration(configuration_name)
end

The `pod_targets_to_link` build setting for the Pod::Target::BuildSettings#target.

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

Returns:


1236
1237
1238
1239
# File 'lib/cocoapods/target/build_settings.rb', line 1236

define_build_settings_method :pod_targets_to_link, :memoized => true do
  pod_targets -
    target.search_paths_aggregate_targets.flat_map { |at| at.build_settings(configuration_name).pod_targets_to_link }
end

#pods_podfile_dir_pathString

The `pods_podfile_dir_path` build setting for the Pod::Target::BuildSettings#target.

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

Returns:

  • (String)

1041
1042
1043
# File 'lib/cocoapods/target/build_settings.rb', line 1041

define_build_settings_method :pods_podfile_dir_path, :build_setting => true, :memoized => true do
  target.podfile_dir_relative_path
end

#pods_rootString

The `pods_root` build setting for the Pod::Target::BuildSettings#target.

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

Returns:

  • (String)

1046
1047
1048
# File 'lib/cocoapods/target/build_settings.rb', line 1046

define_build_settings_method :pods_root, :build_setting => true, :memoized => true do
  target.relative_pods_root
end

#requires_fobjc_arc?Boolean

The `requires_fobjc_arc?` build setting for the Pod::Target::BuildSettings#target.

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

Returns:

  • (Boolean)

1206
1207
1208
1209
# File 'lib/cocoapods/target/build_settings.rb', line 1206

define_build_settings_method :requires_fobjc_arc?, :memoized => true do
  target.podfile.set_arc_compatibility_flag? &&
  target.spec_consumers.any?(&:requires_arc?)
end

#requires_objc_linker_flag?Boolean

The `requires_objc_linker_flag?` build setting for the Pod::Target::BuildSettings#target.

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

Returns:

  • (Boolean)

1200
1201
1202
1203
# File 'lib/cocoapods/target/build_settings.rb', line 1200

define_build_settings_method :requires_objc_linker_flag?, :memoized => true do
  pod_targets.any?(&:build_as_static?) ||
    any_vendored_static_artifacts?
end

#search_paths_aggregate_target_pod_target_build_settingsArray<PodTarget>

The `search_paths_aggregate_target_pod_target_build_settings` build setting for the Pod::Target::BuildSettings#target.

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

Returns:


1242
1243
1244
1245
1246
# File 'lib/cocoapods/target/build_settings.rb', line 1242

define_build_settings_method :search_paths_aggregate_target_pod_target_build_settings, :memoized => true, :uniqued => true do
  pod_targets = target.search_paths_aggregate_targets.flat_map { |at| at.build_settings(configuration_name).pod_targets }
  pod_targets = select_maximal_pod_targets(pod_targets)
  pod_targets.map { |pt| pt.build_settings[@configuration] }
end

#swift_include_pathsArray<String>

The `swift_include_paths` build setting for the Pod::Target::BuildSettings#target.

The return value from this method will be: `swift_include_paths, build_setting, memoized, sorted, uniqued, from_pod_targets_to_link, from_search_paths_aggregate_targets`.

Returns:

  • (Array<String>)

1144
1145
1146
# File 'lib/cocoapods/target/build_settings.rb', line 1144

define_build_settings_method :swift_include_paths, :build_setting => true, :memoized => true, :sorted => true, :uniqued => true, :from_pod_targets_to_link => true, :from_search_paths_aggregate_targets => :swift_include_paths_to_import do
  []
end

#target_swift_versionVersion

The `target_swift_version` build setting for the Pod::Target::BuildSettings#target.

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

Returns:

  • (Version)

    the SWIFT_VERSION of the target being integrated


1217
1218
1219
1220
1221
# File 'lib/cocoapods/target/build_settings.rb', line 1217

define_build_settings_method :target_swift_version, :memoized => true, :frozen => false do
  swift_version = target.target_definition.swift_version
  swift_version = nil if swift_version.blank?
  Version.new(swift_version)
end

#user_target_xcconfig_values_by_consumer_by_keyHash{String,Hash{Target,String}]

Returns the user_target_xcconfig for all pod targets and their spec consumers grouped by keys

Returns:

  • (Hash{String,Hash{Target,String}])

    HashString,Hash{Target,String]

Since:

  • 1.5.0


1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
# File 'lib/cocoapods/target/build_settings.rb', line 1253

def user_target_xcconfig_values_by_consumer_by_key
  targets = (pod_targets + target.search_paths_aggregate_targets.flat_map(&:pod_targets)).uniq
  targets.each_with_object({}) do |target, hash|
    target.spec_consumers.each do |spec_consumer|
      spec_consumer.user_target_xcconfig.each do |k, v|
        # 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
        next if k == 'USE_HEADERMAP'
        (hash[k] ||= {})[spec_consumer] = v
      end
    end
  end
end

#weak_frameworksArray<String>

The `weak_frameworks` build setting for the Pod::Target::BuildSettings#target.

The return value from this method will be: `weak_frameworks, memoized, sorted, uniqued, from_pod_targets_to_link, from_search_paths_aggregate_targets`.

Returns:

  • (Array<String>)

1060
1061
1062
# File 'lib/cocoapods/target/build_settings.rb', line 1060

define_build_settings_method :weak_frameworks, :memoized => true, :sorted => true, :uniqued => true, :from_pod_targets_to_link => true, :from_search_paths_aggregate_targets => :weak_frameworks do
  []
end

#xcconfigXcodeproj::Config

The `xcconfig` build setting for the Pod::Target::BuildSettings#target.

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

Returns:

  • (Xcodeproj::Config)

    xcconfig


1031
1032
1033
1034
# File 'lib/cocoapods/target/build_settings.rb', line 1031

define_build_settings_method :xcconfig, :memoized => true do
  xcconfig = super()
  merge_spec_xcconfig_into_xcconfig(merged_user_target_xcconfigs, xcconfig)
end