Class: Xcodeproj::Project::Object::XCConfigurationList

Inherits:
AbstractObject
  • Object
show all
Defined in:
lib/xcodeproj/project/object/configuration_list.rb

Overview

The primary purpose of this class is to maintain a collection of related build configurations of a PBXProject or a PBXNativeTarget.

Attributes collapse

Attributes inherited from AbstractObject

#isa, #project, #uuid

Attributes collapse

Helpers collapse

Methods inherited from AbstractObject

#<=>, #==, #display_name, #inspect, isa, #pretty_print, #remove_from_project, #sort, #sort_recursively, #to_hash

Instance Attribute Details

#default_configuration_is_visibleString

Returns whether the default configuration is visible. Usually ‘0`. The purpose of this flag and how Xcode displays it in the UI is unknown.

Returns:

  • (String)

    whether the default configuration is visible. Usually ‘0`. The purpose of this flag and how Xcode displays it in the UI is unknown.



14
# File 'lib/xcodeproj/project/object/configuration_list.rb', line 14

attribute :default_configuration_is_visible, String, '0'

#default_configuration_nameString

Returns the name of the default configuration. Usually ‘Release`. Xcode exposes this attribute as the configuration for the command line tools and only allows to set it at the project level.

Returns:

  • (String)

    the name of the default configuration. Usually ‘Release`. Xcode exposes this attribute as the configuration for the command line tools and only allows to set it at the project level.



21
# File 'lib/xcodeproj/project/object/configuration_list.rb', line 21

attribute :default_configuration_name, String, 'Release'

Instance Method Details

#[](name) ⇒ XCBuildConfiguration, Nil

Returns the build configuration with the given name.

Parameters:

  • name (String)

    The name of the build configuration.

Returns:

  • (XCBuildConfiguration)

    The build configuration.

  • (Nil)

    If not build configuration with the given name is found.



41
42
43
# File 'lib/xcodeproj/project/object/configuration_list.rb', line 41

def [](name)
  build_configurations.find { |bc| bc.name == name }
end

#build_configurationsObjectList<XCBuildConfiguration>

Returns the build configurations of the target.

Returns:



26
# File 'lib/xcodeproj/project/object/configuration_list.rb', line 26

has_many :build_configurations, XCBuildConfiguration

#build_settings(build_configuration_name) ⇒ Hash {String=>String}

Returns the build settings of the build configuration with the given name.

Parameters:

  • build_configuration_name (String)

    The name of the build configuration.

Returns:

  • (Hash {String=>String})

    the build settings



53
54
55
56
57
# File 'lib/xcodeproj/project/object/configuration_list.rb', line 53

def build_settings(build_configuration_name)
  if config = self[build_configuration_name]
    config.build_settings
  end
end

#get_setting(key) ⇒ Hash{String => String}

Gets the value for the given build setting in all the build configurations.

Parameters:

  • key (String)

    the key of the build setting.

Returns:

  • (Hash{String => String})

    The value of the build setting grouped by the name of the build configuration.



68
69
70
71
72
73
74
# File 'lib/xcodeproj/project/object/configuration_list.rb', line 68

def get_setting(key)
  result = {}
  build_configurations.each do |bc|
    result[bc.name] = bc.build_settings[key]
  end
  result
end

#set_setting(key, value) ⇒ void

This method returns an undefined value.

Sets the given value for the build setting associated with the given key across all the build configurations.

Parameters:

  • key (String)

    the key of the build setting.

  • value (String)

    the value for the build setting.



87
88
89
90
91
# File 'lib/xcodeproj/project/object/configuration_list.rb', line 87

def set_setting(key, value)
  build_configurations.each do |bc|
    bc.build_settings[key] = value
  end
end