Method: Xcodeproj::Project::ProjectHelper.configuration_list

Defined in:
lib/xcodeproj/project/project_helper.rb

.configuration_list(project, platform = nil, deployment_target = nil, target_product_type = nil, language = nil) ⇒ XCConfigurationList

Returns a new configuration list, populated with release and debug configurations with common build settings for the given platform.

Parameters:

  • project (Project)

    the project to which the configuration list should be added.

  • platform (Symbol) (defaults to: nil)

    the platform for the configuration list, can be ‘:ios` or `:osx`.

  • deployment_target (String) (defaults to: nil)

    the deployment target for the platform.

  • target_product_type (Symbol) (defaults to: nil)

    the product type of the target, can be any of ‘Constants::PRODUCT_TYPE_UTI.values` or `Constants::PRODUCT_TYPE_UTI.keys`.

  • language (Symbol) (defaults to: nil)

    the primary language of the target, can be ‘:objc` or `:swift`.

Returns:



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/xcodeproj/project/project_helper.rb', line 211

def self.configuration_list(project, platform = nil, deployment_target = nil, target_product_type = nil, language = nil)
  cl = project.new(XCConfigurationList)
  cl.default_configuration_is_visible = '0'
  cl.default_configuration_name = 'Release'

  release_conf = project.new(XCBuildConfiguration)
  release_conf.name = 'Release'
  release_conf.build_settings = common_build_settings(:release, platform, deployment_target, target_product_type, language)

  debug_conf = project.new(XCBuildConfiguration)
  debug_conf.name = 'Debug'
  debug_conf.build_settings = common_build_settings(:debug, platform, deployment_target, target_product_type, language)

  cl.build_configurations << release_conf
  cl.build_configurations << debug_conf

  existing_configurations = cl.build_configurations.map(&:name)
  project.build_configurations.each do |configuration|
    next if existing_configurations.include?(configuration.name)

    new_config = project.new(XCBuildConfiguration)
    new_config.name = configuration.name
    new_config.build_settings = common_build_settings(configuration.type, platform, deployment_target, target_product_type, language)
    cl.build_configurations << new_config
  end

  cl
end