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
This commit is contained in:
41
build.sh
41
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"
|
||||
|
||||
Reference in New Issue
Block a user