bazelbuild / bazelbuild/rules_apple
Non-deterministic xcassets compilation
- Dominant language
- Starlark
- Stars
- 593
- Forks
- 334
- Avg merge
- 16h 48m
- Merged PRs (30d)
- 9
Description
I have discovered very particular issue related to the `.xcassets` that includes adaptive colors (colors based on appearance setting, AFAIK it also applies to images) are compiled randomly into slightly different `assets.car` files.
I have compared the compiled files several times through the Hex Fiend tool, the difference between them concerns couple of bytes that seems to correspond with the appearance setting. In my case (setting `Any, Dark`) results in two versions of the compiled file - one where these bytes creates a string equal to `Any,Dark` and another where the string is equal to `Dark,Any`.
This causes Bazel to calculate different hashes for them (which of course makes sense) but the original `.xcassets` have not changed, thus, as far as I understand, in worst case scenario we might encounter cache miss where there shouldn't be any.
I haven't found much information about this on the Internet, the `.car` format alone doesn't make it any easier. The issue is not caused by Bazel or its rules but still, it is worth to document its existence.
Issue created as agreed in a [Slack thread](https://bazelbuild.slack.com/archives/CD3QY5C2X/p1677237855575229).
Contributor guide
Research direction
No repository file, test, or entry point is named. Start by reviewing the issue's `.xcassets` and `assets.car` reproduction details, then identify where this behavior should be documented in the project. Done means the nondeterministic compilation and possible cache impact are documented with enough context for users to recognize it.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100