CocoaPods / CocoaPods/Xcodeproj

predictabilize_uuids doesn't work with target dependencies

Open
#848 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Ruby
Stars
2.4k
Forks
488
PR merge metrics
No merged PRs in 30d

Description

predictabilize_uuids doesn't work with target dependencies, for example, if you want to generate a project with targets for both an iOS app and its share extension, the app target needs to depend on the extension target. When "predictabilizing" UUIDs for such a project, the UUIDs for some of the share extension objects will not be stable.

The reason for this is that the original random UUIDs are included in the values of UUIDGenerator's `paths_by_object` property, which must contain only stable data, since it's hashed to to produce the stable UUID.

For my use case, I was able to work around the issue by adding this line:

```diff
def tree_hash_to_path(object, depth = 4)
return '|' if depth.zero?
case object
when Hash
object.sort.each_with_object('') do |(key, value), string|
+ next if key == 'remoteGlobalIDString' || key == 'containerPortal'
string << key << ':' << tree_hash_to_path(value, depth - 1) << ','
end
when Array
object.map do |value|
tree_hash_to_path(value, depth - 1)
end.join(',')
else
object.to_s
end
end
```

However, I don't believe this is a real solution for the problem, since this effectively ignores the target relationships when generating stable IDs.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.