summaryrefslogtreecommitdiffhomepage
path: root/android/scripts
diff options
context:
space:
mode:
authorAlbin <albin@mullvad.net>2024-06-17 15:21:10 +0200
committerAlbin <albin@mullvad.net>2024-06-18 09:43:50 +0200
commit535a0739b7841135b6ef4175c1c5b58b46ef8d05 (patch)
treefb01b90cb883f28f254898f4a1794be0bce615fc /android/scripts
parente19b1f35f5180542af65af2f9afcc32fb4efdfcb (diff)
downloadmullvadvpn-535a0739b7841135b6ef4175c1c5b58b46ef8d05.tar.xz
mullvadvpn-535a0739b7841135b6ef4175c1c5b58b46ef8d05.zip
Use temp dirs in lockfile script
Diffstat (limited to 'android/scripts')
-rwxr-xr-xandroid/scripts/update-lockfile.sh22
1 files changed, 21 insertions, 1 deletions
diff --git a/android/scripts/update-lockfile.sh b/android/scripts/update-lockfile.sh
index 594bed5fbe..d215da116b 100755
--- a/android/scripts/update-lockfile.sh
+++ b/android/scripts/update-lockfile.sh
@@ -5,11 +5,31 @@ set -eu
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
+# Disable daemon since it causes problems with the temp dir cleanup
+# regardless if stopped.
+GRADLE_OPTS="-Dorg.gradle.daemon=false"
+# We must provide a template for mktemp to work properly on macOS.
+GRADLE_USER_HOME=$(mktemp -d -t gradle-home-XXX)
+TEMP_GRADLE_PROJECT_CACHE_DIR=$(mktemp -d -t gradle-cache-XXX)
+GRADLE_TASKS=("assemble" "compileDebugUnitTestKotlin" "assembleAndroidTest" "lint")
+
+export GRADLE_OPTS
+export GRADLE_USER_HOME
+
+function cleanup {
+ echo "Cleaning up temp dirs..."
+ rm -rf -- "$GRADLE_USER_HOME" "$TEMP_GRADLE_PROJECT_CACHE_DIR"
+}
+
+trap cleanup EXIT
+
echo "### Updating dependency lockfile ###"
+echo "Gradle home: $GRADLE_USER_HOME"
+echo "Gradle cache: $TEMP_GRADLE_PROJECT_CACHE_DIR"
echo ""
echo "Removing old components..."
sed -i '/<components>/,/<\/components>/d' ../gradle/verification-metadata.xml
echo "Generating new components..."
-../gradlew -q -p .. -M sha256 assemble compileDebugUnitTestKotlin assembleAndroidTest lint
+../gradlew -q -p .. --project-cache-dir "$TEMP_GRADLE_PROJECT_CACHE_DIR" -M sha256 "${GRADLE_TASKS[@]}"