Add full offline Android Gradle Plugin dependency cache
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Download Android Gradle Plugin and all transitive deps into offline-maven.
|
||||
# Run once on a machine with internet access, then commit tauri_app/docker/offline-maven/.
|
||||
# Download AGP + AndroidX runtime deps into offline-maven for isolated LAN builds.
|
||||
# Run once on a machine with internet, then commit tauri_app/docker/offline-maven/.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
@@ -13,22 +13,27 @@ if [ ! -x "${RESOLVER}/gradlew" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "==> Resolving AGP ${AGP_VERSION} dependency tree into ${OFFLINE}"
|
||||
echo "==> Resolving AGP ${AGP_VERSION} + AndroidX deps into ${OFFLINE}"
|
||||
cd "${RESOLVER}"
|
||||
chmod +x ./gradlew
|
||||
./gradlew exportOfflineMaven --no-daemon -PagpVersion="${AGP_VERSION}"
|
||||
sed -i 's/\r$//' ./gradlew 2>/dev/null || true
|
||||
./gradlew exportAllOfflineMaven --no-daemon -PagpVersion="${AGP_VERSION}"
|
||||
|
||||
if [ ! -f "${OFFLINE}/.agp-offline-complete" ]; then
|
||||
echo "Offline export did not complete successfully" >&2
|
||||
exit 1
|
||||
fi
|
||||
required=(
|
||||
"${OFFLINE}/com/android/tools/build/builder/${AGP_VERSION}/builder-${AGP_VERSION}.pom"
|
||||
"${OFFLINE}/androidx/webkit/webkit/1.14.0/webkit-1.14.0.pom"
|
||||
"${OFFLINE}/androidx/appcompat/appcompat/1.7.1/appcompat-1.7.1.pom"
|
||||
"${OFFLINE}/androidx/browser/browser/1.8.0/browser-1.8.0.pom"
|
||||
)
|
||||
|
||||
if [ ! -f "${OFFLINE}/com/android/tools/build/builder/${AGP_VERSION}/builder-${AGP_VERSION}.pom" ]; then
|
||||
echo "Missing required AGP dependency builder:${AGP_VERSION} in offline cache" >&2
|
||||
exit 1
|
||||
fi
|
||||
for file in "${required[@]}"; do
|
||||
if [ ! -f "${file}" ]; then
|
||||
echo "Missing required offline artifact: ${file}" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
TOTAL_SIZE="$(du -sh "${OFFLINE}" | awk '{print $1}')"
|
||||
MODULES="$(find "${OFFLINE}" -name '*.jar' | wc -l | tr -d ' ')"
|
||||
echo "==> Offline AGP cache ready: ${MODULES} jar(s), total ${TOTAL_SIZE}"
|
||||
ARTIFACTS="$(find "${OFFLINE}" \( -name '*.jar' -o -name '*.aar' \) | wc -l | tr -d ' ')"
|
||||
echo "==> Offline Maven cache ready: ${ARTIFACTS} jar/aar, total ${TOTAL_SIZE}"
|
||||
echo "==> Commit tauri_app/docker/offline-maven/ and push to the server"
|
||||
|
||||
Reference in New Issue
Block a user