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.
- checksums.yaml +7 -0
- data/LICENSE +19 -0
- data/README.md +95 -0
- data/bin/xcodeproj +10 -0
- data/lib/xcodeproj/command/config_dump.rb +91 -0
- data/lib/xcodeproj/command/project_diff.rb +56 -0
- data/lib/xcodeproj/command/show.rb +60 -0
- data/lib/xcodeproj/command/sort.rb +44 -0
- data/lib/xcodeproj/command/target_diff.rb +43 -0
- data/lib/xcodeproj/command.rb +63 -0
- data/lib/xcodeproj/config/other_linker_flags_parser.rb +73 -0
- data/lib/xcodeproj/config.rb +386 -0
- data/lib/xcodeproj/constants.rb +465 -0
- data/lib/xcodeproj/differ.rb +239 -0
- data/lib/xcodeproj/gem_version.rb +5 -0
- data/lib/xcodeproj/helper.rb +30 -0
- data/lib/xcodeproj/plist.rb +94 -0
- data/lib/xcodeproj/project/case_converter.rb +90 -0
- data/lib/xcodeproj/project/object/build_configuration.rb +255 -0
- data/lib/xcodeproj/project/object/build_file.rb +84 -0
- data/lib/xcodeproj/project/object/build_phase.rb +369 -0
- data/lib/xcodeproj/project/object/build_rule.rb +109 -0
- data/lib/xcodeproj/project/object/configuration_list.rb +117 -0
- data/lib/xcodeproj/project/object/container_item_proxy.rb +116 -0
- data/lib/xcodeproj/project/object/file_reference.rb +338 -0
- data/lib/xcodeproj/project/object/group.rb +506 -0
- data/lib/xcodeproj/project/object/helpers/build_settings_array_settings_by_object_version.rb +72 -0
- data/lib/xcodeproj/project/object/helpers/file_references_factory.rb +245 -0
- data/lib/xcodeproj/project/object/helpers/groupable_helper.rb +260 -0
- data/lib/xcodeproj/project/object/native_target.rb +751 -0
- data/lib/xcodeproj/project/object/reference_proxy.rb +86 -0
- data/lib/xcodeproj/project/object/root_object.rb +100 -0
- data/lib/xcodeproj/project/object/swift_package_product_dependency.rb +29 -0
- data/lib/xcodeproj/project/object/swift_package_remote_reference.rb +33 -0
- data/lib/xcodeproj/project/object/target_dependency.rb +94 -0
- data/lib/xcodeproj/project/object.rb +534 -0
- data/lib/xcodeproj/project/object_attributes.rb +522 -0
- data/lib/xcodeproj/project/object_dictionary.rb +210 -0
- data/lib/xcodeproj/project/object_list.rb +223 -0
- data/lib/xcodeproj/project/project_helper.rb +341 -0
- data/lib/xcodeproj/project/uuid_generator.rb +132 -0
- data/lib/xcodeproj/project.rb +874 -0
- data/lib/xcodeproj/scheme/abstract_scheme_action.rb +100 -0
- data/lib/xcodeproj/scheme/analyze_action.rb +19 -0
- data/lib/xcodeproj/scheme/archive_action.rb +59 -0
- data/lib/xcodeproj/scheme/build_action.rb +298 -0
- data/lib/xcodeproj/scheme/buildable_product_runnable.rb +55 -0
- data/lib/xcodeproj/scheme/buildable_reference.rb +129 -0
- data/lib/xcodeproj/scheme/command_line_arguments.rb +162 -0
- data/lib/xcodeproj/scheme/environment_variables.rb +170 -0
- data/lib/xcodeproj/scheme/execution_action.rb +86 -0
- data/lib/xcodeproj/scheme/launch_action.rb +179 -0
- data/lib/xcodeproj/scheme/location_scenario_reference.rb +49 -0
- data/lib/xcodeproj/scheme/macro_expansion.rb +34 -0
- data/lib/xcodeproj/scheme/profile_action.rb +57 -0
- data/lib/xcodeproj/scheme/remote_runnable.rb +92 -0
- data/lib/xcodeproj/scheme/send_email_action_content.rb +84 -0
- data/lib/xcodeproj/scheme/shell_script_action_content.rb +77 -0
- data/lib/xcodeproj/scheme/test_action.rb +394 -0
- data/lib/xcodeproj/scheme/xml_element_wrapper.rb +82 -0
- data/lib/xcodeproj/scheme.rb +375 -0
- data/lib/xcodeproj/user_interface.rb +22 -0
- data/lib/xcodeproj/workspace/file_reference.rb +79 -0
- data/lib/xcodeproj/workspace/group_reference.rb +67 -0
- data/lib/xcodeproj/workspace/reference.rb +40 -0
- data/lib/xcodeproj/workspace.rb +277 -0
- data/lib/xcodeproj/xcodebuild_helper.rb +108 -0
- data/lib/xcodeproj.rb +29 -0
- metadata +208 -0
@@ -0,0 +1,534 @@
|
|
1
|
+
module Xcodeproj
|
2
|
+
class Project
|
3
|
+
# This is the namespace in which all the classes that wrap the objects in
|
4
|
+
# a Xcode project reside.
|
5
|
+
#
|
6
|
+
# The base class from which all classes inherit is AbstractObject.
|
7
|
+
#
|
8
|
+
# If you need to deal with these classes directly, it's possible to include
|
9
|
+
# this namespace into yours, making it unnecessary to prefix them with
|
10
|
+
# Xcodeproj::Project::Object.
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# class SourceFileSorter
|
14
|
+
# include Xcodeproj::Project::Object
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
module Object
|
18
|
+
# @abstract
|
19
|
+
#
|
20
|
+
# This is the base class of all object types that can exist in a Xcode
|
21
|
+
# project. As such it provides common behavior, but you can only use
|
22
|
+
# instances of subclasses of AbstractObject, because this class does
|
23
|
+
# not exist in actual Xcode projects.
|
24
|
+
#
|
25
|
+
# Almost all the methods implemented by this class are not expected to be
|
26
|
+
# used by {Xcodeproj} clients.
|
27
|
+
#
|
28
|
+
# Subclasses should clearly identify which methods reflect the xcodeproj
|
29
|
+
# document model and which methods are offered as convenience. Object
|
30
|
+
# lists always represent a relationship to many of the model while simple
|
31
|
+
# arrays represent dynamically generated values offered a convenience for
|
32
|
+
# clients.
|
33
|
+
#
|
34
|
+
class AbstractObject
|
35
|
+
# @!group AbstractObject
|
36
|
+
|
37
|
+
# @return [String] the ISA of the class.
|
38
|
+
#
|
39
|
+
def self.isa
|
40
|
+
@isa ||= name.split('::').last
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [String] the object's class name.
|
44
|
+
#
|
45
|
+
attr_reader :isa
|
46
|
+
|
47
|
+
# It is not recommended to instantiate objects through this
|
48
|
+
# constructor. To create objects manually is easier to use
|
49
|
+
# the {Project#new}. Otherwise, it is possible to use the convenience
|
50
|
+
# methods offered by {Xcodeproj} which take care of configuring the
|
51
|
+
# objects for common usage cases.
|
52
|
+
#
|
53
|
+
# @param [Project] project
|
54
|
+
# the project that will host the object.
|
55
|
+
#
|
56
|
+
# @param [String] uuid
|
57
|
+
# the UUID of the new object.
|
58
|
+
#
|
59
|
+
# @visibility private
|
60
|
+
#
|
61
|
+
def initialize(project, uuid)
|
62
|
+
@project = project
|
63
|
+
@uuid = uuid
|
64
|
+
@isa = self.class.isa
|
65
|
+
@referrers = []
|
66
|
+
unless @isa =~ /^(PBX|XC)/
|
67
|
+
raise "[Xcodeproj] Attempt to initialize an abstract class (#{self.class})."
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Initializes the object with the default values of simple attributes.
|
72
|
+
#
|
73
|
+
# This method is called by the {Project#new} and is not performed on
|
74
|
+
# initialization to prevent adding defaults to objects generated by a
|
75
|
+
# plist.
|
76
|
+
#
|
77
|
+
# @return [void]
|
78
|
+
#
|
79
|
+
# @visibility private
|
80
|
+
#
|
81
|
+
def initialize_defaults
|
82
|
+
simple_attributes.each { |a| a.set_default(self) }
|
83
|
+
end
|
84
|
+
|
85
|
+
# @return [String] the object universally unique identifier.
|
86
|
+
#
|
87
|
+
attr_reader :uuid
|
88
|
+
|
89
|
+
# @return [Project] the project that owns the object.
|
90
|
+
#
|
91
|
+
attr_reader :project
|
92
|
+
|
93
|
+
# Removes the object from the project by asking to its referrers to
|
94
|
+
# remove the reference to it.
|
95
|
+
#
|
96
|
+
# @note The root object is owned by the project and should not be
|
97
|
+
# manipulated with this method.
|
98
|
+
#
|
99
|
+
# @return [void]
|
100
|
+
#
|
101
|
+
def remove_from_project
|
102
|
+
mark_project_as_dirty!
|
103
|
+
project.objects_by_uuid.delete(uuid)
|
104
|
+
|
105
|
+
referrers.dup.each do |referrer|
|
106
|
+
referrer.remove_reference(self)
|
107
|
+
end
|
108
|
+
|
109
|
+
to_one_attributes.each do |attrb|
|
110
|
+
object = attrb.get_value(self)
|
111
|
+
object.remove_referrer(self) if object
|
112
|
+
end
|
113
|
+
|
114
|
+
to_many_attributes.each do |attrb|
|
115
|
+
list = attrb.get_value(self)
|
116
|
+
list.clear
|
117
|
+
end
|
118
|
+
|
119
|
+
unless referrers.count == 0
|
120
|
+
raise "[Xcodeproj] BUG: #{self} should have no referrers instead" \
|
121
|
+
"the following objects are still referencing it #{referrers}"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# Returns the value of the name attribute or returns a generic name for
|
126
|
+
# the object.
|
127
|
+
#
|
128
|
+
# @note Not all concrete classes implement the name attribute and this
|
129
|
+
# method prevents from overriding it in plist.
|
130
|
+
#
|
131
|
+
# @return [String] a name for the object.
|
132
|
+
#
|
133
|
+
def display_name
|
134
|
+
declared_name = name if self.respond_to?(:name)
|
135
|
+
if declared_name && !declared_name.empty?
|
136
|
+
declared_name
|
137
|
+
else
|
138
|
+
isa.gsub(/^(PBX|XC)/, '')
|
139
|
+
end
|
140
|
+
end
|
141
|
+
alias_method :to_s, :display_name
|
142
|
+
|
143
|
+
# Sorts the to many attributes of the object according to the display
|
144
|
+
# name.
|
145
|
+
#
|
146
|
+
def sort(_options = nil)
|
147
|
+
to_many_attributes.each do |attrb|
|
148
|
+
list = attrb.get_value(self)
|
149
|
+
list.sort! do |x, y|
|
150
|
+
x.display_name.downcase <=> y.display_name.downcase
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# Sorts the object and the objects that it references.
|
156
|
+
#
|
157
|
+
# @param [Hash] options
|
158
|
+
# the sorting options.
|
159
|
+
# @option options [Symbol] :groups_position
|
160
|
+
# the position of the groups can be either `:above` or
|
161
|
+
# `:below`.
|
162
|
+
#
|
163
|
+
# @note Some objects may in turn refer back to objects higher in the
|
164
|
+
# object tree, which will lead to stack level deep errors.
|
165
|
+
# These objects should **not** try to perform a recursive sort,
|
166
|
+
# also because these objects would get sorted through other
|
167
|
+
# paths in the tree anyways.
|
168
|
+
#
|
169
|
+
# At the time of writing the only known case is
|
170
|
+
# `PBXTargetDependency`.
|
171
|
+
#
|
172
|
+
def sort_recursively(options = nil)
|
173
|
+
to_one_attributes.each do |attrb|
|
174
|
+
value = attrb.get_value(self)
|
175
|
+
value.sort_recursively(options) if value
|
176
|
+
end
|
177
|
+
|
178
|
+
to_many_attributes.each do |attrb|
|
179
|
+
list = attrb.get_value(self)
|
180
|
+
list.each { |entry| entry.sort_recursively(options) }
|
181
|
+
end
|
182
|
+
|
183
|
+
sort(options)
|
184
|
+
end
|
185
|
+
|
186
|
+
# @!group Reference counting
|
187
|
+
|
188
|
+
# @return [Array<ObjectList>] The list of the objects that have a
|
189
|
+
# reference to this object.
|
190
|
+
#
|
191
|
+
# @visibility private
|
192
|
+
#
|
193
|
+
attr_reader :referrers
|
194
|
+
|
195
|
+
# Informs the object that another object is referencing it. If the
|
196
|
+
# object had no previous references it is added to the project UUIDs
|
197
|
+
# hash.
|
198
|
+
#
|
199
|
+
# @return [void]
|
200
|
+
#
|
201
|
+
# @visibility private
|
202
|
+
#
|
203
|
+
def add_referrer(referrer)
|
204
|
+
@referrers << referrer
|
205
|
+
@project.objects_by_uuid[uuid] = self
|
206
|
+
end
|
207
|
+
|
208
|
+
# Informs the object that another object stopped referencing it. If the
|
209
|
+
# object has no other references it is removed from the project UUIDs
|
210
|
+
# hash because it is unreachable.
|
211
|
+
#
|
212
|
+
# @return [void]
|
213
|
+
#
|
214
|
+
# @visibility private
|
215
|
+
#
|
216
|
+
def remove_referrer(referrer)
|
217
|
+
@referrers.delete(referrer)
|
218
|
+
if @referrers.count == 0
|
219
|
+
mark_project_as_dirty!
|
220
|
+
@project.objects_by_uuid.delete(uuid)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
# Removes all the references to a given object.
|
225
|
+
#
|
226
|
+
# @return [void]
|
227
|
+
#
|
228
|
+
# @visibility private
|
229
|
+
#
|
230
|
+
def remove_reference(object)
|
231
|
+
to_one_attributes.each do |attrb|
|
232
|
+
value = attrb.get_value(self)
|
233
|
+
attrb.set_value(self, nil) if value.equal?(object)
|
234
|
+
end
|
235
|
+
|
236
|
+
to_many_attributes.each do |attrb|
|
237
|
+
list = attrb.get_value(self)
|
238
|
+
list.delete(object)
|
239
|
+
end
|
240
|
+
|
241
|
+
references_by_keys_attributes.each do |attrb|
|
242
|
+
list = attrb.get_value(self)
|
243
|
+
list.each { |dictionary| dictionary.remove_reference(object) }
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
# Marks the project that this object belongs to as having been modified.
|
248
|
+
#
|
249
|
+
# @return [void]
|
250
|
+
#
|
251
|
+
# @visibility private
|
252
|
+
#
|
253
|
+
def mark_project_as_dirty!
|
254
|
+
project.mark_dirty!
|
255
|
+
end
|
256
|
+
|
257
|
+
#---------------------------------------------------------------------#
|
258
|
+
|
259
|
+
public
|
260
|
+
|
261
|
+
# @!group Plist related methods
|
262
|
+
|
263
|
+
# Configures the object with the objects hash from a plist.
|
264
|
+
#
|
265
|
+
# **Implementation detail**: it is important that the attributes for a
|
266
|
+
# given concrete class are unique because the value is removed from the
|
267
|
+
# array at each iteration and duplicate would result in nil values.
|
268
|
+
#
|
269
|
+
# @return [void]
|
270
|
+
#
|
271
|
+
# @visibility private
|
272
|
+
#
|
273
|
+
def configure_with_plist(objects_by_uuid_plist)
|
274
|
+
object_plist = objects_by_uuid_plist[uuid].dup
|
275
|
+
|
276
|
+
unless object_plist['isa'] == isa
|
277
|
+
raise "[Xcodeproj] Attempt to initialize `#{isa}` from plist with " \
|
278
|
+
"different isa `#{object_plist}`"
|
279
|
+
end
|
280
|
+
object_plist.delete('isa')
|
281
|
+
|
282
|
+
simple_attributes.each do |attrb|
|
283
|
+
attrb.set_value(self, object_plist[attrb.plist_name])
|
284
|
+
object_plist.delete(attrb.plist_name)
|
285
|
+
end
|
286
|
+
|
287
|
+
to_one_attributes.each do |attrb|
|
288
|
+
ref_uuid = object_plist[attrb.plist_name]
|
289
|
+
if ref_uuid
|
290
|
+
ref = object_with_uuid(ref_uuid, objects_by_uuid_plist, attrb)
|
291
|
+
attrb.set_value(self, ref) if ref
|
292
|
+
end
|
293
|
+
object_plist.delete(attrb.plist_name)
|
294
|
+
end
|
295
|
+
|
296
|
+
to_many_attributes.each do |attrb|
|
297
|
+
ref_uuids = object_plist[attrb.plist_name] || []
|
298
|
+
list = attrb.get_value(self)
|
299
|
+
ref_uuids.each do |uuid|
|
300
|
+
ref = object_with_uuid(uuid, objects_by_uuid_plist, attrb)
|
301
|
+
list << ref if ref
|
302
|
+
end
|
303
|
+
object_plist.delete(attrb.plist_name)
|
304
|
+
end
|
305
|
+
|
306
|
+
references_by_keys_attributes.each do |attrb|
|
307
|
+
hashes = object_plist[attrb.plist_name] || {}
|
308
|
+
list = attrb.get_value(self)
|
309
|
+
hashes.each do |hash|
|
310
|
+
dictionary = ObjectDictionary.new(attrb, self)
|
311
|
+
hash.each do |key, uuid|
|
312
|
+
ref = object_with_uuid(uuid, objects_by_uuid_plist, attrb)
|
313
|
+
dictionary[key] = ref if ref
|
314
|
+
end
|
315
|
+
list << dictionary
|
316
|
+
end
|
317
|
+
object_plist.delete(attrb.plist_name)
|
318
|
+
end
|
319
|
+
|
320
|
+
unless object_plist.empty?
|
321
|
+
UI.warn "[!] Xcodeproj doesn't know about the following " \
|
322
|
+
"attributes #{object_plist.inspect} for the '#{isa}' isa." \
|
323
|
+
"\nIf this attribute was generated by Xcode please file " \
|
324
|
+
'an issue: https://github.com/CocoaPods/Xcodeproj/issues/new'
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
# Initializes and returns the object with the given UUID.
|
329
|
+
#
|
330
|
+
# @param [String] uuid
|
331
|
+
# The UUID of the object that should be initialized.
|
332
|
+
#
|
333
|
+
# @param [Hash{String=>String}] objects_by_uuid_plist
|
334
|
+
# The hash contained by `objects` key of the plist containing
|
335
|
+
# the information about the object that should be initialized.
|
336
|
+
#
|
337
|
+
# @param [AbstractObjectAttribute] attribute
|
338
|
+
# The attribute that requested the object. It is used only for
|
339
|
+
# exceptions.
|
340
|
+
#
|
341
|
+
# @raise If the hash for the given UUID contains an unknown ISA.
|
342
|
+
#
|
343
|
+
# @return [AbstractObject] the initialized object.
|
344
|
+
# @return [Nil] if the UUID could not be found in the objects hash. In
|
345
|
+
# this case a warning is printed to STDERR.
|
346
|
+
#
|
347
|
+
# @visibility private
|
348
|
+
#
|
349
|
+
def object_with_uuid(uuid, objects_by_uuid_plist, attribute)
|
350
|
+
unless object = project.objects_by_uuid[uuid] || project.new_from_plist(uuid, objects_by_uuid_plist)
|
351
|
+
UI.warn "`#{inspect}` attempted to initialize an object with " \
|
352
|
+
"an unknown UUID. `#{uuid}` for attribute: " \
|
353
|
+
"`#{attribute.name}`. This can be the result of a merge and " \
|
354
|
+
'the unknown UUID is being discarded.'
|
355
|
+
end
|
356
|
+
object
|
357
|
+
rescue NameError
|
358
|
+
attributes = objects_by_uuid_plist[uuid]
|
359
|
+
raise "`#{isa}` attempted to initialize an object with unknown ISA "\
|
360
|
+
"`#{attributes['isa']}` from attributes: `#{attributes}`\n" \
|
361
|
+
'If this ISA was generated by Xcode please file an issue: ' \
|
362
|
+
'https://github.com/CocoaPods/Xcodeproj/issues/new'
|
363
|
+
end
|
364
|
+
|
365
|
+
# Returns a cascade representation of the object with UUIDs.
|
366
|
+
#
|
367
|
+
# @return [Hash] a hash representation of the project.
|
368
|
+
#
|
369
|
+
# @visibility public
|
370
|
+
#
|
371
|
+
# @note the key for simple and to_one attributes usually appears only
|
372
|
+
# if there is a value. To-many keys always appear with an empty
|
373
|
+
# array.
|
374
|
+
#
|
375
|
+
def to_hash
|
376
|
+
to_hash_as
|
377
|
+
end
|
378
|
+
|
379
|
+
def to_hash_as(method = :to_hash)
|
380
|
+
plist = {}
|
381
|
+
plist['isa'] = isa
|
382
|
+
|
383
|
+
simple_attributes.each do |attrb|
|
384
|
+
value = attrb.get_value(self)
|
385
|
+
plist[attrb.plist_name] = value if value
|
386
|
+
end
|
387
|
+
|
388
|
+
to_one_attributes.each do |attrb|
|
389
|
+
obj = attrb.get_value(self)
|
390
|
+
plist[attrb.plist_name] = nested_object_for_hash(obj, method) if obj
|
391
|
+
end
|
392
|
+
|
393
|
+
to_many_attributes.each do |attrb|
|
394
|
+
list = attrb.get_value(self)
|
395
|
+
plist[attrb.plist_name] = list.map { |o| nested_object_for_hash(o, method) }
|
396
|
+
end
|
397
|
+
|
398
|
+
references_by_keys_attributes.each do |attrb|
|
399
|
+
list = attrb.get_value(self)
|
400
|
+
plist[attrb.plist_name] = list.map(&method)
|
401
|
+
end
|
402
|
+
|
403
|
+
plist
|
404
|
+
end
|
405
|
+
private :to_hash_as
|
406
|
+
|
407
|
+
def nested_object_for_hash(object, method)
|
408
|
+
case method
|
409
|
+
when :to_ascii_plist
|
410
|
+
Nanaimo::String.new(object.uuid, object.ascii_plist_annotation)
|
411
|
+
else
|
412
|
+
object.uuid
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
def ascii_plist_annotation
|
417
|
+
" #{display_name} "
|
418
|
+
end
|
419
|
+
|
420
|
+
def to_ascii_plist
|
421
|
+
Nanaimo::Dictionary.new(to_hash_as(:to_ascii_plist), ascii_plist_annotation)
|
422
|
+
end
|
423
|
+
|
424
|
+
# Returns a cascade representation of the object without UUIDs.
|
425
|
+
#
|
426
|
+
# This method is designed to work in conjunction with
|
427
|
+
# {Hash#recursive_diff} to provide a complete, yet readable, diff of
|
428
|
+
# two projects *not* affected by ISA differences.
|
429
|
+
#
|
430
|
+
# @todo The current implementation might lead to infinite loops.
|
431
|
+
#
|
432
|
+
# @return [Hash] a hash representation of the project different from
|
433
|
+
# the plist one.
|
434
|
+
#
|
435
|
+
# @visibility private
|
436
|
+
#
|
437
|
+
def to_tree_hash
|
438
|
+
hash = {}
|
439
|
+
hash['displayName'] = display_name
|
440
|
+
hash['isa'] = isa
|
441
|
+
|
442
|
+
simple_attributes.each do |attrb|
|
443
|
+
value = attrb.get_value(self)
|
444
|
+
hash[attrb.plist_name] = value if value
|
445
|
+
end
|
446
|
+
|
447
|
+
to_one_attributes.each do |attrb|
|
448
|
+
obj = attrb.get_value(self)
|
449
|
+
hash[attrb.plist_name] = obj.to_tree_hash if obj
|
450
|
+
end
|
451
|
+
|
452
|
+
to_many_attributes.each do |attrb|
|
453
|
+
list = attrb.get_value(self)
|
454
|
+
hash[attrb.plist_name] = list.map(&:to_tree_hash)
|
455
|
+
end
|
456
|
+
|
457
|
+
references_by_keys_attributes.each do |attrb|
|
458
|
+
list = attrb.get_value(self)
|
459
|
+
hash[attrb.plist_name] = list.map(&:to_tree_hash)
|
460
|
+
end
|
461
|
+
|
462
|
+
hash
|
463
|
+
end
|
464
|
+
|
465
|
+
# @return [Hash{String => Hash}] A hash suitable to display the object
|
466
|
+
# to the user.
|
467
|
+
#
|
468
|
+
def pretty_print
|
469
|
+
if to_many_attributes.count == 1
|
470
|
+
children = to_many_attributes.first.get_value(self)
|
471
|
+
{ display_name => children.map(&:pretty_print) }
|
472
|
+
else
|
473
|
+
display_name
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
#---------------------------------------------------------------------#
|
478
|
+
|
479
|
+
public
|
480
|
+
|
481
|
+
# @!group Object methods
|
482
|
+
|
483
|
+
def ==(other)
|
484
|
+
other.is_a?(AbstractObject) && to_hash == other.to_hash
|
485
|
+
end
|
486
|
+
|
487
|
+
def <=>(other)
|
488
|
+
uuid <=> other.uuid
|
489
|
+
end
|
490
|
+
|
491
|
+
def inspect
|
492
|
+
optional = ''
|
493
|
+
optional << " name=`#{name}`" if respond_to?(:name) && name
|
494
|
+
optional << " path=`#{path}`" if respond_to?(:path) && path
|
495
|
+
"<#{isa}#{optional} UUID=`#{uuid}`>"
|
496
|
+
end
|
497
|
+
end
|
498
|
+
end
|
499
|
+
end
|
500
|
+
end
|
501
|
+
|
502
|
+
require 'xcodeproj/project/case_converter'
|
503
|
+
require 'xcodeproj/project/object_attributes'
|
504
|
+
require 'xcodeproj/project/object_dictionary'
|
505
|
+
require 'xcodeproj/project/object_list'
|
506
|
+
|
507
|
+
# Required because some classes have cyclical references to each other.
|
508
|
+
#
|
509
|
+
# @todo I'm sure that there is a method to achieve the same result which
|
510
|
+
# doesn't present the risk of some rubist laughing at me :-)
|
511
|
+
#
|
512
|
+
Xcodeproj::Constants::KNOWN_ISAS.each do |superclass_name, isas|
|
513
|
+
superklass = Xcodeproj::Project::Object.const_get(superclass_name)
|
514
|
+
isas.each do |isa|
|
515
|
+
c = Class.new(superklass)
|
516
|
+
Xcodeproj::Project::Object.const_set(isa, c)
|
517
|
+
end
|
518
|
+
end
|
519
|
+
|
520
|
+
# Now load the concrete subclasses.
|
521
|
+
require 'xcodeproj/project/object/swift_package_remote_reference'
|
522
|
+
require 'xcodeproj/project/object/swift_package_product_dependency'
|
523
|
+
require 'xcodeproj/project/object/build_configuration'
|
524
|
+
require 'xcodeproj/project/object/build_file'
|
525
|
+
require 'xcodeproj/project/object/build_phase'
|
526
|
+
require 'xcodeproj/project/object/build_rule'
|
527
|
+
require 'xcodeproj/project/object/configuration_list'
|
528
|
+
require 'xcodeproj/project/object/container_item_proxy'
|
529
|
+
require 'xcodeproj/project/object/file_reference'
|
530
|
+
require 'xcodeproj/project/object/group'
|
531
|
+
require 'xcodeproj/project/object/native_target'
|
532
|
+
require 'xcodeproj/project/object/root_object'
|
533
|
+
require 'xcodeproj/project/object/target_dependency'
|
534
|
+
require 'xcodeproj/project/object/reference_proxy'
|