Skip to content

Commit 176dfdc

Browse files
committed
Add script to verify lockfile keys
1 parent 45e477b commit 176dfdc

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6+
cd "$SCRIPT_DIR"
7+
8+
# Disable daemon since it causes problems with the temp dir cleanup
9+
# regardless if stopped.
10+
GRADLE_OPTS="-Dorg.gradle.daemon=false"
11+
# We must provide a template for mktemp to work properly on macOS.
12+
GRADLE_USER_HOME=$(mktemp -d -t gradle-home-XXX)
13+
TEMP_GRADLE_PROJECT_CACHE_DIR=$(mktemp -d -t gradle-cache-XXX)
14+
# Task list to discover all tasks and their dependencies since
15+
# just running the suggested 'help' task isn't sufficient.
16+
GRADLE_TASKS=(
17+
"lint"
18+
)
19+
20+
export GRADLE_OPTS
21+
export GRADLE_USER_HOME
22+
23+
cd ../gradle/
24+
25+
function cleanup {
26+
echo "Cleaning up temp dirs..."
27+
rm -rf -- "$GRADLE_USER_HOME" "$TEMP_GRADLE_PROJECT_CACHE_DIR"
28+
}
29+
30+
trap cleanup EXIT
31+
32+
echo "### Configuration ###"
33+
echo "Gradle home: $GRADLE_USER_HOME"
34+
echo "Gradle cache: $TEMP_GRADLE_PROJECT_CACHE_DIR"
35+
echo ""
36+
37+
echo "Moving checksums to the side..."
38+
mv verification-metadata.xml verification-metadata.checksums.xml
39+
40+
echo "Moving keys to be active metadata file"
41+
mv verification-metadata.keys.xml verification-metadata.xml
42+
43+
echo "Generating new components..."
44+
# Using a loop here since providing all tasks at once result in gradle task dependency issues.
45+
for GRADLE_TASK in "${GRADLE_TASKS[@]}"; do
46+
echo "Gradle task: $GRADLE_TASK"
47+
../gradlew -q -p .. --project-cache-dir "$TEMP_GRADLE_PROJECT_CACHE_DIR" "$GRADLE_TASK"
48+
echo ""
49+
done
50+
51+
echo "Moving back keys verification metadata"
52+
mv verification-metadata.xml verification-metadata.keys.xml
53+
54+
echo ""
55+
echo "Moving back checksums to be active metadata file"
56+
mv verification-metadata.checksums.xml verification-metadata.xml

0 commit comments

Comments
 (0)