react-native-community / react-native-circleci-orb

A CircleCI Orb to Simplify Testing your React Native App
MIT License
176 stars 80 forks source link

fix(android): fix gradle build cache key #130

Closed fotos closed 2 years ago

fotos commented 2 years ago

Description

Fixes the gradle build cache key used for saving caches. It should match the key used during restore, otherwise there will never be a cache hit.

gradle-cache-key

If the build_type needs to be taken into consideration, I can update the PR to:

diff --git a/src/commands/android_build.yml b/src/commands/android_build.yml
index 68bd274..befedfb 100644
--- a/src/commands/android_build.yml
+++ b/src/commands/android_build.yml
@@ -40,7 +40,7 @@ steps:
         - restore_cache:
             name: Restoring Gradle Build caches
             keys:
-              - gradle-build-cache-{{ .Revision }}
+              - gradle-<<parameters.build_type>>-build-cache-{{ .Revision }}

   - run:
       name: Dispersing Gradle Build caches for restoring
@@ -92,5 +92,5 @@ steps:
             name: Saving Gradle Build caches
             paths:
               - ~/gradle-build-caches
-            key: gradle-debug-build-cache-{{ .Revision }}
+            key: gradle-<<parameters.build_type>>-build-cache-{{ .Revision }}
             when: always
react-native-community-bot commented 2 years ago

:tada: This PR is included in version 6.2.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: