From a227b28c5ae7c94e51894dcfde194fbf0fd912a4 Mon Sep 17 00:00:00 2001 From: Albin Date: Mon, 17 Jun 2024 15:21:10 +0200 Subject: [PATCH] Use temp dirs in lockfile script --- android/scripts/update-lockfile.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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"