diff --git a/android/scripts/update-lockfile.sh b/android/scripts/update-lockfile.sh index 594bed5fbe48..a5ad50eef04f 100755 --- a/android/scripts/update-lockfile.sh +++ b/android/scripts/update-lockfile.sh @@ -5,6 +5,18 @@ set -eu SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$SCRIPT_DIR" +GRADLE_TASKS="assemble compileDebugUnitTestKotlin assembleAndroidTest lint" + +TEMP_GRADLE_HOME_DIR=$(mktemp -d) +TEMP_GRADLE_PROJECT_CACHE_DIR=$(mktemp -d) + +function cleanup { + echo "Cleaning up temp dirs..." + rm -rf "$TEMP_GRADLE_HOME_DIR" "$TEMP_GRADLE_PROJECT_CACHE_DIR" +} + +trap cleanup EXIT + echo "### Updating dependency lockfile ###" echo "" @@ -12,4 +24,4 @@ echo "Removing old components..." sed -i '//,/<\/components>/d' ../gradle/verification-metadata.xml echo "Generating new components..." -../gradlew -q -p .. -M sha256 assemble compileDebugUnitTestKotlin assembleAndroidTest lint +../gradlew -q -p .. -g "$TEMP_GRADLE_HOME_DIR" --project-cache-dir "$TEMP_GRADLE_PROJECT_CACHE_DIR" -M sha256 "$GRADLE_TASKS"