File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44ROOT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
55ANDROID_DIR=" ${ROOT_DIR} /android"
66TARGET_DIR=${SND_RELEASE_DIR:= " ${ROOT_DIR} /build/android" }
7+ # Resolve relative paths against ROOT_DIR so cd operations don't break them
8+ case " ${TARGET_DIR} " in
9+ /* ) ;;
10+ * ) TARGET_DIR=" ${ROOT_DIR} /${TARGET_DIR} " ;;
11+ esac
712GRADLE_TASK=${SND_ANDROID_GRADLE_TASK:= " assembleDebug" }
813GRADLE_BIN=${SND_GRADLE:- " " }
914AAR_PATH=${SND_ANDROID_AAR:= " ${ANDROID_DIR} /app/libs/sndmobile.aar" }
@@ -145,10 +150,19 @@ else
145150 exit 1
146151fi
147152
153+ cd " ${ROOT_DIR} "
154+
148155echo " Collecting artifacts..."
149156mkdir -p " ${TARGET_DIR} "
150157find " ${ANDROID_DIR} /app/build/outputs" -type f \( -name " *.apk" -o -name " *.aab" \) -exec cp {} " ${TARGET_DIR} /" \;
151158
159+ APK_COUNT=$( find " ${TARGET_DIR} " -maxdepth 1 -type f \( -name " *.apk" -o -name " *.aab" \) | wc -l | tr -d ' ' )
160+ if [ " ${APK_COUNT} " -eq 0 ]; then
161+ echo " Error: no APK or AAB files found in ${ANDROID_DIR} /app/build/outputs"
162+ echo " The Gradle build may have failed silently."
163+ exit 1
164+ fi
165+
152166if [ " ${DEPLOY_APK} " = " true" ]; then
153167 require_command adb
154168
You can’t perform that action at this time.
0 commit comments