From 28e5d911a268f31eebd0d4b6e916ce0e8fa1ae5f Mon Sep 17 00:00:00 2001 From: Compot Developer Date: Fri, 16 Oct 2026 23:08:23 +0000 Subject: [PATCH 1/3] android/build.sh: VTESSE_ANDROID_IMAGE uses a ready image instead of building one Without the variable nothing changes: ci/Dockerfile.android is built as vtesse-android and used, as in CI. With it the script skips docker build and runs gradle in the given image, which must provide JDK 17, the SDK/NDK/CMake of ci/Dockerfile.android and gradle on PATH. --- android/README.md | 1 + android/build.sh | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/android/README.md b/android/README.md index 2288196..64b898d 100644 --- a/android/README.md +++ b/android/README.md @@ -65,6 +65,7 @@ carries several Mbit/s per connection (#24). ```sh android/build.sh # debug + release APK in Docker (ci/Dockerfile.android) +VTESSE_ANDROID_IMAGE= android/build.sh # use a ready Android image instead of building one adb install -r android/app/build/outputs/apk/debug/app-debug.apk ``` diff --git a/android/build.sh b/android/build.sh index c5a14a3..5693932 100755 --- a/android/build.sh +++ b/android/build.sh @@ -6,6 +6,10 @@ # Output: android/app/build/outputs/apk/{debug,release}/. Gradle and its # dependency cache live in android/.gradle-cache (not in the repository). # +# VTESSE_ANDROID_IMAGE= uses a ready Android image instead of building +# ci/Dockerfile.android (it needs JDK 17, the SDK/NDK/CMake of that Dockerfile +# and `gradle` on PATH); without it the image is built as vtesse-android. +# # Release signing (optional; without it the release APK is unsigned): # VTESSE_KEYSTORE=/path/to/key.jks plus VTESSE_KEYSTORE_PASSWORD, VTESSE_KEY_ALIAS, # VTESSE_KEY_PASSWORD in the environment (CI: from repository secrets), or @@ -29,11 +33,15 @@ if [ -n "${VTESSE_KEYSTORE:-}" ]; then export VTESSE_KEYSTORE_PASSWORD VTESSE_KEY_ALIAS VTESSE_KEY_PASSWORD fi -docker build -q -t vtesse-android -f "$ROOT/ci/Dockerfile.android" "$ROOT/ci" >/dev/null +IMAGE=${VTESSE_ANDROID_IMAGE:-} +if [ -z "$IMAGE" ]; then + IMAGE=vtesse-android + docker build -q -t "$IMAGE" -f "$ROOT/ci/Dockerfile.android" "$ROOT/ci" >/dev/null +fi mkdir -p "$HERE/.gradle-cache/home" # shellcheck disable=SC2086 # SIGN is a list of docker options docker run --rm --user "$(id -u):$(id -g)" -e GRADLE_USER_HOME=/src/android/.gradle-cache \ -e HOME=/src/android/.gradle-cache/home $SIGN \ - -v "$ROOT:/src" -w /src/android vtesse-android \ + -v "$ROOT:/src" -w /src/android "$IMAGE" \ gradle --no-daemon -q ${*:-assembleDebug assembleRelease} ls -l "$HERE"/app/build/outputs/apk/*/*.apk From 0fec6e535b8537ad14e5551767442377587ef578 Mon Sep 17 00:00:00 2001 From: Compot Developer Date: Fri, 16 Oct 2026 23:14:36 +0000 Subject: [PATCH 2/3] android/build.sh: check that a ready image has gradle and an SDK location Qodo on #39: a ready image without ANDROID_HOME/ANDROID_SDK_ROOT would only fail inside the Android Gradle Plugin. The script now checks for gradle on PATH and ANDROID_HOME or ANDROID_SDK_ROOT before building and says what is missing; the requirement is documented in the script header and android/README.md. --- android/README.md | 2 +- android/build.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/android/README.md b/android/README.md index 64b898d..66aaa29 100644 --- a/android/README.md +++ b/android/README.md @@ -65,7 +65,7 @@ carries several Mbit/s per connection (#24). ```sh android/build.sh # debug + release APK in Docker (ci/Dockerfile.android) -VTESSE_ANDROID_IMAGE= android/build.sh # use a ready Android image instead of building one +VTESSE_ANDROID_IMAGE= android/build.sh # use a ready image (JDK 17, SDK/NDK/CMake, gradle, ANDROID_HOME) adb install -r android/app/build/outputs/apk/debug/app-debug.apk ``` diff --git a/android/build.sh b/android/build.sh index 5693932..2f794f1 100755 --- a/android/build.sh +++ b/android/build.sh @@ -7,8 +7,10 @@ # dependency cache live in android/.gradle-cache (not in the repository). # # VTESSE_ANDROID_IMAGE= uses a ready Android image instead of building -# ci/Dockerfile.android (it needs JDK 17, the SDK/NDK/CMake of that Dockerfile -# and `gradle` on PATH); without it the image is built as vtesse-android. +# ci/Dockerfile.android. The image must provide JDK 17, the SDK/NDK/CMake of +# that Dockerfile, `gradle` on PATH, and export ANDROID_HOME (or +# ANDROID_SDK_ROOT) - the script checks the last two before building. Without +# the variable the image is built as vtesse-android. # # Release signing (optional; without it the release APK is unsigned): # VTESSE_KEYSTORE=/path/to/key.jks plus VTESSE_KEYSTORE_PASSWORD, VTESSE_KEY_ALIAS, @@ -37,6 +39,9 @@ IMAGE=${VTESSE_ANDROID_IMAGE:-} if [ -z "$IMAGE" ]; then IMAGE=vtesse-android docker build -q -t "$IMAGE" -f "$ROOT/ci/Dockerfile.android" "$ROOT/ci" >/dev/null +else + docker run --rm "$IMAGE" sh -c 'command -v gradle >/dev/null && [ -n "${ANDROID_HOME:-}${ANDROID_SDK_ROOT:-}" ]' || { + echo "$IMAGE: needs gradle on PATH and ANDROID_HOME or ANDROID_SDK_ROOT set" >&2; exit 1; } fi mkdir -p "$HERE/.gradle-cache/home" # shellcheck disable=SC2086 # SIGN is a list of docker options From 67e2aaab03970435054ab49c13e4022bf002b2a9 Mon Sep 17 00:00:00 2001 From: Compot Developer Date: Fri, 16 Oct 2026 23:24:14 +0000 Subject: [PATCH 3/3] android/build.sh: drop a ready image's ENTRYPOINT for the check and the build Qodo on #39: an image whose ENTRYPOINT does not run its arguments would swallow both the readiness check and gradle. With VTESSE_ANDROID_IMAGE the two docker run calls now pass --entrypoint= ; the default vtesse-android path is unchanged. --- android/build.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/android/build.sh b/android/build.sh index 2f794f1..2da89f7 100755 --- a/android/build.sh +++ b/android/build.sh @@ -36,17 +36,19 @@ if [ -n "${VTESSE_KEYSTORE:-}" ]; then fi IMAGE=${VTESSE_ANDROID_IMAGE:-} +ENTRY= if [ -z "$IMAGE" ]; then IMAGE=vtesse-android docker build -q -t "$IMAGE" -f "$ROOT/ci/Dockerfile.android" "$ROOT/ci" >/dev/null else - docker run --rm "$IMAGE" sh -c 'command -v gradle >/dev/null && [ -n "${ANDROID_HOME:-}${ANDROID_SDK_ROOT:-}" ]' || { + ENTRY=--entrypoint= # a ready image's own ENTRYPOINT must not swallow the commands + docker run --rm $ENTRY "$IMAGE" sh -c 'command -v gradle >/dev/null && [ -n "${ANDROID_HOME:-}${ANDROID_SDK_ROOT:-}" ]' || { echo "$IMAGE: needs gradle on PATH and ANDROID_HOME or ANDROID_SDK_ROOT set" >&2; exit 1; } fi mkdir -p "$HERE/.gradle-cache/home" -# shellcheck disable=SC2086 # SIGN is a list of docker options +# shellcheck disable=SC2086 # SIGN and ENTRY are lists of docker options docker run --rm --user "$(id -u):$(id -g)" -e GRADLE_USER_HOME=/src/android/.gradle-cache \ - -e HOME=/src/android/.gradle-cache/home $SIGN \ + -e HOME=/src/android/.gradle-cache/home $SIGN $ENTRY \ -v "$ROOT:/src" -w /src/android "$IMAGE" \ gradle --no-daemon -q ${*:-assembleDebug assembleRelease} ls -l "$HERE"/app/build/outputs/apk/*/*.apk