From eac81df4b05c2e6f761d6220bf6cd633562f4ea1 Mon Sep 17 00:00:00 2001 From: cottongin Date: Wed, 11 Mar 2026 04:38:28 -0400 Subject: [PATCH] fix: show last 20 lines on build failure and unhide clean errors Build failures now display a colored error banner with the last 20 lines of Gradle output. Removed stderr suppression from clean_build so Gradle errors are visible. Made-with: Cursor --- build.sh | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index 76f7802..9cf28b0 100755 --- a/build.sh +++ b/build.sh @@ -240,19 +240,31 @@ build_release() { info "Building release APK... (this may take a minute)" echo "" - local store_file + local store_file build_log exit_code store_file="$(cd "$(dirname "$KEYSTORE_FILE")" && pwd)/$(basename "$KEYSTORE_FILE")" + build_log=$(mktemp) - if ./gradlew assembleRelease \ + set +e + ./gradlew assembleRelease \ -Pandroid.injected.signing.store.file="$store_file" \ -Pandroid.injected.signing.store.password="$password" \ -Pandroid.injected.signing.key.alias="$KEY_ALIAS" \ - -Pandroid.injected.signing.key.password="$password"; then + -Pandroid.injected.signing.key.password="$password" 2>&1 | tee "$build_log" + exit_code=${PIPESTATUS[0]} + set -e + if [[ $exit_code -eq 0 ]]; then + rm -f "$build_log" copy_apk "release" else echo "" - error "Build failed. Check the output above for details." + echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" + error "BUILD FAILED" + echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" + echo "" + echo -e "${DIM}Last 20 lines of build output:${NC}" + tail -20 "$build_log" + rm -f "$build_log" return 1 fi } @@ -261,11 +273,26 @@ build_debug() { info "Building debug APK..." echo "" - if ./gradlew assembleDebug; then + local build_log exit_code + build_log=$(mktemp) + + set +e + ./gradlew assembleDebug 2>&1 | tee "$build_log" + exit_code=${PIPESTATUS[0]} + set -e + + if [[ $exit_code -eq 0 ]]; then + rm -f "$build_log" copy_apk "debug" else echo "" - error "Build failed. Check the output above for details." + echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" + error "BUILD FAILED" + echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" + echo "" + echo -e "${DIM}Last 20 lines of build output:${NC}" + tail -20 "$build_log" + rm -f "$build_log" return 1 fi } @@ -273,7 +300,7 @@ build_debug() { clean_build() { info "Cleaning build artifacts..." - ./gradlew clean 2>/dev/null + ./gradlew clean if [[ -d "$DIST_DIR" ]]; then rm -rf "$DIST_DIR"