xcodeproj 1.10.0 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c97e1a1e73c9358014593b72f840b6f82f0560c525aee2a98f11a482bac7887
4
- data.tar.gz: 35f3b030a485fadcb4d65a5f949805d29ef94f66815b72578485a74993a01135
3
+ metadata.gz: 72f6eb6645b557dea09ae4be0fd400e48b0d4f1e42c31b7b61af87fd3c31a9cd
4
+ data.tar.gz: 0c0bcfa7abc28721f61f48e295198da53576e90d62161c50a6cc7333c1e94455
5
5
  SHA512:
6
- metadata.gz: d782cfd8c7f9b80303a100d277969c69738a037d8d86388292c5fd84a443686100f7a18681d68752fa1abae946714ef4dd413e957de14ae6488f2fa0c6bd3de6
7
- data.tar.gz: 12ec3dbcee3d913fc1b92bef15a6f65a1ff90866bd92295eb674574de9db3b234e79cba17fc8d8f6c4d4ddb1188d46894f0483be25e25fa217c6cbc750890b5d
6
+ metadata.gz: 4f856d8cbee5b9b7b6bcbe7acce4034e8277fd05ac7caf0d2c317f75d622bb5c518dd2ddee67dac1c6a7fb2773aebb5a5de2cf2232af3fffc2353323fd08623d
7
+ data.tar.gz: 9cf088a34dea380b56716f005c35fc601d9b193a0a4908556d4f8ccc80408ee328755ccb767dc0ed50adc0bc3e822cc9bcdcdeac405c97fc514f6dd429f746ac
@@ -76,7 +76,11 @@ module Xcodeproj
76
76
 
77
77
  def dump_config_to_file(settings, file_path, includes = [])
78
78
  dir = @output_path + file_path + '..'
79
- dir.mkdir unless dir.exist?
79
+ dir.mkpath
80
+
81
+ settings = Hash[settings.map do |k, v|
82
+ [k, Array(v).join(' ')]
83
+ end]
80
84
 
81
85
  config = Config.new(settings)
82
86
  config.includes = includes
@@ -157,6 +157,8 @@ module Xcodeproj
157
157
  end
158
158
  end
159
159
 
160
+ alias_method :to_h, :to_hash
161
+
160
162
  # @return [Set<String>] The list of the frameworks required by this
161
163
  # settings file.
162
164
  #
@@ -55,13 +55,13 @@ module Xcodeproj
55
55
  # The other linker flags value.
56
56
  #
57
57
  def self.split(flags)
58
- flags.strip.shellsplit.map do |string|
58
+ flags.strip.shellsplit.flat_map do |string|
59
59
  if string =~ /\A-l.+/
60
60
  ['-l', string[2..-1]]
61
61
  else
62
62
  string
63
63
  end
64
- end.flatten
64
+ end
65
65
  end
66
66
  end
67
67
  end
@@ -4,19 +4,19 @@ module Xcodeproj
4
4
  module Constants
5
5
  # @return [String] The last known iOS SDK (stable).
6
6
  #
7
- LAST_KNOWN_IOS_SDK = '12.2'
7
+ LAST_KNOWN_IOS_SDK = '14.0'
8
8
 
9
9
  # @return [String] The last known OS X SDK (stable).
10
10
  #
11
- LAST_KNOWN_OSX_SDK = '10.14'
11
+ LAST_KNOWN_OSX_SDK = '10.15'
12
12
 
13
13
  # @return [String] The last known tvOS SDK (stable).
14
14
  #
15
- LAST_KNOWN_TVOS_SDK = '12.2'
15
+ LAST_KNOWN_TVOS_SDK = '14.0'
16
16
 
17
17
  # @return [String] The last known watchOS SDK (stable).
18
18
  #
19
- LAST_KNOWN_WATCHOS_SDK = '5.2'
19
+ LAST_KNOWN_WATCHOS_SDK = '7.0'
20
20
 
21
21
  # @return [String] The last known archive version to Xcodeproj.
22
22
  #
@@ -32,7 +32,7 @@ module Xcodeproj
32
32
 
33
33
  # @return [String] The last known object version to Xcodeproj.
34
34
  #
35
- LAST_KNOWN_OBJECT_VERSION = 52
35
+ LAST_KNOWN_OBJECT_VERSION = 54
36
36
 
37
37
  # @return [String] The last known object version to Xcodeproj.
38
38
  #
@@ -93,12 +93,14 @@ module Xcodeproj
93
93
  'app' => 'wrapper.application',
94
94
  'appex' => 'wrapper.app-extension',
95
95
  'bundle' => 'wrapper.plug-in',
96
+ 'cpp' => 'sourcecode.cpp.cpp',
96
97
  'dylib' => 'compiled.mach-o.dylib',
97
98
  'entitlements' => 'text.plist.entitlements',
98
99
  'framework' => 'wrapper.framework',
99
100
  'gif' => 'image.gif',
100
101
  'gpx' => 'text.xml',
101
102
  'h' => 'sourcecode.c.h',
103
+ 'hpp' => 'sourcecode.cpp.h',
102
104
  'm' => 'sourcecode.c.objc',
103
105
  'markdown' => 'text',
104
106
  'mdimporter' => 'wrapper.cfbundle',
@@ -126,6 +128,8 @@ module Xcodeproj
126
128
  # @return [Hash] The compatibility version string for different object versions.
127
129
  #
128
130
  COMPATIBILITY_VERSION_BY_OBJECT_VERSION = {
131
+ 54 => 'Xcode 12.0',
132
+ 53 => 'Xcode 11.4',
129
133
  52 => 'Xcode 11.0',
130
134
  51 => 'Xcode 10.0',
131
135
  50 => 'Xcode 9.3',
@@ -138,41 +142,48 @@ module Xcodeproj
138
142
  # @return [Hash] The uniform type identifier of various product types.
139
143
  #
140
144
  PRODUCT_TYPE_UTI = {
141
- :application => 'com.apple.product-type.application',
142
- :framework => 'com.apple.product-type.framework',
143
- :dynamic_library => 'com.apple.product-type.library.dynamic',
144
- :static_library => 'com.apple.product-type.library.static',
145
- :bundle => 'com.apple.product-type.bundle',
146
- :octest_bundle => 'com.apple.product-type.bundle',
147
- :unit_test_bundle => 'com.apple.product-type.bundle.unit-test',
148
- :ui_test_bundle => 'com.apple.product-type.bundle.ui-testing',
149
- :app_extension => 'com.apple.product-type.app-extension',
150
- :command_line_tool => 'com.apple.product-type.tool',
151
- :watch_app => 'com.apple.product-type.application.watchapp',
152
- :watch2_app => 'com.apple.product-type.application.watchapp2',
153
- :watch_extension => 'com.apple.product-type.watchkit-extension',
154
- :watch2_extension => 'com.apple.product-type.watchkit2-extension',
155
- :tv_extension => 'com.apple.product-type.tv-app-extension',
156
- :messages_application => 'com.apple.product-type.application.messages',
157
- :messages_extension => 'com.apple.product-type.app-extension.messages',
158
- :sticker_pack => 'com.apple.product-type.app-extension.messages-sticker-pack',
159
- :xpc_service => 'com.apple.product-type.xpc-service',
145
+ :application => 'com.apple.product-type.application',
146
+ :application_on_demand_install_capable => 'com.apple.product-type.application.on-demand-install-capable',
147
+ :framework => 'com.apple.product-type.framework',
148
+ :dynamic_library => 'com.apple.product-type.library.dynamic',
149
+ :static_library => 'com.apple.product-type.library.static',
150
+ :bundle => 'com.apple.product-type.bundle',
151
+ :octest_bundle => 'com.apple.product-type.bundle',
152
+ :unit_test_bundle => 'com.apple.product-type.bundle.unit-test',
153
+ :ui_test_bundle => 'com.apple.product-type.bundle.ui-testing',
154
+ :app_extension => 'com.apple.product-type.app-extension',
155
+ :command_line_tool => 'com.apple.product-type.tool',
156
+ :watch_app => 'com.apple.product-type.application.watchapp',
157
+ :watch2_app => 'com.apple.product-type.application.watchapp2',
158
+ :watch2_app_container => 'com.apple.product-type.application.watchapp2-container',
159
+ :watch_extension => 'com.apple.product-type.watchkit-extension',
160
+ :watch2_extension => 'com.apple.product-type.watchkit2-extension',
161
+ :tv_extension => 'com.apple.product-type.tv-app-extension',
162
+ :messages_application => 'com.apple.product-type.application.messages',
163
+ :messages_extension => 'com.apple.product-type.app-extension.messages',
164
+ :sticker_pack => 'com.apple.product-type.app-extension.messages-sticker-pack',
165
+ :xpc_service => 'com.apple.product-type.xpc-service',
160
166
  }.freeze
161
167
 
162
168
  # @return [Hash] The extensions or the various product UTIs.
163
169
  #
164
170
  PRODUCT_UTI_EXTENSIONS = {
165
- :application => 'app',
166
- :framework => 'framework',
167
- :dynamic_library => 'dylib',
168
- :static_library => 'a',
169
- :bundle => 'bundle',
170
- :octest_bundle => 'octest',
171
- :unit_test_bundle => 'xctest',
172
- :ui_test_bundle => 'xctest',
173
- :app_extension => 'appex',
174
- :watch2_extension => 'appex',
175
- :watch2_app => 'app',
171
+ :application => 'app',
172
+ :application_on_demand_install_capable => 'app',
173
+ :framework => 'framework',
174
+ :dynamic_library => 'dylib',
175
+ :static_library => 'a',
176
+ :bundle => 'bundle',
177
+ :octest_bundle => 'octest',
178
+ :unit_test_bundle => 'xctest',
179
+ :ui_test_bundle => 'xctest',
180
+ :app_extension => 'appex',
181
+ :messages_application => 'app',
182
+ :messages_extension => 'appex',
183
+ :sticker_pack => 'appex',
184
+ :watch2_extension => 'appex',
185
+ :watch2_app => 'app',
186
+ :watch2_app_container => 'app',
176
187
  }.freeze
177
188
 
178
189
  # @return [Hash] The common build settings grouped by platform, and build
@@ -193,11 +204,9 @@ module Xcodeproj
193
204
  }.freeze,
194
205
  [:ios] => {
195
206
  'SDKROOT' => 'iphoneos',
196
- 'CODE_SIGN_IDENTITY' => 'iPhone Developer',
197
207
  }.freeze,
198
208
  [:osx] => {
199
209
  'SDKROOT' => 'macosx',
200
- 'CODE_SIGN_IDENTITY' => '-',
201
210
  }.freeze,
202
211
  [:tvos] => {
203
212
  'SDKROOT' => 'appletvos',
@@ -246,7 +255,6 @@ module Xcodeproj
246
255
  [:debug, :static_library, :swift] => {
247
256
  }.freeze,
248
257
  [:framework] => {
249
- 'CODE_SIGN_IDENTITY' => '',
250
258
  'CURRENT_PROJECT_VERSION' => '1',
251
259
  'DEFINES_MODULE' => 'YES',
252
260
  'DYLIB_COMPATIBILITY_VERSION' => '1',
@@ -264,7 +272,6 @@ module Xcodeproj
264
272
  }.freeze,
265
273
  [:osx, :framework] => {
266
274
  'COMBINE_HIDPI_IMAGES' => 'YES',
267
- 'FRAMEWORK_VERSION' => 'A',
268
275
  'LD_RUNPATH_SEARCH_PATHS' => '$(inherited) @executable_path/../Frameworks @loader_path/Frameworks',
269
276
  }.freeze,
270
277
  [:watchos, :framework] => {
@@ -306,6 +313,7 @@ module Xcodeproj
306
313
  }.freeze,
307
314
  [:application] => {
308
315
  'ASSETCATALOG_COMPILER_APPICON_NAME' => 'AppIcon',
316
+ 'ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME' => 'AccentColor',
309
317
  }.freeze,
310
318
  [:ios, :application] => {
311
319
  'LD_RUNPATH_SEARCH_PATHS' => '$(inherited) @executable_path/Frameworks',
@@ -321,10 +329,12 @@ module Xcodeproj
321
329
  }.freeze,
322
330
  [:tvos, :application] => {
323
331
  'ASSETCATALOG_COMPILER_APPICON_NAME' => 'App Icon & Top Shelf Image',
324
- 'ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME' => 'LaunchImage',
325
332
  'LD_RUNPATH_SEARCH_PATHS' => '$(inherited) @executable_path/Frameworks',
326
333
  'TARGETED_DEVICE_FAMILY' => '3',
327
334
  }.freeze,
335
+ [:tvos, :application, :swift] => {
336
+ 'ENABLE_PREVIEWS' => 'YES',
337
+ }.freeze,
328
338
  [:watchos, :application, :swift] => {
329
339
  'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES' => 'YES',
330
340
  }.freeze,
@@ -370,6 +380,7 @@ module Xcodeproj
370
380
  'CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF' => 'YES',
371
381
  'CLANG_WARN_OBJC_LITERAL_CONVERSION' => 'YES',
372
382
  'CLANG_WARN_OBJC_ROOT_CLASS' => 'YES_ERROR',
383
+ 'CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER' => 'YES',
373
384
  'CLANG_WARN_RANGE_LOOP_ANALYSIS' => 'YES',
374
385
  'CLANG_WARN_STRICT_PROTOTYPES' => 'YES',
375
386
  'CLANG_WARN_SUSPICIOUS_MOVE' => 'YES',
@@ -1,5 +1,5 @@
1
1
  module Xcodeproj
2
2
  # The version of the xcodeproj gem.
3
3
  #
4
- VERSION = '1.10.0'.freeze unless defined? Xcodeproj::VERSION
4
+ VERSION = '1.19.0'.freeze unless defined? Xcodeproj::VERSION
5
5
  end
@@ -589,7 +589,7 @@ module Xcodeproj
589
589
  #
590
590
  def embedded_targets_in_native_target(native_target)
591
591
  native_targets.select do |target|
592
- host_targets_for_embedded_target(target).map(&:uuid).include? native_target.uuid
592
+ host_targets_for_embedded_target(target).any? { |host| host.uuid == native_target.uuid }
593
593
  end
594
594
  end
595
595
 
@@ -350,7 +350,7 @@ module Xcodeproj
350
350
  unless object = project.objects_by_uuid[uuid] || project.new_from_plist(uuid, objects_by_uuid_plist)
351
351
  UI.warn "`#{inspect}` attempted to initialize an object with " \
352
352
  "an unknown UUID. `#{uuid}` for attribute: " \
353
- "`#{attribute.name}`. This can be the result of a merge and " \
353
+ "`#{attribute.name}`. This can be the result of a merge and " \
354
354
  'the unknown UUID is being discarded.'
355
355
  end
356
356
  object
@@ -6,6 +6,10 @@ module Xcodeproj
6
6
  # {PBXProject} or a {PBXNativeTarget}.
7
7
  #
8
8
  class XCBuildConfiguration < AbstractObject
9
+ MUTUAL_RECURSION_SENTINEL = 'xcodeproj.mutual_recursion_sentinel'.freeze
10
+
11
+ private_constant :MUTUAL_RECURSION_SENTINEL
12
+
9
13
  # @!group Attributes
10
14
 
11
15
  # @return [String] the name of the Target.
@@ -79,16 +83,19 @@ module Xcodeproj
79
83
  # the key of the build setting.
80
84
  #
81
85
  # @param [PBXNativeTarget] root_target
82
- # use this to resolve complete recursion between project and targets
86
+ # use this to resolve complete recursion between project and targets.
87
+ #
88
+ # @param [String] previous_key
89
+ # use this to resolve complete recursion between different build settings.
83
90
  #
84
91
  # @return [String] The value of the build setting
85
92
  #
86
- def resolve_build_setting(key, root_target = nil)
93
+ def resolve_build_setting(key, root_target = nil, previous_key = nil)
87
94
  setting = build_settings[key]
88
- setting = resolve_variable_substitution(key, setting, root_target)
95
+ setting = resolve_variable_substitution(key, setting, root_target, previous_key)
89
96
 
90
- config_setting = base_configuration_reference && config[key]
91
- config_setting = resolve_variable_substitution(key, config_setting, root_target)
97
+ config_setting = config[key]
98
+ config_setting = resolve_variable_substitution(key, config_setting, root_target, previous_key)
92
99
 
93
100
  project_setting = project.build_configuration_list[name]
94
101
  project_setting = nil if equal?(project_setting)
@@ -99,6 +106,12 @@ module Xcodeproj
99
106
  'SRCROOT' => project.project_dir.to_s,
100
107
  }
101
108
 
109
+ # if previous_key is nil, it means that we're back at the first call, so we can replace our sentinel string
110
+ # used to prevent recursion with nil
111
+ if previous_key.nil? && setting == MUTUAL_RECURSION_SENTINEL
112
+ setting = nil
113
+ end
114
+
102
115
  [defaults[key], project_setting, config_setting, setting, ENV[key]].compact.reduce(nil) do |inherited, value|
103
116
  expand_build_setting(value, inherited)
104
117
  end
@@ -139,10 +152,10 @@ module Xcodeproj
139
152
  inherited = config_value || default
140
153
 
141
154
  return build_setting_value.gsub(Regexp.union(Constants::INHERITED_KEYWORDS), inherited) if build_setting_value.is_a? String
142
- build_setting_value.map { |value| Constants::INHERITED_KEYWORDS.include?(value) ? inherited : value }.flatten
155
+ build_setting_value.flat_map { |value| Constants::INHERITED_KEYWORDS.include?(value) ? inherited : value }
143
156
  end
144
157
 
145
- def resolve_variable_substitution(key, value, root_target)
158
+ def resolve_variable_substitution(key, value, root_target, previous_key = nil)
146
159
  case value
147
160
  when Array
148
161
  return value.map { |v| resolve_variable_substitution(key, v, root_target) }
@@ -168,9 +181,20 @@ module Xcodeproj
168
181
  when key
169
182
  # to prevent infinite recursion
170
183
  nil
184
+ when previous_key
185
+ # to prevent infinite recursion; we don't return nil as for the self recursion because it needs to be
186
+ # distinguished outside this method too
187
+ MUTUAL_RECURSION_SENTINEL
171
188
  else
172
189
  configuration_to_resolve_against = root_target ? root_target.build_configuration_list[name] : self
173
- resolved_value_for_variable = configuration_to_resolve_against.resolve_build_setting(variable, root_target) || ''
190
+ resolved_value_for_variable = configuration_to_resolve_against.resolve_build_setting(variable, root_target, key) || ''
191
+
192
+ # we use this sentinel string instead of nil, because, otherwise, it would be swallowed by the default empty
193
+ # string from the preceding line, and we want to distinguish between mutual recursion and other cases
194
+ if resolved_value_for_variable == MUTUAL_RECURSION_SENTINEL
195
+ return MUTUAL_RECURSION_SENTINEL
196
+ end
197
+
174
198
  value = value.gsub(variable_reference, resolved_value_for_variable)
175
199
  resolve_variable_substitution(key, value, root_target)
176
200
  end
@@ -191,14 +215,15 @@ module Xcodeproj
191
215
 
192
216
  settings.keys.each do |key|
193
217
  next unless value = settings[key]
218
+ stripped_key = key.sub(/\[[^\]]+\]$/, '')
194
219
  case value
195
220
  when String
196
- next unless array_settings.include?(key)
221
+ next unless array_settings.include?(stripped_key)
197
222
  array_value = split_build_setting_array_to_string(value)
198
223
  next unless array_value.size > 1
199
224
  settings[key] = array_value
200
225
  when Array
201
- next if value.size > 1 && array_settings.include?(key)
226
+ next if value.size > 1 && array_settings.include?(stripped_key)
202
227
  settings[key] = value.join(' ')
203
228
  end
204
229
  end
@@ -210,9 +235,15 @@ module Xcodeproj
210
235
  end
211
236
 
212
237
  def config
213
- @config ||= Xcodeproj::Config.new(base_configuration_reference.real_path).to_hash.tap do |hash|
214
- normalize_array_settings(hash)
215
- end
238
+ return {} unless base_configuration_reference
239
+ @config ||=
240
+ if base_configuration_reference.real_path.exist?
241
+ Xcodeproj::Config.new(base_configuration_reference.real_path).to_hash.tap do |hash|
242
+ normalize_array_settings(hash)
243
+ end
244
+ else
245
+ {}
246
+ end
216
247
  end
217
248
 
218
249
  #---------------------------------------------------------------------#
@@ -30,6 +30,16 @@ module Xcodeproj
30
30
  #
31
31
  attribute :run_only_for_deployment_postprocessing, String, '0'
32
32
 
33
+ # @return [String] whether or not this run script will be forced to
34
+ # run even on incremental builds. Can be either '1', or
35
+ # missing. By default this option is disabled in Xcode.
36
+ #
37
+ # @note This setting is exposed in Xcode in the UI of
38
+ # PBXShellScriptBuildPhase as `Based on
39
+ # dependency analysis` (selected by default).
40
+ #
41
+ attribute :always_out_of_date, String
42
+
33
43
  # @return [String] Comments associated with this build phase.
34
44
  #
35
45
  # @note This is apparently no longer used by Xcode.
@@ -204,6 +214,19 @@ module Xcodeproj
204
214
  #
205
215
  attribute :dst_subfolder_spec, String, Constants::COPY_FILES_BUILD_PHASE_DESTINATIONS[:resources]
206
216
 
217
+ # @return [Hash{String => Hash}] A hash suitable to display the build
218
+ # phase to the user.
219
+ #
220
+ def pretty_print
221
+ {
222
+ display_name => {
223
+ 'Destination Path' => dst_path,
224
+ 'Destination Subfolder' => Constants::COPY_FILES_BUILD_PHASE_DESTINATIONS.key(dst_subfolder_spec).to_s,
225
+ 'Files' => files.map(&:pretty_print),
226
+ },
227
+ }
228
+ end
229
+
207
230
  # Alias method for #dst_subfolder_spec=, which accepts symbol values
208
231
  # instead of numeric string values.
209
232
  #
@@ -287,6 +310,26 @@ module Xcodeproj
287
310
  # the build log.
288
311
  #
289
312
  attribute :show_env_vars_in_log, String
313
+
314
+ # @return [String] the discovered dependency file to use.
315
+ #
316
+ attribute :dependency_file, String
317
+
318
+ # @return [Hash{String => Hash}] A hash suitable to display the build
319
+ # phase to the user.
320
+ #
321
+ def pretty_print
322
+ {
323
+ display_name => {
324
+ 'Input File List Paths' => input_file_list_paths || [],
325
+ 'Input Paths' => input_paths || [],
326
+ 'Output File List Paths' => output_file_list_paths || [],
327
+ 'Output Paths' => output_paths || [],
328
+ 'Shell Path' => shell_path,
329
+ 'Shell Script' => shell_script,
330
+ },
331
+ }
332
+ end
290
333
  end
291
334
 
292
335
  #-----------------------------------------------------------------------#
@@ -56,6 +56,13 @@ module Xcodeproj
56
56
  #
57
57
  attribute :output_files_compiler_flags, Array
58
58
 
59
+ # @return [String] whether the rule should be run once per architecture.
60
+ #
61
+ # @example
62
+ # `0`.
63
+ #
64
+ attribute :run_once_per_architecture, String
65
+
59
66
  # @return [String] the content of the script to use for the build rule.
60
67
  #
61
68
  # @note This attribute is present if the #{#compiler_spec} is
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'xcodeproj/project/object/helpers/groupable_helper'
2
3
 
3
4
  module Xcodeproj
@@ -51,7 +52,9 @@ module Xcodeproj
51
52
  prefix = 'lib'
52
53
  end
53
54
  extension = Constants::PRODUCT_UTI_EXTENSIONS[product_type]
54
- ref = new_reference(group, "#{prefix}#{target_name}.#{extension}", :built_products)
55
+ path = "#{prefix}#{target_name}"
56
+ path += ".#{extension}" if extension
57
+ ref = new_reference(group, path, :built_products)
55
58
  ref.include_in_index = '0'
56
59
  ref.set_explicit_file_type
57
60
  ref
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Xcodeproj
2
3
  class Project
3
4
  module Object
@@ -147,7 +148,7 @@ module Xcodeproj
147
148
  when '<group>'
148
149
  object_parent = parent(object)
149
150
  if object_parent.isa == 'PBXProject'.freeze
150
- object.project.project_dir
151
+ object.project.project_dir + object.project.root_object.project_dir_path
151
152
  else
152
153
  real_path(object_parent)
153
154
  end
@@ -42,7 +42,7 @@ module Xcodeproj
42
42
  # the key of the build setting.
43
43
  #
44
44
  # @param [Bool] resolve_against_xcconfig
45
- # wether the resolved setting should take in consideration any
45
+ # whether the resolved setting should take in consideration any
46
46
  # configuration file present.
47
47
  #
48
48
  # @return [Hash{String => String}] The value of the build setting
@@ -60,7 +60,7 @@ module Xcodeproj
60
60
  if target_val.is_a? String
61
61
  target_val.gsub(Regexp.union(Constants::INHERITED_KEYWORDS), proj_val)
62
62
  else
63
- target_val.map { |value| Constants::INHERITED_KEYWORDS.include?(value) ? proj_val : value }.flatten
63
+ target_val.flat_map { |value| Constants::INHERITED_KEYWORDS.include?(value) ? proj_val : value }
64
64
  end
65
65
  else
66
66
  target_val || proj_val
@@ -74,6 +74,10 @@ module Xcodeproj
74
74
  # @param [String] key
75
75
  # the key of the build setting.
76
76
  #
77
+ # @param [Boolean] resolve_against_xcconfig
78
+ # whether the resolved setting should take in consideration any
79
+ # configuration file present.
80
+ #
77
81
  # @raise If the build setting has multiple values.
78
82
  #
79
83
  # @note As it is common not to have a setting with no value for
@@ -83,8 +87,8 @@ module Xcodeproj
83
87
  #
84
88
  # @return [String] The value of the build setting.
85
89
  #
86
- def common_resolved_build_setting(key)
87
- values = resolved_build_setting(key).values.compact.uniq
90
+ def common_resolved_build_setting(key, resolve_against_xcconfig: false)
91
+ values = resolved_build_setting(key, resolve_against_xcconfig).values.compact.uniq
88
92
  if values.count <= 1
89
93
  values.first
90
94
  else
@@ -42,7 +42,7 @@ module Xcodeproj
42
42
 
43
43
  # @return [Array<String>] the list of known regions.
44
44
  #
45
- attribute :known_regions, Array, ['en']
45
+ attribute :known_regions, Array, %w(en Base)
46
46
 
47
47
  # @return [PBXGroup] the main group of the project. The one displayed
48
48
  # by Xcode in the Project Navigator.
@@ -26,6 +26,14 @@ module Xcodeproj
26
26
  #
27
27
  attribute :name, String
28
28
 
29
+ # @return [String] the platform filter for this target dependency.
30
+ #
31
+ attribute :platform_filter, String
32
+
33
+ # @return [String] the product reference for this target dependency.
34
+ #
35
+ attribute :product_ref, String
36
+
29
37
  public
30
38
 
31
39
  # @!group AbstractObject Hooks
@@ -65,6 +73,7 @@ module Xcodeproj
65
73
  hash = {}
66
74
  hash['displayName'] = display_name
67
75
  hash['isa'] = isa
76
+ hash['targetProxy'] = target_proxy.to_tree_hash
68
77
  hash
69
78
  end
70
79
 
@@ -224,8 +224,9 @@ module Xcodeproj
224
224
  cl.build_configurations << release_conf
225
225
  cl.build_configurations << debug_conf
226
226
 
227
+ existing_configurations = cl.build_configurations.map(&:name)
227
228
  project.build_configurations.each do |configuration|
228
- next if cl.build_configurations.map(&:name).include?(configuration.name)
229
+ next if existing_configurations.include?(configuration.name)
229
230
 
230
231
  new_config = project.new(XCBuildConfiguration)
231
232
  new_config.name = configuration.name
@@ -59,6 +59,20 @@ module Xcodeproj
59
59
  end
60
60
  end
61
61
 
62
+ # @param [Array<BuildAction::Entry>] entries
63
+ # Sets the list of BuildActionEntry nodes associated with this Build Action.
64
+ #
65
+ def entries=(entries)
66
+ @xml_element.delete_element('BuildActionEntries')
67
+ unless entries.empty?
68
+ entries_element = @xml_element.add_element('BuildActionEntries')
69
+ entries.each do |entry_node|
70
+ entries_element.add_element(entry_node.xml_element)
71
+ end
72
+ end
73
+ entries
74
+ end
75
+
62
76
  # @param [BuildAction::Entry] entry
63
77
  # The BuildActionEntry to add to the list of targets to build for the various actions
64
78
  #
@@ -185,6 +199,13 @@ module Xcodeproj
185
199
  def add_buildable_reference(ref)
186
200
  @xml_element.add_element(ref.xml_element)
187
201
  end
202
+
203
+ # @param [BuildableReference] ref
204
+ # The BuildableReference to remove from the list of targets this entry will build
205
+ #
206
+ def remove_buildable_reference(ref)
207
+ @xml_element.delete_element(ref.xml_element)
208
+ end
188
209
  end
189
210
  end
190
211
  end
@@ -143,6 +143,22 @@ module Xcodeproj
143
143
  @xml_element.add_element(arguments.xml_element) if arguments
144
144
  arguments
145
145
  end
146
+
147
+ # @return [Array<MacroExpansion>]
148
+ # The list of MacroExpansion bound with this LaunchAction
149
+ #
150
+ def macro_expansions
151
+ @xml_element.get_elements('MacroExpansion').map do |node|
152
+ MacroExpansion.new(node)
153
+ end
154
+ end
155
+
156
+ # @param [MacroExpansion] macro_expansion
157
+ # Add a MacroExpansion to this LaunchAction
158
+ #
159
+ def add_macro_expansion(macro_expansion)
160
+ @xml_element.add_element(macro_expansion.xml_element)
161
+ end
146
162
  end
147
163
  end
148
164
  end
@@ -58,7 +58,7 @@ module Xcodeproj
58
58
  string_to_bool(@xml_element.attributes['codeCoverageEnabled'])
59
59
  end
60
60
 
61
- # @rparam [Bool] flag
61
+ # @param [Bool] flag
62
62
  # Set whether Clang Code Coverage is enabled ('Gather coverage data' turned ON)
63
63
  #
64
64
  def code_coverage_enabled=(flag)
@@ -76,6 +76,18 @@ module Xcodeproj
76
76
  end
77
77
  end
78
78
 
79
+ # @param [Array<TestableReference>] testables
80
+ # Sets the list of TestableReference (test bundles) associated with this Test Action
81
+ #
82
+ def testables=(testables)
83
+ @xml_element.delete_element('Testables')
84
+ testables_element = @xml_element.add_element('Testables')
85
+ testables.each do |testable|
86
+ testables_element.add_element(testable.xml_element)
87
+ end
88
+ testables
89
+ end
90
+
79
91
  # @param [TestableReference] testable
80
92
  # Add a TestableReference (test bundle) to this Test Action
81
93
  #
@@ -219,6 +231,13 @@ module Xcodeproj
219
231
  @xml_element.add_element(ref.xml_element)
220
232
  end
221
233
 
234
+ # @param [BuildableReference] ref
235
+ # The BuildableReference to remove from the list of targets this entry will build
236
+ #
237
+ def remove_buildable_reference(ref)
238
+ @xml_element.delete_element(ref.xml_element)
239
+ end
240
+
222
241
  # @return [Array<Test>]
223
242
  # The list of SkippedTest this action will skip.
224
243
  #
@@ -107,8 +107,9 @@ module Xcodeproj
107
107
  else
108
108
  raise ArgumentError, "Input to the << operator must be a file path or FileReference, got #{path_or_reference.inspect}"
109
109
  end
110
-
111
- @document.root.add_element(project_file_reference.to_node)
110
+ unless file_references.any? { |ref| project_file_reference.eql? ref }
111
+ @document.root.add_element(project_file_reference.to_node)
112
+ end
112
113
  load_schemes_from_project File.expand_path(projpath || project_file_reference.path)
113
114
  end
114
115
 
@@ -13,7 +13,7 @@ module Xcodeproj
13
13
  # @param [#to_s] type @see type
14
14
  #
15
15
  def initialize(path, type = 'group')
16
- @path = path.to_s
16
+ @path = Pathname.new(path.to_s).cleanpath.to_s
17
17
  @type = type.to_s
18
18
  end
19
19
 
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: 1.10.0
4
+ version: 1.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-12 00:00:00.000000000 Z
11
+ date: 2020-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: atomos
@@ -84,14 +84,14 @@ dependencies:
84
84
  requirements:
85
85
  - - "~>"
86
86
  - !ruby/object:Gem::Version
87
- version: 0.2.6
87
+ version: 0.3.0
88
88
  type: :runtime
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - "~>"
93
93
  - !ruby/object:Gem::Version
94
- version: 0.2.6
94
+ version: 0.3.0
95
95
  description: Xcodeproj lets you create and modify Xcode projects from Ruby. Script
96
96
  boring management tasks or build Xcode-friendly libraries. Also includes support
97
97
  for Xcode workspaces (.xcworkspace) and configuration files (.xcconfig).
@@ -168,7 +168,7 @@ homepage: https://github.com/cocoapods/xcodeproj
168
168
  licenses:
169
169
  - MIT
170
170
  metadata: {}
171
- post_install_message:
171
+ post_install_message:
172
172
  rdoc_options: []
173
173
  require_paths:
174
174
  - lib
@@ -183,8 +183,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  - !ruby/object:Gem::Version
184
184
  version: '0'
185
185
  requirements: []
186
- rubygems_version: 3.0.1
187
- signing_key:
186
+ rubygems_version: 3.1.2
187
+ signing_key:
188
188
  specification_version: 3
189
189
  summary: Create and modify Xcode projects from Ruby.
190
190
  test_files: []