nokeedev / gradle-native

The home of anything about Gradle support for natively compiled languages
https://nokee.dev
Apache License 2.0
47 stars 8 forks source link

Enable build cache on Xcode target build task #814

Closed lacasseio closed 1 year ago

lacasseio commented 1 year ago

This PR strictly enables build caching. The caching is inefficient as it will cache <derivedDataPath>/Build/Products, accumulating all the task's dependency outputs. We need to isolate the declared outputs to solve this inefficiency, which is easier said than done. Gradle only accepts files/directories and not "location", making it virtually impossible to declare the outputs to Gradle correctly. Instead, we will declare a single output directory (the isolated derived data path) and sync only the declared outputs before the task finishes. This work will be done in another PR. We still have a good performance gain over Xcode (~2min less over a 7min build) on a fully cached build. On API changes, we can expect a full rebuild starting from where Gradle misses a cache entry. Note that if a change doesn't result in a byte change to the outputs, Gradle will continue to restore from the cache as it doesn't rely on modification time.