Module: Xcode::Configuration
- Defined in:
- lib/xcode/configuration.rb,
lib/xcode/configurations/array_property.rb,
lib/xcode/configurations/string_property.rb,
lib/xcode/configurations/boolean_property.rb,
lib/xcode/configurations/key_value_array_property.rb,
lib/xcode/configurations/space_delimited_string_property.rb,
lib/xcode/configurations/targeted_device_family_property.rb
Overview
Projects have a number of build configurations. These configurations are usually the default ‘Debug’ and ‘Release’. However, custom ones can be defined.
Each configuration is defined and then a reference of that configuration is maintained in the Target through the XCConfigurationList.
Defined Under Namespace
Modules: ArrayProperty, BooleanProperty, KeyValueArrayProperty, SpaceDelimitedString, StringProperty, TargetedDeviceFamily
Instance Attribute Summary collapse
-
#always_search_user_paths ⇒ Object
Build Setting - “ALWAYS_SEARCH_USER_PATHS”.
-
#architectures ⇒ Object
Build Setting - “ARCHS”.
-
#c_language_standard ⇒ Object
Build Setting - “GCC_C_LANGUAGE_STANDARD” Usually set to gnu99.
-
#code_sign_identity ⇒ Object
Build Setting - “CODE_SIGN_IDENTITY”.
-
#copy_phase_strip ⇒ Object
Build Setting - “COPY_PHASE_STRIP”.
-
#dead_code_stripping ⇒ Object
Build Setting - “DEAD_CODE_STRIPPING”.
-
#debug_information_format ⇒ Object
Build Setting - “DEBUG_INFORMATION_FORMAT”.
-
#enable_objc_exceptions ⇒ Object
Build Setting - “GCC_ENABLE_OBJC_EXCEPTIONS”.
-
#gcc_version ⇒ Object
Build Setting - “GCC_VERSION”.
-
#generate_debugging_symbols ⇒ Object
Build Setting - “GCC_GENERATE_DEBUGGING_SYMBOLS”.
-
#info_plist_location ⇒ Object
Build Setting - “INFOPLIST_FILE”.
-
#install_path ⇒ Object
Build Setting - “INSTALL_PATH”.
-
#iphoneos_deployment_target ⇒ Object
Build Setting - “IPHONEOS_DEPLOYMENT_TARGET”.
-
#link_with_standard_libraries ⇒ Object
Build Setting - “LINK_WITH_STANDARD_LIBRARIES”.
-
#mach_o_type ⇒ Object
Build Setting - “MACH_O_TYPE”.
-
#macosx_deployment_target ⇒ Object
Build Setting - “MACOSX_DEPLOYMENT_TARGET”.
-
#other_c_flags ⇒ Object
Build Setting - “OTHER_CFLAGS”.
-
#other_linker_flags ⇒ Object
Build Setting - “OTHER_LDFLAGS”.
-
#precompile_prefix_headers ⇒ Object
Build Setting - “GCC_PRECOMPILE_PREFIX_HEADER”.
-
#prefix_header ⇒ Object
Build Setting - “GCC_PREFIX_HEADER”.
-
#product_name ⇒ Object
Build Setting - “PRODUCT_NAME”.
-
#sdkroot ⇒ Object
Build Setting - “SDKROOT”.
-
#supported_platforms ⇒ Object
Build Setting - “SUPPORTED_PLATFORMS”.
-
#target ⇒ Object
As configurations are defined within a target, this will return the target that owns this configuration through a build_configuration list.
-
#targeted_device_family ⇒ Object
Build Setting - “TARGETED_DEVICE_FAMILY”.
-
#user_header_search_paths ⇒ Object
Build Setting - “USER_HEADER_SEARCH_PATHS”.
-
#valid_architectures ⇒ Object
Build Setting - “VALID_ARCHS”.
-
#validate_product ⇒ Object
Build Setting - “VALIDATE_PRODUCT”.
-
#warn_64_to_32_bit_conversion ⇒ Object
Build Setting - “GCC_WARN_64_TO_32_BIT_CONVERSION”.
-
#warn_about_missing_prototypes ⇒ Object
Build Setting - “GCC_WARN_ABOUT_MISSING_PROTOTYPES” Defaults to YES.
-
#warn_about_missing_protoypes ⇒ Object
Build Setting - “GCC_WARN_ABOUT_MISSING_PROTOTYPES”.
-
#warn_about_return_type ⇒ Object
Build Setting - “GCC_WARN_ABOUT_MISSING_PROTOTYPES”.
-
#wrapper_extension ⇒ Object
Build Setting - “WRAPPER_EXTENSION”.
Class Method Summary collapse
-
.default_properties(name) ⇒ Hash
A large number of these default build settings properties for a configuration are as defined for Xcode 4.2.
-
.property(property_name, setting_name, type) ⇒ Object
This method will define getters/setters mapped to the build configuration.
- .setting_name_to_property(name) ⇒ Object
Instance Method Summary collapse
-
#append(name, value) ⇒ Object
Append a value to the the configuration value for the given name.
-
#builder ⇒ Builder
Create a builder for this given project->target->configuration.
-
#get(name) ⇒ String, ...
Retrieve the configuration value for the given name.
-
#info_plist {|info| ... } ⇒ Object
Opens the info plist associated with the configuration and allows you to edit the configuration.
-
#set(name, value) ⇒ Object
Set the configuration value for the given name.
Instance Attribute Details
#always_search_user_paths ⇒ Object
Build Setting - “ALWAYS_SEARCH_USER_PATHS”
207 |
# File 'lib/xcode/configuration.rb', line 207 property :always_search_user_paths, "ALWAYS_SEARCH_USER_PATHS", BooleanProperty |
#architectures ⇒ Object
Build Setting - “ARCHS”
217 |
# File 'lib/xcode/configuration.rb', line 217 property :architectures, "ARCHS", SpaceDelimitedString |
#c_language_standard ⇒ Object
Build Setting - “GCC_C_LANGUAGE_STANDARD” Usually set to gnu99
202 |
# File 'lib/xcode/configuration.rb', line 202 property :c_language_standard, "GCC_C_LANGUAGE_STANDARD", StringProperty |
#code_sign_identity ⇒ Object
Build Setting - “CODE_SIGN_IDENTITY”
232 |
# File 'lib/xcode/configuration.rb', line 232 property :code_sign_identity, "CODE_SIGN_IDENTITY[sdk=>iphoneos*]", StringProperty |
#copy_phase_strip ⇒ Object
Build Setting - “COPY_PHASE_STRIP”
248 |
# File 'lib/xcode/configuration.rb', line 248 property :copy_phase_strip, "COPY_PHASE_STRIP", BooleanProperty |
#dead_code_stripping ⇒ Object
Build Setting - “DEAD_CODE_STRIPPING”
258 |
# File 'lib/xcode/configuration.rb', line 258 property :dead_code_stripping, "DEAD_CODE_STRIPPING", BooleanProperty |
#debug_information_format ⇒ Object
Build Setting - “DEBUG_INFORMATION_FORMAT”
263 264 |
# File 'lib/xcode/configuration.rb', line 263 property :debug_information_format, "DEBUG_INFORMATION_FORMAT", EnumerationProperty.new('stabs','dwarf','dwarf-with-dsym') |
#enable_objc_exceptions ⇒ Object
Build Setting - “GCC_ENABLE_OBJC_EXCEPTIONS”
270 |
# File 'lib/xcode/configuration.rb', line 270 property :enable_objc_exceptions, "GCC_ENABLE_OBJC_EXCEPTIONS", BooleanProperty |
#gcc_version ⇒ Object
Build Setting - “GCC_VERSION”
212 |
# File 'lib/xcode/configuration.rb', line 212 property :gcc_version, "GCC_VERSION", StringProperty |
#generate_debugging_symbols ⇒ Object
Build Setting - “GCC_GENERATE_DEBUGGING_SYMBOLS”
275 |
# File 'lib/xcode/configuration.rb', line 275 property :generate_debugging_symbols, "GCC_GENERATE_DEBUGGING_SYMBOLS", BooleanProperty |
#info_plist_location ⇒ Object
Build Setting - “INFOPLIST_FILE”
177 |
# File 'lib/xcode/configuration.rb', line 177 property :info_plist_location, "INFOPLIST_FILE", StringProperty |
#install_path ⇒ Object
Build Setting - “INSTALL_PATH”
295 |
# File 'lib/xcode/configuration.rb', line 295 property :install_path, "INSTALL_PATH", StringProperty |
#iphoneos_deployment_target ⇒ Object
this should be a numeric scale from 2.0 through 5.0; at the levels specified in the documentation
Build Setting - “IPHONEOS_DEPLOYMENT_TARGET”
243 |
# File 'lib/xcode/configuration.rb', line 243 property :iphoneos_deployment_target, "IPHONEOS_DEPLOYMENT_TARGET", StringProperty |
#link_with_standard_libraries ⇒ Object
Build Setting - “LINK_WITH_STANDARD_LIBRARIES”
290 |
# File 'lib/xcode/configuration.rb', line 290 property :link_with_standard_libraries, "LINK_WITH_STANDARD_LIBRARIES", BooleanProperty |
#mach_o_type ⇒ Object
Build Setting - “MACH_O_TYPE”
300 301 |
# File 'lib/xcode/configuration.rb', line 300 property :mach_o_type, "MACH_O_TYPE", EnumerationProperty.new('mh_executable', 'mh_bundle', 'mh_object', 'mh_dylib', 'staticlib') |
#macosx_deployment_target ⇒ Object
Build Setting - “MACOSX_DEPLOYMENT_TARGET”
306 307 |
# File 'lib/xcode/configuration.rb', line 306 property :macosx_deployment_target, "MACOSX_DEPLOYMENT_TARGET", EnumerationProperty.new('10.7','10.6','10.5','10.4','10.3','10.2','10.1') |
#other_c_flags ⇒ Object
Build Setting - “OTHER_CFLAGS”
197 |
# File 'lib/xcode/configuration.rb', line 197 property :other_c_flags, "OTHER_CFLAGS", KeyValueArrayProperty |
#other_linker_flags ⇒ Object
Build Setting - “OTHER_LDFLAGS”
253 |
# File 'lib/xcode/configuration.rb', line 253 property :other_linker_flags, "OTHER_LDFLAGS", SpaceDelimitedString |
#precompile_prefix_headers ⇒ Object
Build Setting - “GCC_PRECOMPILE_PREFIX_HEADER”
167 |
# File 'lib/xcode/configuration.rb', line 167 property :precompile_prefix_headers, "GCC_PRECOMPILE_PREFIX_HEADER", BooleanProperty |
#prefix_header ⇒ Object
Build Setting - “GCC_PREFIX_HEADER”
172 |
# File 'lib/xcode/configuration.rb', line 172 property :prefix_header, "GCC_PREFIX_HEADER", StringProperty |
#product_name ⇒ Object
Build Setting - “PRODUCT_NAME”
158 |
# File 'lib/xcode/configuration.rb', line 158 property :product_name, "PRODUCT_NAME", StringProperty |
#sdkroot ⇒ Object
Build Setting - “SDKROOT”
192 |
# File 'lib/xcode/configuration.rb', line 192 property :sdkroot, "SDKROOT", StringProperty |
#supported_platforms ⇒ Object
Build Setting - “SUPPORTED_PLATFORMS”
162 |
# File 'lib/xcode/configuration.rb', line 162 property :supported_platforms, "SUPPORTED_PLATFORMS", SpaceDelimitedString |
#target ⇒ Object
As configurations are defined within a target, this will return the target that owns this configuration through a build_configuration list.
However, a build configuration list can also be defined at the project level which means target may likely be nil when viewing the configuration of the project.
154 155 156 |
# File 'lib/xcode/configuration.rb', line 154 def target @target end |
#targeted_device_family ⇒ Object
Build Setting - “TARGETED_DEVICE_FAMILY”
187 |
# File 'lib/xcode/configuration.rb', line 187 property :targeted_device_family, "TARGETED_DEVICE_FAMILY", TargetedDeviceFamily |
#user_header_search_paths ⇒ Object
Build Setting - “USER_HEADER_SEARCH_PATHS”
339 |
# File 'lib/xcode/configuration.rb', line 339 property :user_header_search_paths, "USER_HEADER_SEARCH_PATHS", SpaceDelimitedString |
#valid_architectures ⇒ Object
Build Setting - “VALID_ARCHS”
312 |
# File 'lib/xcode/configuration.rb', line 312 property :valid_architectures, "VALID_ARCHS", SpaceDelimitedString |
#validate_product ⇒ Object
Build Setting - “VALIDATE_PRODUCT”
237 |
# File 'lib/xcode/configuration.rb', line 237 property :validate_product, "VALIDATE_PRODUCT", BooleanProperty |
#warn_64_to_32_bit_conversion ⇒ Object
Build Setting - “GCC_WARN_64_TO_32_BIT_CONVERSION”
280 |
# File 'lib/xcode/configuration.rb', line 280 property :warn_64_to_32_bit_conversion, "GCC_WARN_64_TO_32_BIT_CONVERSION", BooleanProperty |
#warn_about_missing_prototypes ⇒ Object
Build Setting - “GCC_WARN_ABOUT_MISSING_PROTOTYPES” Defaults to YES
222 |
# File 'lib/xcode/configuration.rb', line 222 property :warn_about_missing_prototypes, "GCC_WARN_ABOUT_MISSING_PROTOTYPES", BooleanProperty |
#warn_about_missing_protoypes ⇒ Object
Build Setting - “GCC_WARN_ABOUT_MISSING_PROTOTYPES”
285 |
# File 'lib/xcode/configuration.rb', line 285 property :warn_about_missing_protoypes, "GCC_WARN_ABOUT_MISSING_PROTOTYPES", BooleanProperty |
#warn_about_return_type ⇒ Object
Build Setting - “GCC_WARN_ABOUT_MISSING_PROTOTYPES”
227 |
# File 'lib/xcode/configuration.rb', line 227 property :warn_about_return_type, "GCC_WARN_ABOUT_RETURN_TYPE", BooleanProperty |
#wrapper_extension ⇒ Object
Build Setting - “WRAPPER_EXTENSION”
182 |
# File 'lib/xcode/configuration.rb', line 182 property :wrapper_extension, "WRAPPER_EXTENSION", StringProperty |
Class Method Details
.default_properties(name) ⇒ Hash
remove the name requirement and replace all these configuration settings with the smaller subset. As a lot of these are usually maintained by the project
A large number of these default build settings properties for a configuration are as defined for Xcode 4.2.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/xcode/configuration.rb', line 49 def self.default_properties(name) { 'isa' => 'XCBuildConfiguration', 'buildSettings' => { "SDKROOT" => "iphoneos", "OTHER_CFLAGS" => "-DNS_BLOCK_ASSERTIONS=1", "TARGETED_DEVICE_FAMILY" => "1,2", "GCC_C_LANGUAGE_STANDARD" => "gnu99", "ALWAYS_SEARCH_USER_PATHS" => "NO", "GCC_VERSION" => "com.apple.compilers.llvm.clang.1_0", "ARCHS" => "$(ARCHS_STANDARD_32_BIT)", "GCC_WARN_ABOUT_MISSING_PROTOTYPES" => "YES", "GCC_WARN_ABOUT_RETURN_TYPE" => "YES", "CODE_SIGN_IDENTITY[sdk=>iphoneos*]" => "iPhone Developer", "GCC_PRECOMPILE_PREFIX_HEADER" => "YES", "VALIDATE_PRODUCT" => "YES", "IPHONEOS_DEPLOYMENT_TARGET" => "5.0", "COPY_PHASE_STRIP" => "YES", "GCC_PREFIX_HEADER" => "#{name}/#{name}-Prefix.pch", "INFOPLIST_FILE" => "#{name}/#{name}-Info.plist", "PRODUCT_NAME" => "$(TARGET_NAME)", "WRAPPER_EXTENSION" => "app" }, "name" => name } end |
.property(property_name, setting_name, type) ⇒ Object
This method will define getters/setters mapped to the build configuration.
This allows for dynamic values to be saved and loaded by allowing a parsing process to take place on the loaded value and when saving back to the value.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/xcode/configuration.rb', line 84 def self.property(property_name,setting_name,type) # Define a getter method define_method property_name do # When the build setting is missing from the existing configuration, look # for the configuration of the target's project (only if we are currently # at the Target level). if not build_settings.key?(setting_name) and target.is_a?(Target) project_config = target.project.global_config(name) project_config.send(property_name) else substitute type.open(build_settings[setting_name]) end end # Define a setter method define_method "#{property_name}=" do |value| build_settings[setting_name] = unsubstitute(type.save(value)) end # Define an append method define_method "append_to_#{property_name}" do |value| build_settings[setting_name] = unsubstitute type.append(build_settings[setting_name],value) end # Define a environment name method (to return the settings name) define_method "env_#{property_name}" do setting_name end # Define a raw getter define_method "raw_#{property_name}" do build_settings[setting_name] end # Define a raw setter define_method "raw_#{property_name}=" do |value| build_settings[setting_name] = value end @setting_name_to_property = {} unless @setting_name_to_property @setting_name_to_property[setting_name] = property_name end |
.setting_name_to_property(name) ⇒ Object
139 140 141 |
# File 'lib/xcode/configuration.rb', line 139 def self.setting_name_to_property(name) @setting_name_to_property[name] end |
Instance Method Details
#append(name, value) ⇒ Object
Append a value to the the configuration value for the given name
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/xcode/configuration.rb', line 379 def append(name, value) if respond_to?(name) send("append_to_#{name}",value) elsif Configuration.setting_name_to_property(name) send("append_to_#{Configuration.setting_name_to_property(name)}",value) else # @note this will likely raise some errors if trying to append a booleans # to fixnums, strings to booleans, symbols + arrays, etc. but that likely # means a new property should be defined so that the appending logic # wil behave correctly. if build_settings[name].is_a?(Array) # Ensure that we are appending an array to the array; Array() does not # work in this case in the event we were to pass in a Hash. value = value.is_a?(Array) ? value : [ value ] build_settings[name] = build_settings[name] + value.compact else # Ensure we handle the cases where a nil value is present that we append # correctly to the value. We also need to try and leave intact boolean # values which may be stored value = "" unless value build_settings[name] = "" unless build_settings[name] build_settings[name] = build_settings[name] + value end end end |
#builder ⇒ Builder
Create a builder for this given project->target->configuration.
420 421 422 |
# File 'lib/xcode/configuration.rb', line 420 def builder Xcode::Builder::ProjectTargetConfigBuilder.new(@target, self) end |
#get(name) ⇒ String, ...
Retrieve the configuration value for the given name
347 348 349 350 351 352 353 354 355 |
# File 'lib/xcode/configuration.rb', line 347 def get(name) if respond_to?(name) send(name) elsif Configuration.setting_name_to_property(name) send Configuration.setting_name_to_property(name) else build_settings[name] end end |
#info_plist {|info| ... } ⇒ Object
Opens the info plist associated with the configuration and allows you to edit the configuration.
329 330 331 332 333 334 |
# File 'lib/xcode/configuration.rb', line 329 def info_plist info = Xcode::InfoPlist.new(self, info_plist_location) yield info if block_given? info.save info end |
#set(name, value) ⇒ Object
Set the configuration value for the given name
363 364 365 366 367 368 369 370 371 |
# File 'lib/xcode/configuration.rb', line 363 def set(name, value) if respond_to?(name) send("#{name}=",value) elsif Configuration.setting_name_to_property(name) send("#{Configuration.setting_name_to_property(name)}=",value) else build_settings[name] = value end end |