Complete offline Android APK build for isolated LAN servers.
Bundle AndroidX, Kotlin Gradle plugin, and SDK patch scripts so Gradle no longer needs Google Maven at runtime. Bake Gradle wrapper into Docker image during build when network is available. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
30
tauri_app/docker/install-offline-gradle.sh
Normal file
30
tauri_app/docker/install-offline-gradle.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
# Use bundled Gradle wrapper distribution when available (offline LAN builds).
|
||||
set -euo pipefail
|
||||
|
||||
ANDROID_GEN="${1:-/workspace/tauri_app/src-tauri/gen/android}"
|
||||
GRADLE_VERSION="${GRADLE_VERSION:-8.14.3}"
|
||||
|
||||
for candidate in \
|
||||
"/opt/offline-gradle/gradle-${GRADLE_VERSION}-bin.zip" \
|
||||
"/workspace/tauri_app/docker/offline-gradle/gradle-${GRADLE_VERSION}-bin.zip"; do
|
||||
if [ -f "${candidate}" ]; then
|
||||
BUNDLED_ZIP="${candidate}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
WRAPPER_PROPS="${ANDROID_GEN}/gradle/wrapper/gradle-wrapper.properties"
|
||||
if [ -z "${BUNDLED_ZIP:-}" ] || [ ! -f "${WRAPPER_PROPS}" ]; then
|
||||
echo "==> Bundled Gradle ${GRADLE_VERSION} not found, wrapper will use default distributionUrl"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
OFFLINE_ZIP="/opt/offline-gradle/gradle-${GRADLE_VERSION}-bin.zip"
|
||||
mkdir -p /opt/offline-gradle
|
||||
if [ "${BUNDLED_ZIP}" != "${OFFLINE_ZIP}" ]; then
|
||||
cp "${BUNDLED_ZIP}" "${OFFLINE_ZIP}"
|
||||
fi
|
||||
|
||||
sed -i "s|^distributionUrl=.*|distributionUrl=file\\:/opt/offline-gradle/gradle-${GRADLE_VERSION}-bin.zip|" "${WRAPPER_PROPS}"
|
||||
echo "==> Gradle wrapper patched to offline file distribution (${OFFLINE_ZIP})"
|
||||
Reference in New Issue
Block a user