Class: Xcodeproj::Project::Object::XCBuildConfiguration
- Inherits:
-
AbstractObject
- Object
- AbstractObject
- Xcodeproj::Project::Object::XCBuildConfiguration
- Defined in:
- lib/xcodeproj/project/object/build_configuration.rb,
lib/xcodeproj/project/object/helpers/build_settings_array_settings_by_object_version.rb
Overview
Encapsulates the information a specific build configuration referenced by a XCConfigurationList which in turn might be referenced by a PBXProject or a PBXNativeTarget.
Defined Under Namespace
Modules: BuildSettingsArraySettingsByObjectVersion
Attributes collapse
-
#base_configuration_reference ⇒ PBXFileReference
An optional file reference to a configuration file (‘.xcconfig`).
-
#build_settings ⇒ Hash
The build settings to use for building the target.
-
#name ⇒ String
The name of the Target.
Attributes inherited from AbstractObject
AbstractObject Hooks collapse
-
#debug? ⇒ Boolean
Whether this configuration is configured for debugging.
-
#pretty_print ⇒ Hash{String => Hash}
A hash suitable to display the object to the user.
-
#sort(_options = nil) ⇒ void
Sorts the build settings.
- #to_hash_as(method = :to_hash) ⇒ Object
-
#type ⇒ Symbol
The symbolic type of this configuration, either ‘:debug` or `:release`.
Helpers collapse
-
#resolve_build_setting(key, root_target = nil) ⇒ String
Gets the value for the given build setting considering any configuration file present and resolving inheritance between them.
Methods inherited from AbstractObject
#<=>, #==, #ascii_plist_annotation, #display_name, #inspect, isa, #nested_object_for_hash, #remove_from_project, #sort_recursively, #to_ascii_plist, #to_hash
Instance Attribute Details
#base_configuration_reference ⇒ PBXFileReference
Returns an optional file reference to a configuration file (‘.xcconfig`).
22 |
# File 'lib/xcodeproj/project/object/build_configuration.rb', line 22 has_one :base_configuration_reference, PBXFileReference |
#build_settings ⇒ Hash
Returns the build settings to use for building the target.
17 |
# File 'lib/xcodeproj/project/object/build_configuration.rb', line 17 attribute :build_settings, Hash, {} |
#name ⇒ String
Returns the name of the Target.
13 |
# File 'lib/xcodeproj/project/object/build_configuration.rb', line 13 attribute :name, String |
Instance Method Details
#debug? ⇒ Boolean
Returns Whether this configuration is configured for debugging.
59 60 61 62 |
# File 'lib/xcodeproj/project/object/build_configuration.rb', line 59 def debug? gcc_preprocessor_definitions = resolve_build_setting('GCC_PREPROCESSOR_DEFINITIONS') gcc_preprocessor_definitions && gcc_preprocessor_definitions.include?('DEBUG=1') end |
#pretty_print ⇒ Hash{String => Hash}
Returns A hash suitable to display the object to the user.
32 33 34 35 36 37 38 39 |
# File 'lib/xcodeproj/project/object/build_configuration.rb', line 32 def pretty_print data = {} data['Build Settings'] = sorted_build_settings if base_configuration_reference data['Base Configuration'] = base_configuration_reference.pretty_print end { name => data } end |
#resolve_build_setting(key, root_target = nil) ⇒ String
Gets the value for the given build setting considering any configuration file present and resolving inheritance between them. It also takes in consideration environment variables.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/xcodeproj/project/object/build_configuration.rb', line 86 def resolve_build_setting(key, root_target = nil) setting = build_settings[key] setting = resolve_variable_substitution(key, setting, root_target) config_setting = config[key] config_setting = resolve_variable_substitution(key, config_setting, root_target) project_setting = project.build_configuration_list[name] project_setting = nil if equal?(project_setting) project_setting &&= project_setting.resolve_build_setting(key, root_target) defaults = { 'CONFIGURATION' => name, 'SRCROOT' => project.project_dir.to_s, } [defaults[key], project_setting, config_setting, setting, ENV[key]].compact.reduce(nil) do |inherited, value| (value, inherited) end end |
#sort(_options = nil) ⇒ void
This method returns an undefined value.
Sorts the build settings. Valid only in Ruby > 1.9.2 because in previous versions the hash are not sorted.
52 53 54 |
# File 'lib/xcodeproj/project/object/build_configuration.rb', line 52 def sort( = nil) self.build_settings = sorted_build_settings end |
#to_hash_as(method = :to_hash) ⇒ Object
41 42 43 44 45 |
# File 'lib/xcodeproj/project/object/build_configuration.rb', line 41 def to_hash_as(method = :to_hash) super.tap do |hash| normalize_array_settings(hash['buildSettings']) end end |
#type ⇒ Symbol
Returns The symbolic type of this configuration, either ‘:debug` or `:release`.
67 68 69 |
# File 'lib/xcodeproj/project/object/build_configuration.rb', line 67 def type debug? ? :debug : :release end |