fix(ci): let the Android build scripts respect a caller-set ANDROID_HOME
🏗️ Build and Test JellyTau / Run Tests (push) Successful in 25m24s
🏗️ Build and Test JellyTau / Supply Chain (push) Successful in 54s
📱 Test APK / Build test APK (push) Failing after 50m57s
Publish Documentation / Build & publish docs to gitea-pages (push) Successful in 9m47s
Traceability Validation / Check Requirement Traces (push) Successful in 25s
🏗️ Build and Test JellyTau / Android Compile Check (push) Successful in 7m18s
🏗️ Build and Test JellyTau / Run Tests (push) Successful in 25m24s
🏗️ Build and Test JellyTau / Supply Chain (push) Successful in 54s
📱 Test APK / Build test APK (push) Failing after 50m57s
Publish Documentation / Build & publish docs to gitea-pages (push) Successful in 9m47s
Traceability Validation / Check Requirement Traces (push) Successful in 25s
🏗️ Build and Test JellyTau / Android Compile Check (push) Successful in 7m18s
build-android.sh hardcoded `export ANDROID_HOME="$HOME/Android/Sdk"`, which discarded whatever the caller had set. In the builder image the SDK is at /opt/android-sdk and the job exports exactly that, so the script looked for an NDK under /root/Android/Sdk, found nothing, and the build died a minute in with "Android SDK not found" -- the first automatic `latest` APK build failed on this and nothing else. Now a default rather than an override, matching what test-player-conformance.sh already did. NDK_HOME likewise prefers an explicitly pinned ANDROID_NDK_HOME over guessing with `ls | head -1`, which is how CI pins an exact NDK revision. A missing SDK now fails immediately and says which variable to set, instead of letting `ls` print its own error and the real failure surface a minute later inside the tauri CLI. android-dev.sh had the same override and gets the same treatment.
This commit is contained in:
@@ -7,7 +7,7 @@ echo "======================================"
|
|||||||
# Setup environment
|
# Setup environment
|
||||||
echo "Setting up environment..."
|
echo "Setting up environment..."
|
||||||
source "$HOME/.cargo/env.fish" 2>/dev/null || source "$HOME/.cargo/env" || true
|
source "$HOME/.cargo/env.fish" 2>/dev/null || source "$HOME/.cargo/env" || true
|
||||||
export ANDROID_HOME="$HOME/Android/Sdk"
|
export ANDROID_HOME="${ANDROID_HOME:-$HOME/Android/Sdk}"
|
||||||
export NDK_HOME="$ANDROID_HOME/ndk/$(ls $ANDROID_HOME/ndk 2>/dev/null | head -1)"
|
export NDK_HOME="$ANDROID_HOME/ndk/$(ls $ANDROID_HOME/ndk 2>/dev/null | head -1)"
|
||||||
|
|
||||||
# Check prerequisites
|
# Check prerequisites
|
||||||
|
|||||||
@@ -6,9 +6,26 @@ set -e
|
|||||||
# Source Rust environment
|
# Source Rust environment
|
||||||
source "$HOME/.cargo/env.fish" 2>/dev/null || source "$HOME/.cargo/env" 2>/dev/null || true
|
source "$HOME/.cargo/env.fish" 2>/dev/null || source "$HOME/.cargo/env" 2>/dev/null || true
|
||||||
|
|
||||||
# Set Android environment variables
|
# Set Android environment variables.
|
||||||
export ANDROID_HOME="$HOME/Android/Sdk"
|
#
|
||||||
export NDK_HOME="$ANDROID_HOME/ndk/$(ls "$ANDROID_HOME/ndk" | head -1)"
|
# Defaults, not overrides. A developer's SDK is at ~/Android/Sdk, but CI runs in
|
||||||
|
# the builder image where it lives at /opt/android-sdk and the job sets
|
||||||
|
# ANDROID_HOME accordingly — hardcoding the home-directory path here silently
|
||||||
|
# discarded that and the build died with "Android SDK not found" a minute in.
|
||||||
|
# `test-player-conformance.sh` already had this right; this script did not.
|
||||||
|
export ANDROID_HOME="${ANDROID_HOME:-$HOME/Android/Sdk}"
|
||||||
|
export ANDROID_SDK_ROOT="${ANDROID_SDK_ROOT:-$ANDROID_HOME}"
|
||||||
|
|
||||||
|
if [ ! -d "$ANDROID_HOME/ndk" ]; then
|
||||||
|
echo "❌ No NDK directory at $ANDROID_HOME/ndk" >&2
|
||||||
|
echo " Set ANDROID_HOME to your SDK location, or install the NDK." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Respect an NDK the caller has already picked (CI pins an exact revision via
|
||||||
|
# ANDROID_NDK_HOME); otherwise take whatever is installed.
|
||||||
|
export NDK_HOME="${NDK_HOME:-${ANDROID_NDK_HOME:-$ANDROID_HOME/ndk/$(ls "$ANDROID_HOME/ndk" | head -1)}}"
|
||||||
|
export ANDROID_NDK_HOME="$NDK_HOME"
|
||||||
|
|
||||||
echo "🤖 Building Android APK..."
|
echo "🤖 Building Android APK..."
|
||||||
echo "Android SDK: $ANDROID_HOME"
|
echo "Android SDK: $ANDROID_HOME"
|
||||||
|
|||||||
Reference in New Issue
Block a user