xcodeproj 0.20.2 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c012d924f60d9d52ed4d9c5f386a4363e76665ad
4
- data.tar.gz: 9a710ff3e852c7d84d1a184741e2349eaeb63593
3
+ metadata.gz: b25b3f5efcf355937e6da83fa11ae3a2e8fb8bcc
4
+ data.tar.gz: 7c6ea2172930b5404dadb6b0126fe00715eff67f
5
5
  SHA512:
6
- metadata.gz: f17bcfd4a22838b71149810dcc3c8a235793807a0a245325e4960467b29dee3a5524739429c4890b090eb64fa527537736dbcc26f58e24a0706af270f0c42dfd
7
- data.tar.gz: 4eec675ec32c2bdfae60eea97eaa4b1b90c51dc9e2772d225865799109e7f7f49caffd94917a904e62c389b4c8caacb928df9c0b8c4c85855397501252e7979e
6
+ metadata.gz: ad2bda26f91fd33dad783add7c92e4059165f475fe3d940bd50a0b05e9d02099aa092203812bf21fbb49556cd8e9d044d01dc4e795f1e7a55f815d86ae6547eb
7
+ data.tar.gz: d7c68cb7602a0f40f41ae5ae36b0536bf9fe55e86cd4e504f7b53baabb1f89a72f0362331e09591c459aebe539829777705c589c9130bae064bffb0b9dee1830
@@ -2,6 +2,7 @@ module Xcodeproj
2
2
  require 'colored'
3
3
 
4
4
  class Command
5
+ autoload :ConfigDump, 'xcodeproj/command/config_dump'
5
6
  autoload :TargetDiff, 'xcodeproj/command/target_diff'
6
7
  autoload :ProjectDiff, 'xcodeproj/command/project_diff'
7
8
  autoload :Show, 'xcodeproj/command/show'
@@ -56,7 +57,7 @@ module Xcodeproj
56
57
  end
57
58
 
58
59
  def self.banner
59
- commands = ['target-diff', 'project-diff', 'show', 'sort']
60
+ commands = ['config-dump', 'target-diff', 'project-diff', 'show', 'sort']
60
61
  banner = "To see help for the available commands run:\n\n"
61
62
  banner + commands.map { |cmd| " * $ xcodeproj #{cmd.green} --help" }.join("\n")
62
63
  end
@@ -101,6 +102,7 @@ module Xcodeproj
101
102
  String.send(:define_method, :colorize) { |string, _| string } if argv.option('--no-color')
102
103
 
103
104
  command_class = case command_argument = argv.shift_argument
105
+ when 'config-dump' then ConfigDump
104
106
  when 'target-diff' then TargetDiff
105
107
  when 'project-diff' then ProjectDiff
106
108
  when 'show' then Show
@@ -0,0 +1,78 @@
1
+ module Xcodeproj
2
+ class Command
3
+ class ConfigDump < Command
4
+ def self.banner
5
+ <<-eos.strip_heredoc
6
+ Dumps the build settings of all project targets for all configurations in
7
+ directories named by the target in given output directory.
8
+
9
+ $ config-dump PROJECT OUTPUT
10
+
11
+ It extracts common build settings in a per target base.xcconfig file.
12
+ If no `PROJECT` is specified then the current work directory is searched
13
+ for one.
14
+ If no `OUTPUT` is specified then the project directory will be used.%)
15
+ eos
16
+ end
17
+
18
+ def initialize(argv)
19
+ xcodeproj_path = argv.shift_argument
20
+ @xcodeproj_path = File.expand_path(xcodeproj_path) if xcodeproj_path
21
+
22
+ @output_path = Pathname(argv.shift_argument || '.')
23
+ unless @output_path.directory?
24
+ raise Informative, 'The output path must be a directory.'
25
+ end
26
+
27
+ super unless argv.empty?
28
+ end
29
+
30
+ def run
31
+ dump_all_configs(xcodeproj, 'Project')
32
+
33
+ xcodeproj.targets.each do |target|
34
+ dump_all_configs(target, target.name)
35
+ end
36
+ end
37
+
38
+ def dump_all_configs(configurable, name)
39
+ path = Pathname(name)
40
+
41
+ # Dump base configuration to file
42
+ base_settings = extract_common_settings!(configurable.build_configurations)
43
+ base_file_path = path + "#{name}_base.xcconfig"
44
+ dump_config_to_file(base_settings, base_file_path)
45
+
46
+ # Dump each configuration to file
47
+ configurable.build_configurations.each do |config|
48
+ settings = config.build_settings
49
+ dump_config_to_file(settings, path + "#{name}_#{config.name.downcase}.xcconfig", [base_file_path])
50
+ end
51
+ end
52
+
53
+ def extract_common_settings!(build_configurations)
54
+ # Grasp all common build settings
55
+ all_build_settings = build_configurations.map(&:build_settings)
56
+ common_build_settings = all_build_settings.reduce do |settings, config_build_settings|
57
+ settings.select { |key, value| value == config_build_settings[key] }
58
+ end
59
+
60
+ # Remove all common build settings from each configuration specific build settings
61
+ build_configurations.each do |config|
62
+ config.build_settings.reject! { |key| !common_build_settings[key].nil? }
63
+ end
64
+
65
+ common_build_settings
66
+ end
67
+
68
+ def dump_config_to_file(settings, file_path, includes = [])
69
+ dir = @output_path + file_path + '..'
70
+ dir.mkdir unless dir.exist?
71
+
72
+ config = Config.new(settings)
73
+ config.includes = includes
74
+ config.save_as(@output_path + file_path)
75
+ end
76
+ end
77
+ end
78
+ end
@@ -8,6 +8,25 @@ module Xcodeproj
8
8
  class Config
9
9
  require 'set'
10
10
 
11
+ KEY_VALUE_PATTERN = /
12
+ (
13
+ [^=]+ # Any char, but not an assignment operator (non-greedy)
14
+ (?: # One or multiple conditional subscripts
15
+ \[
16
+ [^\]]* # The subscript key
17
+ (?:
18
+ = # The subscript comparison operator
19
+ [^\]]* # The subscript value
20
+ )?
21
+ \]
22
+ )*
23
+ )
24
+ \s+ # Whitespaces after the key (needed because subscripts
25
+ # always end with ']')
26
+ = # The assignment operator
27
+ (.*) # The value
28
+ /x
29
+
11
30
  # @return [Hash{String => String}] The attributes of the settings file
12
31
  # excluding frameworks, weak_framework and libraries.
13
32
  #
@@ -294,8 +313,9 @@ module Xcodeproj
294
313
  # entry is the value.
295
314
  #
296
315
  def extract_key_value(line)
297
- key, value = line.split('=', 2)
298
- if key && value
316
+ match = line.match(KEY_VALUE_PATTERN)
317
+ if match
318
+ key, value = match[1], match[2]
299
319
  [key.strip, value.strip]
300
320
  else
301
321
  []
@@ -112,49 +112,96 @@ module Xcodeproj
112
112
  #
113
113
  COMMON_BUILD_SETTINGS = {
114
114
  :all => {
115
- 'GCC_PRECOMPILE_PREFIX_HEADER' => 'YES',
116
115
  'PRODUCT_NAME' => '$(TARGET_NAME)',
117
- 'SKIP_INSTALL' => 'YES',
118
- 'DSTROOT' => '/tmp/xcodeproj.dst',
119
- 'ALWAYS_SEARCH_USER_PATHS' => 'NO',
120
- 'INSTALL_PATH' => '$(BUILT_PRODUCTS_DIR)',
121
- 'OTHER_LDFLAGS' => '',
122
- 'COPY_PHASE_STRIP' => 'YES',
116
+ 'ENABLE_STRICT_OBJC_MSGSEND' => 'YES',
123
117
  }.freeze,
124
- :debug => {
125
- 'GCC_DYNAMIC_NO_PIC' => 'NO',
126
- 'GCC_PREPROCESSOR_DEFINITIONS' => ['DEBUG=1', '$(inherited)'],
127
- 'GCC_SYMBOLS_PRIVATE_EXTERN' => 'NO',
128
- 'GCC_OPTIMIZATION_LEVEL' => '0',
129
- 'COPY_PHASE_STRIP' => 'NO',
118
+ [:debug] => {
119
+ 'MTL_ENABLE_DEBUG_INFO' => 'YES',
130
120
  }.freeze,
131
- :release => {
132
- 'OTHER_CFLAGS' => ['-DNS_BLOCK_ASSERTIONS=1', '$(inherited)'],
133
- 'OTHER_CPLUSPLUSFLAGS' => ['-DNS_BLOCK_ASSERTIONS=1', '$(inherited)'],
121
+ [:release] => {
122
+ 'MTL_ENABLE_DEBUG_INFO' => 'NO',
134
123
  }.freeze,
135
- :ios => {
136
- 'IPHONEOS_DEPLOYMENT_TARGET' => '4.3',
137
- 'PUBLIC_HEADERS_FOLDER_PATH' => '$(TARGET_NAME)',
124
+ [:ios] => {
138
125
  'SDKROOT' => 'iphoneos',
139
126
  }.freeze,
140
- :osx => {
141
- 'GCC_ENABLE_OBJC_EXCEPTIONS' => 'YES',
142
- 'GCC_VERSION' => 'com.apple.compilers.llvm.clang.1_0',
143
- 'MACOSX_DEPLOYMENT_TARGET' => '10.7',
127
+ [:osx] => {
144
128
  'SDKROOT' => 'macosx',
145
- 'COMBINE_HIDPI_IMAGES' => 'YES',
146
129
  }.freeze,
147
- [:osx, :debug] => {
130
+ [:debug, :osx] => {
148
131
  # Empty?
149
132
  }.freeze,
150
- [:osx, :release] => {
133
+ [:release, :osx] => {
151
134
  'DEBUG_INFORMATION_FORMAT' => 'dwarf-with-dsym',
152
135
  }.freeze,
153
- [:ios, :debug] => {
136
+ [:debug, :ios] => {
154
137
  # Empty?
155
138
  }.freeze,
156
- [:ios, :release] => {
157
- 'VALIDATE_PRODUCT' => 'YES',
139
+ [:debug, :application, :swift] => {
140
+ 'SWIFT_OPTIMIZATION_LEVEL' => '-Onone',
141
+ }.freeze,
142
+ [:framework] => {
143
+ 'VERSION_INFO_PREFIX' => '',
144
+ 'DYLIB_COMPATIBILITY_VERSION' => '1',
145
+ 'DEFINES_MODULE' => 'YES',
146
+ 'DYLIB_INSTALL_NAME_BASE' => '@rpath',
147
+ 'CURRENT_PROJECT_VERSION' => '1',
148
+ 'VERSIONING_SYSTEM' => 'apple-generic',
149
+ 'DYLIB_CURRENT_VERSION' => '1',
150
+ 'SKIP_INSTALL' => 'YES',
151
+ 'INSTALL_PATH' => '$(LOCAL_LIBRARY_DIR)/Frameworks',
152
+ }.freeze,
153
+ [:ios, :framework] => {
154
+ 'LD_RUNPATH_SEARCH_PATHS' => ['$(inherited)', '@executable_path/Frameworks', '@loader_path/Frameworks'],
155
+ 'CODE_SIGN_IDENTITY[sdk=iphoneos*]' => 'iPhone Developer',
156
+ 'TARGETED_DEVICE_FAMILY' => '1,2',
157
+ }.freeze,
158
+ [:osx, :framework] => {
159
+ 'LD_RUNPATH_SEARCH_PATHS' => ['$(inherited)', '@executable_path/../Frameworks', '@loader_path/Frameworks'],
160
+ 'FRAMEWORK_VERSION' => 'A',
161
+ 'COMBINE_HIDPI_IMAGES' => 'YES',
162
+ }.freeze,
163
+ [:framework, :swift] => {
164
+ 'DEFINES_MODULE' => 'YES',
165
+ }.freeze,
166
+ [:debug, :framework, :swift] => {
167
+ 'SWIFT_OPTIMIZATION_LEVEL' => '-Onone',
168
+ }.freeze,
169
+ [:osx, :static_library] => {
170
+ 'EXECUTABLE_PREFIX' => 'lib',
171
+ }.freeze,
172
+ [:ios, :static_library] => {
173
+ 'OTHER_LDFLAGS' => '-ObjC',
174
+ 'SKIP_INSTALL' => 'YES',
175
+ }.freeze,
176
+ [:osx, :dynamic_library] => {
177
+ 'EXECUTABLE_PREFIX' => 'lib',
178
+ 'DYLIB_COMPATIBILITY_VERSION' => '1',
179
+ 'DYLIB_CURRENT_VERSION' => '1',
180
+ }.freeze,
181
+ [:application] => {
182
+ 'ASSETCATALOG_COMPILER_APPICON_NAME' => 'AppIcon',
183
+ }.freeze,
184
+ [:ios, :application] => {
185
+ 'CODE_SIGN_IDENTITY[sdk=iphoneos*]' => 'iPhone Developer',
186
+ 'LD_RUNPATH_SEARCH_PATHS' => ['$(inherited)', '@executable_path/Frameworks'],
187
+ }.freeze,
188
+ [:osx, :application] => {
189
+ 'COMBINE_HIDPI_IMAGES' => 'YES',
190
+ 'CODE_SIGN_IDENTITY' => '-',
191
+ 'LD_RUNPATH_SEARCH_PATHS' => ['$(inherited)', '@executable_path/../Frameworks'],
192
+ }.freeze,
193
+ [:bundle] => {
194
+ 'PRODUCT_NAME' => '$(TARGET_NAME)',
195
+ 'WRAPPER_EXTENSION' => 'bundle',
196
+ 'SKIP_INSTALL' => 'YES',
197
+ }.freeze,
198
+ [:ios, :bundle] => {
199
+ 'SDKROOT' => 'iphoneos',
200
+ }.freeze,
201
+ [:osx, :bundle] => {
202
+ 'COMBINE_HIDPI_IMAGES' => 'YES',
203
+ 'SDKROOT' => 'macosx',
204
+ 'INSTALL_PATH' => '$(LOCAL_LIBRARY_DIR)/Bundles',
158
205
  }.freeze,
159
206
  }.freeze
160
207
 
@@ -162,38 +209,40 @@ module Xcodeproj
162
209
  #
163
210
  PROJECT_DEFAULT_BUILD_SETTINGS = {
164
211
  :all => {
165
- 'ALWAYS_SEARCH_USER_PATHS' => 'NO',
166
- 'CLANG_CXX_LANGUAGE_STANDARD' => 'gnu++0x',
167
- 'CLANG_CXX_LIBRARY' => 'libc++',
168
- 'CLANG_ENABLE_OBJC_ARC' => 'YES',
169
- 'CLANG_WARN_BOOL_CONVERSION' => 'YES',
170
- 'CLANG_WARN_CONSTANT_CONVERSION' => 'YES',
171
- 'CLANG_WARN_DIRECT_OBJC_ISA_USAGE' => 'YES',
172
- 'CLANG_WARN_EMPTY_BODY' => 'YES',
173
- 'CLANG_WARN_ENUM_CONVERSION' => 'YES',
174
- 'CLANG_WARN_INT_CONVERSION' => 'YES',
175
- 'CLANG_WARN_OBJC_ROOT_CLASS' => 'YES',
176
- 'CLANG_ENABLE_MODULES' => 'YES',
177
- 'GCC_C_LANGUAGE_STANDARD' => 'gnu99',
178
- 'GCC_WARN_64_TO_32_BIT_CONVERSION' => 'YES',
179
- 'GCC_WARN_ABOUT_RETURN_TYPE' => 'YES',
180
- 'GCC_WARN_UNDECLARED_SELECTOR' => 'YES',
181
- 'GCC_WARN_UNINITIALIZED_AUTOS' => 'YES',
182
- 'GCC_WARN_UNUSED_FUNCTION' => 'YES',
183
- 'GCC_WARN_UNUSED_VARIABLE' => 'YES',
212
+ 'ALWAYS_SEARCH_USER_PATHS' => 'NO',
213
+ 'CLANG_CXX_LANGUAGE_STANDARD' => 'gnu++0x',
214
+ 'CLANG_CXX_LIBRARY' => 'libc++',
215
+ 'CLANG_ENABLE_OBJC_ARC' => 'YES',
216
+ 'CLANG_WARN_BOOL_CONVERSION' => 'YES',
217
+ 'CLANG_WARN_CONSTANT_CONVERSION' => 'YES',
218
+ 'CLANG_WARN_DIRECT_OBJC_ISA_USAGE' => 'YES',
219
+ 'CLANG_WARN__DUPLICATE_METHOD_MATCH' => 'YES',
220
+ 'CLANG_WARN_EMPTY_BODY' => 'YES',
221
+ 'CLANG_WARN_ENUM_CONVERSION' => 'YES',
222
+ 'CLANG_WARN_INT_CONVERSION' => 'YES',
223
+ 'CLANG_WARN_OBJC_ROOT_CLASS' => 'YES',
224
+ 'CLANG_WARN_UNREACHABLE_CODE' => 'YES',
225
+ 'CLANG_ENABLE_MODULES' => 'YES',
226
+ 'GCC_C_LANGUAGE_STANDARD' => 'gnu99',
227
+ 'GCC_WARN_64_TO_32_BIT_CONVERSION' => 'YES',
228
+ 'GCC_WARN_ABOUT_RETURN_TYPE' => 'YES',
229
+ 'GCC_WARN_UNDECLARED_SELECTOR' => 'YES',
230
+ 'GCC_WARN_UNINITIALIZED_AUTOS' => 'YES',
231
+ 'GCC_WARN_UNUSED_FUNCTION' => 'YES',
232
+ 'GCC_WARN_UNUSED_VARIABLE' => 'YES',
184
233
  },
185
234
  :release => {
186
- 'COPY_PHASE_STRIP' => 'NO',
187
- 'ENABLE_NS_ASSERTIONS' => 'NO',
188
- 'VALIDATE_PRODUCT' => 'YES',
235
+ 'COPY_PHASE_STRIP' => 'NO',
236
+ 'ENABLE_NS_ASSERTIONS' => 'NO',
237
+ 'VALIDATE_PRODUCT' => 'YES',
189
238
  }.freeze,
190
239
  :debug => {
191
- 'ONLY_ACTIVE_ARCH' => 'YES',
192
- 'COPY_PHASE_STRIP' => 'YES',
193
- 'GCC_DYNAMIC_NO_PIC' => 'NO',
194
- 'GCC_OPTIMIZATION_LEVEL' => '0',
195
- 'GCC_PREPROCESSOR_DEFINITIONS' => ['DEBUG=1', '$(inherited)'],
196
- 'GCC_SYMBOLS_PRIVATE_EXTERN' => 'NO',
240
+ 'ONLY_ACTIVE_ARCH' => 'YES',
241
+ 'COPY_PHASE_STRIP' => 'YES',
242
+ 'GCC_DYNAMIC_NO_PIC' => 'NO',
243
+ 'GCC_OPTIMIZATION_LEVEL' => '0',
244
+ 'GCC_PREPROCESSOR_DEFINITIONS' => ['DEBUG=1', '$(inherited)'],
245
+ 'GCC_SYMBOLS_PRIVATE_EXTERN' => 'NO',
197
246
  }.freeze,
198
247
  }.freeze
199
248
 
@@ -1,5 +1,5 @@
1
1
  module Xcodeproj
2
2
  # The version of the xcodeproj gem.
3
3
  #
4
- VERSION = '0.20.2' unless defined? Xcodeproj::VERSION
4
+ VERSION = '0.21.0' unless defined? Xcodeproj::VERSION
5
5
  end
@@ -600,8 +600,8 @@ module Xcodeproj
600
600
  # Frameworks phase.
601
601
  #
602
602
  # @param [Symbol] type
603
- # the type of target. Can be `:application`, `:dynamic_library` or
604
- # `:static_library`.
603
+ # the type of target. Can be `:application`, `:framework`,
604
+ # `:dynamic_library` or `:static_library`.
605
605
  #
606
606
  # @param [String] name
607
607
  # the name of the target product.
@@ -285,7 +285,6 @@ module Xcodeproj
285
285
  #
286
286
  def add_system_framework(names)
287
287
  Array(names).each do |name|
288
-
289
288
  case platform_name
290
289
  when :ios
291
290
  group = project.frameworks_group['iOS'] || project.frameworks_group.new_group('iOS')
@@ -20,8 +20,8 @@ module Xcodeproj
20
20
  # the project to which the target should be added.
21
21
  #
22
22
  # @param [Symbol] type
23
- # the type of target. Can be `:application`, `:dynamic_library` or
24
- # `:static_library`.
23
+ # the type of target. Can be `:application`, `:dynamic_library`,
24
+ # `framework` or `:static_library`.
25
25
  #
26
26
  # @param [String] name
27
27
  # the name of the target product.
@@ -32,6 +32,10 @@ module Xcodeproj
32
32
  # @param [String] deployment_target
33
33
  # the deployment target for the platform.
34
34
  #
35
+ # @param [PBXGroup] product_group
36
+ # the product group, where to add to a file reference of the
37
+ # created target.
38
+ #
35
39
  # @return [PBXNativeTarget] the target.
36
40
  #
37
41
  def self.new_target(project, type, name, platform, deployment_target, product_group)
@@ -41,7 +45,7 @@ module Xcodeproj
41
45
  target.name = name
42
46
  target.product_name = name
43
47
  target.product_type = Constants::PRODUCT_TYPE_UTI[type]
44
- target.build_configuration_list = configuration_list(project, platform, deployment_target)
48
+ target.build_configuration_list = configuration_list(project, platform, deployment_target, type)
45
49
 
46
50
  # Product
47
51
  product = product_group.new_product_ref_for_target(name, type)
@@ -74,6 +78,10 @@ module Xcodeproj
74
78
  # @param [Symbol] platform
75
79
  # the platform of the resources bundle. Can be `:ios` or `:osx`.
76
80
  #
81
+ # @param [PBXGroup] product_group
82
+ # the product group, where to add to a file reference of the
83
+ # created target.
84
+ #
77
85
  # @return [PBXNativeTarget] the target.
78
86
  #
79
87
  def self.new_resources_bundle(project, name, platform, product_group)
@@ -128,20 +136,24 @@ module Xcodeproj
128
136
  # @param [String] deployment_target
129
137
  # the deployment target for the platform.
130
138
  #
139
+ # @param [Symbol] target_product_type
140
+ # the product type of the target, can be any of `Constants::PRODUCT_TYPE_UTI.values`
141
+ # or `Constants::PRODUCT_TYPE_UTI.keys`.
142
+ #
131
143
  # @return [XCConfigurationList] the generated configuration list.
132
144
  #
133
- def self.configuration_list(project, platform, deployment_target = nil)
145
+ def self.configuration_list(project, platform, deployment_target = nil, target_product_type)
134
146
  cl = project.new(XCConfigurationList)
135
147
  cl.default_configuration_is_visible = '0'
136
148
  cl.default_configuration_name = 'Release'
137
149
 
138
150
  release_conf = project.new(XCBuildConfiguration)
139
151
  release_conf.name = 'Release'
140
- release_conf.build_settings = common_build_settings(:release, platform, deployment_target)
152
+ release_conf.build_settings = common_build_settings(:release, platform, deployment_target, target_product_type)
141
153
 
142
154
  debug_conf = project.new(XCBuildConfiguration)
143
155
  debug_conf.name = 'Debug'
144
- debug_conf.build_settings = common_build_settings(:debug, platform, deployment_target)
156
+ debug_conf.build_settings = common_build_settings(:debug, platform, deployment_target, target_product_type)
145
157
 
146
158
  cl.build_configurations << release_conf
147
159
  cl.build_configurations << debug_conf
@@ -161,38 +173,39 @@ module Xcodeproj
161
173
  # @param [String] deployment_target
162
174
  # the deployment target for the platform.
163
175
  #
176
+ # @param [Symbol] target_product_type
177
+ # the product type of the target, can be any of
178
+ # `Constants::PRODUCT_TYPE_UTI.values`
179
+ # or `Constants::PRODUCT_TYPE_UTI.keys`. Default is :application.
180
+ #
181
+ # @param [Symbol] language
182
+ # the primary language of the target, can be `:objc` or `:swift`.
183
+ #
164
184
  # @return [Hash] The common build settings
165
185
  #
166
- def self.common_build_settings(type, platform, deployment_target = nil, target_product_type = nil)
167
- if target_product_type == Constants::PRODUCT_TYPE_UTI[:bundle]
168
- build_settings = {
169
- 'PRODUCT_NAME' => '$(TARGET_NAME)',
170
- 'WRAPPER_EXTENSION' => 'bundle',
171
- 'SKIP_INSTALL' => 'YES',
172
- }
173
-
174
- if platform == :osx
175
- build_settings['COMBINE_HIDPI_IMAGES'] = 'YES'
176
- build_settings['SDKROOT'] = 'macosx'
177
- else
178
- build_settings['SDKROOT'] = 'iphoneos'
179
- end
180
- build_settings
181
- else
182
- common_settings = Constants::COMMON_BUILD_SETTINGS
183
- settings = deep_dup(common_settings[:all])
184
- settings.merge!(deep_dup(common_settings[type]))
185
- settings.merge!(deep_dup(common_settings[platform]))
186
- settings.merge!(deep_dup(common_settings[[platform, type]]))
187
- if deployment_target
188
- if platform == :ios
189
- settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target
190
- elsif platform == :osx
191
- settings['MACOSX_DEPLOYMENT_TARGET'] = deployment_target
192
- end
186
+ def self.common_build_settings(type, platform, deployment_target = nil, target_product_type = nil, language = :objc)
187
+ target_product_type = (Constants::PRODUCT_TYPE_UTI.find { |_, v| v == target_product_type } || [target_product_type || :application])[0]
188
+ common_settings = Constants::COMMON_BUILD_SETTINGS
189
+
190
+ # Use intersecting settings for all key sets as base
191
+ settings = deep_dup(common_settings[:all])
192
+
193
+ # Match further common settings by key sets
194
+ keys = [type, platform, target_product_type, language].compact
195
+ key_combinations = (1..keys.length).flat_map { |n| keys.combination(n).to_a }
196
+ key_combinations.each do |key_combination|
197
+ settings.merge!(deep_dup(common_settings[key_combination] || {}))
198
+ end
199
+
200
+ if deployment_target
201
+ if platform == :ios
202
+ settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target
203
+ elsif platform == :osx
204
+ settings['MACOSX_DEPLOYMENT_TARGET'] = deployment_target
193
205
  end
194
- settings
195
206
  end
207
+
208
+ settings
196
209
  end
197
210
 
198
211
  # Creates a deep copy of the given object
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcodeproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.2
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-15 00:00:00.000000000 Z
11
+ date: 2014-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -49,6 +49,7 @@ extra_rdoc_files: []
49
49
  files:
50
50
  - README.md
51
51
  - LICENSE
52
+ - lib/xcodeproj/command/config_dump.rb
52
53
  - lib/xcodeproj/command/project_diff.rb
53
54
  - lib/xcodeproj/command/show.rb
54
55
  - lib/xcodeproj/command/sort.rb