Skip to content

Commit

Permalink
Use temp dirs in lockfile script
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-mullvad committed Jun 17, 2024
1 parent 55e2277 commit 69b4767
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion android/scripts/update-lockfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@ 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 ""

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 .. -g "$TEMP_GRADLE_HOME_DIR" --project-cache-dir "$TEMP_GRADLE_PROJECT_CACHE_DIR" -M sha256 "${GRADLE_TASKS[@]}"

0 comments on commit 69b4767

Please sign in to comment.