Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ClassDescendants behave deterministically #220

Merged
merged 1 commit into from
Sep 24, 2020

Conversation

comex
Copy link
Contributor

@comex comex commented Sep 23, 2020

Sort descendants by class name. This ensures that generators are run in a deterministic order.

(With this, plus changes to xcodeproj, plus manually calling predictabilize_uuids in my Cakefile, I can get the same project.pbxproj output across multiple runs.)

Sort descendants by class name.  This ensures that generators are run in
a deterministic order.

(With this, plus changes to `xcodeproj`, plus manually calling
`predictabilize_uuids` in my Cakefile, I can get the same
project.pbxproj output across multiple runs.)
@ghost
Copy link

ghost commented Sep 23, 2020

Hi Igor, how are you?
its possible to add pod files in cakefile?

@igor-makarov igor-makarov merged commit 66486c8 into igor-makarov:main Sep 24, 2020
@igor-makarov
Copy link
Owner

Thanks for another PR @comex!
Frankly, I have given up on having a deterministic PBX and just opt to .gitignore it altogether. What is your use case for having a deterministic PBX?

Also, predictabilize_uuids has caused collisions for me in the past so I haven't been using it.

Also, what changes to Xcodeproj? Could you elaborate?

@igor-makarov
Copy link
Owner

igor-makarov commented Sep 24, 2020

@d0bl3c3r0 - you can run pod install in the after_save hook (see here) or just invoke it in the command line after Xcake generation.

@comex comex deleted the dd branch September 25, 2020 17:00
@comex
Copy link
Contributor Author

comex commented Sep 25, 2020

What is your use case for having a deterministic PBX?

Basically, being able to check in the xcodeproj and avoid confusing people about whether, or how much, the build has changed.

Also, predictabilize_uuids has caused collisions for me in the past so I haven't been using it.

I had sort of the opposite problem: predictabilize_uuids didn't actually make UUIDs predictable. The implementation works by iterating over each object, hashing its properties, and assigning a new UUID based on the hash. But in some cases those properties include UUIDs of other objects. It does need to update those properties to point to the new UUIDs (fixup_uuid_references), but it only does that as a separate step after assigning all the new UUIDs. So at the point it hashes the properties, they still point to the old, random UUIDs…

For now, I hacked around that by changing xcodeproj to exclude the problematic properties from the hash. But of course, excluding properties increases the risk of collisions. Also, while I now get the same pbxproj output if the input is identical, if I make even a small change, it causes a cascade of UUID changes that make the pbxproj file seem completely rewritten. I'd prefer smaller diffs.

So I'm going to investigate a different approach.

@igor-makarov
Copy link
Owner

@comex And gitignoring the PBX is not an option?
After all, the build system functionality is entirely derived from the Cakefile/Podfile...

@comex
Copy link
Contributor Author

comex commented Sep 25, 2020

Nope, for various reasons it's not an option for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants