Skip to content

Instantly share code, notes, and snippets.

@pcqpcq
Last active Mar 11, 2019
Embed
What would you like to do?
package loop demo
#!/bin/bash
# right_file_size = 47899100
FILE_SIZE_AT_LEAST=47800000
FINISH_SIGNAL=0
TARGET_FILE=/Users/pcqpcq/Documents/android_publish_packages/bbtime/app/build/outputs/apk/official/release/bbtime_base_1.9.4_20190311.apk
while [[ "$FINISH_SIGNAL" -ne 1 ]]
do
let "target_file_size=`ls -l $TARGET_FILE | awk '{ print $5 }'`"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>文件大小是$target_file_size" >> try_package_log.txt
if [ "$target_file_size" -gt "$FILE_SIZE_AT_LEAST" ]
then
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>打包成功" >> try_package_log.txt
./gradlew assembleXiaomiRelease
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>打包结束" >> try_package_log.txt
let "FINISH_SIGNAL=1"
else
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>打包错误,重试" >> try_package_log.txt
./gradlew clean
./gradlew assembleOfficialRelease
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment