The XCProjectFile initializer should do a internal consistency check after loading the project file. To prevent runtime crashes on one of the many ! used throughout the code.
I haven't tested this, but my guess is, this should work:
Every 24 character alphanumeric String object reference "somewhere" in the complete object graph is an object reference, and that GUID key should exist in the objects list.
Every object GUID key in the objects should be referenced somewhere in the complete object graph.
If either of these fails, an error like this can be generated:
- BuildFile (46880B8819C43A87006E1F66) references missing fileRef 3EACC98E19EE6D4300EB3C5E
- FileReference `AppDelegate.cpp` (288765A40DF7441C002DB57D) is not used in any BuildFile.
Perhaps a merge conflict?
As a second step, the initializer can take an extra parameter unsafeIgnoreInconsistency: Bool so that the current behaviour can be returned.
Perhaps with a better error message: fatalError("Can't find key '3EACC98E19EE6D4300EB3C5E' in objects, ignored in internal inconsistency check. Perhaps a merge conflict?")
Based on https://github.com/tomlokhorst/Xcode.swift/pull/12
The
XCProjectFile
initializer should do a internal consistency check after loading the project file. To prevent runtime crashes on one of the many!
used throughout the code.I haven't tested this, but my guess is, this should work:
objects
list.objects
should be referenced somewhere in the complete object graph.If either of these fails, an error like this can be generated:
As a second step, the initializer can take an extra parameter
unsafeIgnoreInconsistency: Bool
so that the current behaviour can be returned. Perhaps with a better error message:fatalError("Can't find key '3EACC98E19EE6D4300EB3C5E' in objects, ignored in internal inconsistency check. Perhaps a merge conflict?")