Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Dependency Cache] Dependency Cache on CI per Project [without GRADLE…
…_RO_DEP_CACHE] (#135) * Gradle: Add project prefix with the standard buildkite pipeline slug This is done in order to avoid having each client project adding its own project prefix to distinguish the Gradle dependency cache key. Test Only PRs: - WCAndroid: https://github.com/woocommerce/woocommerce-android/ pull/13122 - JP/WPAndroid: https://github.com/wordpress-mobile/WordPress-Android/ pull/21540 For example, for WCAndroid, this would mean that instead of using this 'WOOCOMMERCE' value via this 'GRADLE_DEPENDENCY_CACHE_PROJECT_PREFIX' environment variable, which ultimately is creating the below 'WOOCOMMERCE_GRADLE_DEPENDENCY_CACHE' key, instead, with this change the 'woocommerce-android_GRADLE_DEPENDENCY_CACHE' key will be automatically created, taking the 'woocommerce-android' value from the standard 'BUILDKITE_PIPELINE_SLUG' environment variable. For more info see: p1734350857095859-slack-C020Q0Z579V * Gradle: Measure how long it takes to save/restore the cache * Gradle: Measure the (un)compressed cache size during save/restore * Gradle: Add optional cache file to restore cache script This is done in order for us to be able to output the uncompressed cache size during cache restoration, just as it is being done during the cache saving process, for consistency purposes. But, given the fact that are also other clients of this 'restore_cache' script, keeping this parameter optional was the preferred approach in order to not affect, or need to update, any of those other clients of this specific script. * Gradle: Replace gradle ro dependency cache with gradle dependency cache 1. On saving, the script will create a new folder, within the 'GRADLE_HOME' space, named 'dependency-cache', where all the contents from 'caches/modules-2' will be copied after the build finishes (minus '*.lock' and 'gc.properties' files, as per the documentation). 2. On restoring, the script will create the 'caches/modules-2' folder, within the 'GRADLE_HOME' space, and extract the saved contents into it and before the build starts. 3. On restoring, the script will also check if 'modules-2' directory exists prior to placing cache. This check is necessary because during 'restore_cache' it might happen that the dependency cache based on this key is not available for download. Thus, no 'dependency-cache/module-2' folder will exist to be copied into the 'caches/modules-2' folder, which will break the script. * Gradle: Add v2 suffix on the gradle dependency cache key This is done in order to differentiate between the 'GRADLE_RO_DEP_CACHE' and the 'GRADLE_DEP_CACHE' caches, and thus be able to test both caching strategies in-parallel, without one overwriting the other during save, or one reusing the other's cache during restore. Test Only PRs: - WCAndroid: https://github.com/woocommerce/woocommerce-android/ pull/13170 - JP/WPAndroid: https://github.com/wordpress-mobile/WordPress-Android/ pull/21550 * Gradle: Remove uncompressed cache size measurement With this change only the compressed cache size is being measured and echoed simply as 'cache size'. There is no real need to overcomplicate things by echoing both, the compresses and uncompressed cache size.
- Loading branch information