yonaskolb / XcodeGen

A Swift command line tool for generating your Xcode project
MIT License
7.01k stars 818 forks source link

Don't add `PBXContainerItemProxy` when reusing `PBXReferenceProxy` #1377

Closed liamnichols closed 1 year ago

liamnichols commented 1 year ago

Fixes https://github.com/yonaskolb/XcodeGen/pull/1354#issuecomment-1650099512

In an unrelated test, I spotted that the recent changes in #1354 were mistakenly creating orphaned PBXContainerItemProxy objects in the project file. This change updates the fixture tests to reproduce the issue and applies a patch (check out the individual commits to see the impact).

liamnichols commented 1 year ago

On a side note, I became aware of this because we use R.swift in our project, which uses XcodeEdit, which has a validator to check for orphaned object references in the project file:

https://github.com/tomlokhorst/XcodeEdit/blob/cd466d6e8c5ffd2f2b61165d37b0646f09068e1e/Sources/XcodeEdit/AllObjects.swift#L142-L176

I wonder if it would be beneficial/possible for XcodeGen to perform a similar validation 🤔 Either just in the unit tests, or maybe even at runtime