plasmo_xcodeproj 1.21.1

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.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +19 -0
  3. data/README.md +95 -0
  4. data/bin/xcodeproj +10 -0
  5. data/lib/xcodeproj/command/config_dump.rb +91 -0
  6. data/lib/xcodeproj/command/project_diff.rb +56 -0
  7. data/lib/xcodeproj/command/show.rb +60 -0
  8. data/lib/xcodeproj/command/sort.rb +44 -0
  9. data/lib/xcodeproj/command/target_diff.rb +43 -0
  10. data/lib/xcodeproj/command.rb +63 -0
  11. data/lib/xcodeproj/config/other_linker_flags_parser.rb +73 -0
  12. data/lib/xcodeproj/config.rb +386 -0
  13. data/lib/xcodeproj/constants.rb +465 -0
  14. data/lib/xcodeproj/differ.rb +239 -0
  15. data/lib/xcodeproj/gem_version.rb +5 -0
  16. data/lib/xcodeproj/helper.rb +30 -0
  17. data/lib/xcodeproj/plist.rb +94 -0
  18. data/lib/xcodeproj/project/case_converter.rb +90 -0
  19. data/lib/xcodeproj/project/object/build_configuration.rb +255 -0
  20. data/lib/xcodeproj/project/object/build_file.rb +84 -0
  21. data/lib/xcodeproj/project/object/build_phase.rb +369 -0
  22. data/lib/xcodeproj/project/object/build_rule.rb +109 -0
  23. data/lib/xcodeproj/project/object/configuration_list.rb +117 -0
  24. data/lib/xcodeproj/project/object/container_item_proxy.rb +116 -0
  25. data/lib/xcodeproj/project/object/file_reference.rb +338 -0
  26. data/lib/xcodeproj/project/object/group.rb +506 -0
  27. data/lib/xcodeproj/project/object/helpers/build_settings_array_settings_by_object_version.rb +72 -0
  28. data/lib/xcodeproj/project/object/helpers/file_references_factory.rb +245 -0
  29. data/lib/xcodeproj/project/object/helpers/groupable_helper.rb +260 -0
  30. data/lib/xcodeproj/project/object/native_target.rb +751 -0
  31. data/lib/xcodeproj/project/object/reference_proxy.rb +86 -0
  32. data/lib/xcodeproj/project/object/root_object.rb +100 -0
  33. data/lib/xcodeproj/project/object/swift_package_product_dependency.rb +29 -0
  34. data/lib/xcodeproj/project/object/swift_package_remote_reference.rb +33 -0
  35. data/lib/xcodeproj/project/object/target_dependency.rb +94 -0
  36. data/lib/xcodeproj/project/object.rb +534 -0
  37. data/lib/xcodeproj/project/object_attributes.rb +522 -0
  38. data/lib/xcodeproj/project/object_dictionary.rb +210 -0
  39. data/lib/xcodeproj/project/object_list.rb +223 -0
  40. data/lib/xcodeproj/project/project_helper.rb +341 -0
  41. data/lib/xcodeproj/project/uuid_generator.rb +132 -0
  42. data/lib/xcodeproj/project.rb +874 -0
  43. data/lib/xcodeproj/scheme/abstract_scheme_action.rb +100 -0
  44. data/lib/xcodeproj/scheme/analyze_action.rb +19 -0
  45. data/lib/xcodeproj/scheme/archive_action.rb +59 -0
  46. data/lib/xcodeproj/scheme/build_action.rb +298 -0
  47. data/lib/xcodeproj/scheme/buildable_product_runnable.rb +55 -0
  48. data/lib/xcodeproj/scheme/buildable_reference.rb +129 -0
  49. data/lib/xcodeproj/scheme/command_line_arguments.rb +162 -0
  50. data/lib/xcodeproj/scheme/environment_variables.rb +170 -0
  51. data/lib/xcodeproj/scheme/execution_action.rb +86 -0
  52. data/lib/xcodeproj/scheme/launch_action.rb +179 -0
  53. data/lib/xcodeproj/scheme/location_scenario_reference.rb +49 -0
  54. data/lib/xcodeproj/scheme/macro_expansion.rb +34 -0
  55. data/lib/xcodeproj/scheme/profile_action.rb +57 -0
  56. data/lib/xcodeproj/scheme/remote_runnable.rb +92 -0
  57. data/lib/xcodeproj/scheme/send_email_action_content.rb +84 -0
  58. data/lib/xcodeproj/scheme/shell_script_action_content.rb +77 -0
  59. data/lib/xcodeproj/scheme/test_action.rb +394 -0
  60. data/lib/xcodeproj/scheme/xml_element_wrapper.rb +82 -0
  61. data/lib/xcodeproj/scheme.rb +375 -0
  62. data/lib/xcodeproj/user_interface.rb +22 -0
  63. data/lib/xcodeproj/workspace/file_reference.rb +79 -0
  64. data/lib/xcodeproj/workspace/group_reference.rb +67 -0
  65. data/lib/xcodeproj/workspace/reference.rb +40 -0
  66. data/lib/xcodeproj/workspace.rb +277 -0
  67. data/lib/xcodeproj/xcodebuild_helper.rb +108 -0
  68. data/lib/xcodeproj.rb +29 -0
  69. metadata +208 -0
@@ -0,0 +1,506 @@
1
+ require 'xcodeproj/project/object/helpers/groupable_helper'
2
+ require 'xcodeproj/project/object/helpers/file_references_factory'
3
+
4
+ module Xcodeproj
5
+ class Project
6
+ module Object
7
+ # This class represents a group. A group can contain other groups
8
+ # (PBXGroup) and file references (PBXFileReference).
9
+ #
10
+ class PBXGroup < AbstractObject
11
+ # @!group Attributes
12
+
13
+ # @return [ObjectList<PBXGroup, PBXFileReference>]
14
+ # the objects contained by the group.
15
+ #
16
+ has_many :children, [PBXGroup, PBXFileReference, PBXReferenceProxy]
17
+
18
+ # @return [String] the directory to which the path is relative.
19
+ #
20
+ # @note The accepted values are:
21
+ # - `<absolute>` for absolute paths
22
+ # - `<group>` for paths relative to the group
23
+ # - `SOURCE_ROOT` for paths relative to the project
24
+ # - `DEVELOPER_DIR` for paths relative to the developer
25
+ # directory.
26
+ # - `BUILT_PRODUCTS_DIR` for paths relative to the build
27
+ # products directory.
28
+ # - `SDKROOT` for paths relative to the SDK directory.
29
+ #
30
+ attribute :source_tree, String, '<group>'
31
+
32
+ # @return [String] the path to a folder in the file system.
33
+ #
34
+ # @note This attribute is present for groups that are linked to a
35
+ # folder in the file system.
36
+ #
37
+ attribute :path, String
38
+
39
+ # @return [String] the name of the group.
40
+ #
41
+ # @note If path is specified this attribute is not present.
42
+ #
43
+ attribute :name, String
44
+
45
+ # @return [String] Whether Xcode should use tabs for text alignment.
46
+ #
47
+ # @example
48
+ # `1`
49
+ #
50
+ attribute :uses_tabs, String
51
+
52
+ # @return [String] The width of the indent.
53
+ #
54
+ # @example
55
+ # `2`
56
+ #
57
+ attribute :indent_width, String
58
+
59
+ # @return [String] The width of the tabs.
60
+ #
61
+ # @example
62
+ # `2`
63
+ #
64
+ attribute :tab_width, String
65
+
66
+ # @return [String] Whether Xcode should wrap lines.
67
+ #
68
+ # @example
69
+ # `1`
70
+ #
71
+ attribute :wraps_lines, String
72
+
73
+ # @return [String] Comments associated with this group.
74
+ #
75
+ # @note This is apparently no longer used by Xcode.
76
+ #
77
+ attribute :comments, String
78
+
79
+ public
80
+
81
+ # @!group Helpers
82
+ #---------------------------------------------------------------------#
83
+
84
+ # @return [PBXGroup, PBXProject] The parent of the group.
85
+ #
86
+ def parent
87
+ GroupableHelper.parent(self)
88
+ end
89
+
90
+ # @return [Array<PBXGroup, PBXProject>] The list of the parents of the
91
+ # group.
92
+ #
93
+ def parents
94
+ GroupableHelper.parents(self)
95
+ end
96
+
97
+ # @return [String] A representation of the group hierarchy.
98
+ #
99
+ def hierarchy_path
100
+ GroupableHelper.hierarchy_path(self)
101
+ end
102
+
103
+ # Moves the group to a new parent.
104
+ #
105
+ # @param [PBXGroup] new_parent
106
+ # The new parent.
107
+ #
108
+ # @return [void]
109
+ #
110
+ def move(new_parent)
111
+ GroupableHelper.move(self, new_parent)
112
+ end
113
+
114
+ # @return [Pathname] the absolute path of the group resolving the
115
+ # source tree.
116
+ #
117
+ def real_path
118
+ GroupableHelper.real_path(self)
119
+ end
120
+
121
+ # Sets the source tree of the group.
122
+ #
123
+ # @param [Symbol, String] source_tree
124
+ # The source tree, either a string or a symbol.
125
+ #
126
+ # @return [void]
127
+ #
128
+ def set_source_tree(source_tree)
129
+ GroupableHelper.set_source_tree(self, source_tree)
130
+ end
131
+
132
+ # Allows to set the path according to the source tree of the group.
133
+ #
134
+ # @param [#to_s] the path for the group.
135
+ #
136
+ # @return [void]
137
+ #
138
+ def set_path(path)
139
+ if path
140
+ source_tree
141
+ GroupableHelper.set_path_with_source_tree(self, path, source_tree)
142
+ else
143
+ self.path = nil
144
+ self.source_tree = '<group>'
145
+ end
146
+ end
147
+
148
+ # @return [Array<PBXFileReference>] the file references in the group
149
+ # children.
150
+ #
151
+ def files
152
+ children.grep(PBXFileReference)
153
+ end
154
+
155
+ # @return [PBXFileReference] The file references whose path (regardless
156
+ # of the source tree) matches the give path.
157
+ #
158
+ def find_file_by_path(path)
159
+ files.find { |ref| ref.path == path }
160
+ end
161
+
162
+ # @return [Array<PBXGroup>] the groups in the group children.
163
+ #
164
+ def groups
165
+ # Don't grep / is_a? as this would include child classes.
166
+ children.select { |obj| obj.class == PBXGroup }
167
+ end
168
+
169
+ # @return [Array<XCVersionGroup>] the version groups in the group
170
+ # children.
171
+ #
172
+ def version_groups
173
+ children.grep(XCVersionGroup)
174
+ end
175
+
176
+ # @return [Array<PBXGroup,PBXFileReference,PBXReferenceProxy>] the
177
+ # recursive children of the group.
178
+ #
179
+ def recursive_children_groups
180
+ result = []
181
+ groups.each do |child|
182
+ result << child
183
+ result.concat(child.recursive_children_groups)
184
+ end
185
+ result
186
+ end
187
+
188
+ # @return [Array<PBXGroup,PBXFileReference,PBXReferenceProxy>] the
189
+ # recursive list of the children of the group.
190
+ #
191
+ def recursive_children
192
+ result = []
193
+ children.each do |child|
194
+ result << child
195
+ if child.is_a?(PBXGroup)
196
+ result.concat(child.recursive_children)
197
+ end
198
+ end
199
+ result
200
+ end
201
+
202
+ # @return [Bool] Whether the group is empty.
203
+ #
204
+ def empty?
205
+ children.count.zero?
206
+ end
207
+
208
+ # Creates a new reference with the given path and adds it to the
209
+ # group. The reference is configured according to the extension
210
+ # of the path.
211
+ #
212
+ # @param [#to_s] path
213
+ # The, preferably absolute, path of the reference.
214
+ #
215
+ # @param [Symbol] source_tree
216
+ # The source tree key to use to configure the path (@see
217
+ # GroupableHelper::SOURCE_TREES_BY_KEY).
218
+ #
219
+ # @return [PBXFileReference, XCVersionGroup] The new reference.
220
+ #
221
+ def new_reference(path, source_tree = :group)
222
+ FileReferencesFactory.new_reference(self, path, source_tree)
223
+ end
224
+ alias_method :new_file, :new_reference
225
+
226
+ # Creates a file reference to a static library and adds it to the
227
+ # group.
228
+ #
229
+ # @param [#to_s] product_basename
230
+ # The name of the static library.
231
+ #
232
+ # @return [PBXFileReference] The new file reference.
233
+ #
234
+ def new_product_ref_for_target(product_basename, product_type)
235
+ FileReferencesFactory.new_product_ref_for_target(self, product_basename, product_type)
236
+ end
237
+
238
+ # Creates a file reference to a new bundle.
239
+ #
240
+ # @param [#to_s] product_basename
241
+ # The name of the bundle.
242
+ #
243
+ # @return [PBXFileReference] The new file reference.
244
+ #
245
+ def new_bundle(product_basename)
246
+ FileReferencesFactory.new_bundle(self, product_basename)
247
+ end
248
+
249
+ # Creates a file reference to a new bundle and adds it to the group.
250
+ #
251
+ # @note @see new_reference
252
+ #
253
+ # @param [#to_s] name
254
+ # the name of the new group.
255
+ #
256
+ # @return [PBXGroup] the new group.
257
+ #
258
+ def new_group(name, path = nil, source_tree = :group)
259
+ group = project.new(PBXGroup)
260
+ children << group
261
+ group.name = name
262
+ group.set_source_tree(source_tree)
263
+ group.set_path(path)
264
+ group
265
+ end
266
+
267
+ # Creates a new variant group and adds it to the group
268
+ #
269
+ # @note @see new_group
270
+ #
271
+ # @param [#to_s] name
272
+ # the name of the new group.
273
+ #
274
+ # @param [#to_s] path
275
+ # The, preferably absolute, path of the variant group.
276
+ # Pass the path of the folder containing all the .lproj bundles,
277
+ # that contain files for the variant group.
278
+ # Do not pass the path of a specific bundle (such as en.lproj)
279
+ #
280
+ # @param [Symbol] source_tree
281
+ # The source tree key to use to configure the path (@see
282
+ # GroupableHelper::SOURCE_TREES_BY_KEY).
283
+ #
284
+ # @return [PBXVariantGroup] the new variant group.
285
+ #
286
+ def new_variant_group(name, path = nil, source_tree = :group)
287
+ group = project.new(PBXVariantGroup)
288
+ children << group
289
+ group.name = name
290
+ group.set_source_tree(source_tree)
291
+ group.set_path(path)
292
+ group
293
+ end
294
+
295
+ # Traverses the children groups and finds the group with the given
296
+ # path, if exists.
297
+ #
298
+ # @see find_subpath
299
+ #
300
+ def [](path)
301
+ find_subpath(path, false)
302
+ end
303
+
304
+ # Removes children files and groups under this group.
305
+ #
306
+ def clear
307
+ children.objects.each(&:remove_from_project)
308
+ end
309
+ alias_method :remove_children_recursively, :clear
310
+
311
+ # Traverses the children groups and finds the children with the given
312
+ # path, optionally, creating any needed group. If the given path is
313
+ # `nil` it returns itself.
314
+ #
315
+ # @param [String] path
316
+ # a string with the names of the groups separated by a '`/`'.
317
+ #
318
+ # @param [Boolean] should_create
319
+ # whether the path should be created.
320
+ #
321
+ # @note The path is matched against the {#display_name} of the groups.
322
+ #
323
+ # @example
324
+ # g = main_group['Frameworks']
325
+ # g.name #=> 'Frameworks'
326
+ #
327
+ # @return [PBXGroup] the group if found.
328
+ # @return [Nil] if the path could not be found and should create is
329
+ # false.
330
+ #
331
+ def find_subpath(path, should_create = false)
332
+ return self unless path
333
+ path = path.split('/') unless path.is_a?(Array)
334
+ child_name = path.shift
335
+ child = children.find { |c| c.display_name == child_name }
336
+ if child.nil?
337
+ if should_create
338
+ child = new_group(child_name)
339
+ else
340
+ return nil
341
+ end
342
+ end
343
+ if path.empty?
344
+ child
345
+ else
346
+ child.find_subpath(path, should_create)
347
+ end
348
+ end
349
+
350
+ # Adds an object to the group.
351
+ #
352
+ # @return [ObjectList<AbstractObject>] the children list.
353
+ #
354
+ def <<(child)
355
+ children << child
356
+ end
357
+
358
+ # Sorts the children of the group by type and then by name.
359
+ #
360
+ # @note This is safe to call in an object list because it modifies it
361
+ # in C in Ruby MRI. In other Ruby implementation it can cause
362
+ # issues if there is one call to the notification enabled
363
+ # methods not compensated by the corespondent opposite (loss of
364
+ # UUIDs and objects from the project).
365
+ #
366
+ # @return [void]
367
+ #
368
+ def sort_by_type
369
+ children.sort! do |x, y|
370
+ if x.isa == 'PBXGroup' && !(y.isa == 'PBXGroup')
371
+ -1
372
+ elsif !(x.isa == 'PBXGroup') && y.isa == 'PBXGroup'
373
+ 1
374
+ elsif x.display_name && y.display_name
375
+ extname_x = File.extname(x.display_name)
376
+ extname_y = File.extname(y.display_name)
377
+ if extname_x != extname_y
378
+ extname_x <=> extname_y
379
+ else
380
+ File.basename(x.display_name, '.*') <=> File.basename(y.display_name, '.*')
381
+ end
382
+ else
383
+ 0
384
+ end
385
+ end
386
+ end
387
+
388
+ # Sorts the group by type recursively.
389
+ #
390
+ # @return [void]
391
+ #
392
+ def sort_recursively_by_type
393
+ groups.each(&:sort_recursively_by_type)
394
+ sort_by_type
395
+ end
396
+
397
+ public
398
+
399
+ # @!group AbstractObject Hooks
400
+ #---------------------------------------------------------------------#
401
+
402
+ # @return [String] the name of the group taking into account the path
403
+ # or other factors if needed.
404
+ #
405
+ def display_name
406
+ if name
407
+ name
408
+ elsif path
409
+ File.basename(path)
410
+ elsif self.equal?(project.main_group)
411
+ 'Main Group'
412
+ end
413
+ end
414
+
415
+ def ascii_plist_annotation
416
+ super unless self.equal?(project.main_group)
417
+ end
418
+
419
+ # Sorts the to many attributes of the object according to the display
420
+ # name.
421
+ #
422
+ # @param [Hash] options
423
+ # the sorting options.
424
+ # @option options [Symbol] :groups_position
425
+ # the position of the groups can be either `:above` or
426
+ # `:below`.
427
+ #
428
+ # @return [void]
429
+ #
430
+ def sort(options = nil)
431
+ children.sort! do |x, y|
432
+ if options && groups_position = options[:groups_position]
433
+ raise ArgumentError unless [:above, :below].include?(groups_position)
434
+ if x.isa == 'PBXGroup' && !(y.isa == 'PBXGroup')
435
+ next groups_position == :above ? -1 : 1
436
+ elsif !(x.isa == 'PBXGroup') && y.isa == 'PBXGroup'
437
+ next groups_position == :above ? 1 : -1
438
+ end
439
+ end
440
+
441
+ result = File.basename(x.display_name.downcase, '.*') <=> File.basename(y.display_name.downcase, '.*')
442
+ if result.zero?
443
+ result = File.extname(x.display_name.downcase) <=> File.extname(y.display_name.downcase)
444
+ if result.zero? && !(x.path.nil? || y.path.nil?)
445
+ result = x.path.downcase <=> y.path.downcase
446
+ end
447
+ end
448
+ result
449
+ end
450
+ end
451
+
452
+ # @return [Array<PBXBuildFile>] the build files associated with the
453
+ # current reference proxy.
454
+ #
455
+ def build_files
456
+ referrers.grep(PBXBuildFile)
457
+ end
458
+
459
+ # In addition to removing the reference proxy, this will also remove any
460
+ # items related to this reference.
461
+ #
462
+ # @see AbstractObject#remove_from_project
463
+ #
464
+ # @return [void]
465
+ #
466
+ def remove_from_project
467
+ build_files.each(&:remove_from_project)
468
+ super
469
+ end
470
+ end
471
+
472
+ #-----------------------------------------------------------------------#
473
+
474
+ # This class is used to gather localized files into one entry.
475
+ #
476
+ class PBXVariantGroup < PBXGroup
477
+ # @!group Attributes
478
+
479
+ # @return [String] the file type guessed by Xcode.
480
+ #
481
+ attribute :last_known_file_type, String
482
+ end
483
+
484
+ #-----------------------------------------------------------------------#
485
+
486
+ # A group that contains multiple files references to the different
487
+ # versions of a resource.
488
+ #
489
+ # Used to contain the different versions of a `xcdatamodel`.
490
+ #
491
+ class XCVersionGroup < PBXGroup
492
+ # @!group Attributes
493
+
494
+ # @return [PBXFileReference] the reference to the current version.
495
+ #
496
+ has_one :current_version, PBXFileReference
497
+
498
+ # @return [String] the type of the versioned resource.
499
+ #
500
+ attribute :version_group_type, String, 'wrapper.xcdatamodel'
501
+ end
502
+
503
+ #-----------------------------------------------------------------------#
504
+ end
505
+ end
506
+ end
@@ -0,0 +1,72 @@
1
+ require 'set'
2
+
3
+ module Xcodeproj
4
+ class Project
5
+ module Object
6
+ class XCBuildConfiguration
7
+ # yes, they are case-sensitive.
8
+ # no, Xcode doesn't do this for other PathList settings nor other
9
+ # settings ending in SEARCH_PATHS.
10
+ module BuildSettingsArraySettingsByObjectVersion
11
+ ARRAY_SETTINGS = %w(
12
+ ALTERNATE_PERMISSIONS_FILES
13
+ ARCHS
14
+ BUILD_VARIANTS
15
+ EXCLUDED_SOURCE_FILE_NAMES
16
+ FRAMEWORK_SEARCH_PATHS
17
+ GCC_PREPROCESSOR_DEFINITIONS
18
+ GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS
19
+ HEADER_SEARCH_PATHS
20
+ INFOPLIST_PREPROCESSOR_DEFINITIONS
21
+ LIBRARY_SEARCH_PATHS
22
+ OTHER_CFLAGS
23
+ OTHER_CPLUSPLUSFLAGS
24
+ OTHER_LDFLAGS
25
+ REZ_SEARCH_PATHS
26
+ SECTORDER_FLAGS
27
+ WARNING_CFLAGS
28
+ WARNING_LDFLAGS
29
+ ).to_set.freeze
30
+ private_constant :ARRAY_SETTINGS
31
+
32
+ ARRAY_SETTINGS_OBJECT_VERSION_50 = %w(
33
+ ALTERNATE_PERMISSIONS_FILES
34
+ ARCHS
35
+ BUILD_VARIANTS
36
+ EXCLUDED_SOURCE_FILE_NAMES
37
+ FRAMEWORK_SEARCH_PATHS
38
+ GCC_PREPROCESSOR_DEFINITIONS
39
+ GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS
40
+ HEADER_SEARCH_PATHS
41
+ INCLUDED_SOURCE_FILE_NAMES
42
+ INFOPLIST_PREPROCESSOR_DEFINITIONS
43
+ LD_RUNPATH_SEARCH_PATHS
44
+ LIBRARY_SEARCH_PATHS
45
+ LOCALIZED_STRING_MACRO_NAMES
46
+ OTHER_CFLAGS
47
+ OTHER_CPLUSPLUSFLAGS
48
+ OTHER_LDFLAGS
49
+ REZ_SEARCH_PATHS
50
+ SECTORDER_FLAGS
51
+ SYSTEM_FRAMEWORK_SEARCH_PATHS
52
+ SYSTEM_HEADER_SEARCH_PATHS
53
+ USER_HEADER_SEARCH_PATHS
54
+ WARNING_CFLAGS
55
+ WARNING_LDFLAGS
56
+ ).to_set.freeze
57
+ private_constant :ARRAY_SETTINGS_OBJECT_VERSION_50
58
+
59
+ def self.[](object_version)
60
+ object_version = object_version.to_i
61
+
62
+ if object_version >= 50
63
+ ARRAY_SETTINGS_OBJECT_VERSION_50
64
+ else
65
+ ARRAY_SETTINGS
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end