tuist / XcodeProj

πŸ“ Read, update and write your Xcode projects

Home Page:https://xcodeproj.tuist.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Products" group has the same ID for any project

damirdavletov opened this issue Β· comments

Context πŸ•΅οΈβ€β™€οΈ

"Products" groups have the same IDs for any referenced project when you add them in parallel. This doesn't cause problems when project reference is added serially because xcodeproj will just increment ID if there is an existing one, but when this is done in parallel branches it causes a conflict that can only be resolved manually with manual ID increment. This caused us several issues with corrupted projects which can't be resolved without knowledge on pbxproj file structure.

What 🌱

This issue is caused because all "Products" groups have the same name & location and follow generic group ID generation logic so when permanent ID is generated it is always the same one.

Proposal πŸŽ‰

Add referenced project path/name into "Products" group ID generation so for each referenced project the ID will be different. I'll make a pull request shortly.

HI @damirdavletov thanks for raising. If projects are generated in parallel wouldn't other things aside from the products group theoretically also have the same id, for example file references referencing the same file? Is it worth providing an optional seed for the id generator for cases like these?

Hi @yonaskolb, thanks for looking into this! I didn't see any other issues happening with IDs. File references have different IDs for different files (either path or name differs). For the same file, it is desirable to have the same ID even if added in parallel on separate machines. This way we won't have conflicts if 2 developers add the same project reference for instance.
The problem with Products groups is that they will have the same ID for different referenced projects, resulting in conflicts. To make them consistent with the file references I propose to add project name to the mix.

Apart from Products group issue current ID generation solution works well for us. I believe optional seed will cause more harm than good here as it will break the desirable behaviour of 2 devs adding the same file reference in parallel.