Commit 28ea6b4a authored by QA-甘 盛聪's avatar QA-甘 盛聪

update android

parent 679adcaa
#!/bin/bash #!/bin/bash -ilex
source /etc/profile
source ~/.bash_profile
project_path=/home/quant_group/jenkins/workspace/XyqbAndroidBuild project_path=/home/quant_group/jenkins/workspace/XyqbAndroidBuild
apk_path=/home/quant_group/jenkins/workspace/XyqbAndroidBuild/apk
target_file=${project_path}/app/build.gradle target_file=${project_path}/app/build.gradle
store_path=/home/ganshc/ store_path=/home/ganshc/
source_gradlefile=${store_path}/build.gradle source_gradlefile=${store_path}/build.gradle
...@@ -33,25 +36,27 @@ function get_code() ...@@ -33,25 +36,27 @@ function get_code()
function build_android() function build_android()
{ {
echo "拷贝可使用的gradle文件" echo "拷贝可使用的gradle文件"
rm -rf ${target_file}
cp -r ${source_gradlefile} ${target_file} cp -r ${source_gradlefile} ${target_file}
if [[ ! -z ${product_flavors} ]]; then if [[ ! -z ${product_flavors} ]]; then
echo "${product_flavors}" > ${project_path}/markets.txt echo "${product_flavors}" > ${project_path}/markets.txt
fi fi
rm -rf ${project_path}/apk/* rm -rf ${project_path}/apk/*
cd ${project_path}
pwd
echo "开始使用gradle进行编译该版本的代码" echo "开始使用gradle进行编译该版本的代码"
gradle clean resguard --stacktrace --debug gradle resguard
if [ $? = 0 ]; then if [ $? = 0 ]; then
cd ${buildapk_path}
echo "gradle build is ok". echo "gradle build is ok".
echo "开始重命名对应的渠道包" echo "开始重命名对应的渠道包"
#apkfile="`find ${buildapk_path} -name "*${product_flavors}.apk"`" apkfile="`find ${buildapk_path} -name "*${product_flavors}.apk"`"
#apkfile=`grep "${product_flavors}" *.apk` echo "apk名称是:${apkfile}"
apkfile=`ls ${buildapk_path} | grep "${product_flavors}"` ls ${buildapk_path}
echo ${apkfile} echo "当前路径 `pwd`"
echo "当前路径" mv ${apkfile} ${apk_path}/${branch_name}_${product_flavors}.apk
cd ${buildapk_path}
pwd
mv ${apkfile} ${project_path}/apk/${branch_name}_${product_flavors}.apk
else else
echo "Fail to build android". echo "Fail to build android".
exit -1 exit -1
...@@ -60,13 +65,13 @@ function build_android() ...@@ -60,13 +65,13 @@ function build_android()
function upload_apk() function upload_apk()
{ {
echo "正在将apk上传到蒲公英,请等待......" echo "apk正在上传到蒲公英,请等待......"
curl -F "file=@${project_path}/apk/${branch_name}_${product_flavors}.apk" -F "uKey=13d17385c02ea9ea994d0c985d87ff32" -F "_api_key=5b09af98d5a8ff43f2f39935fa6bfbc1" https://static.pgyer.com/app/qrcode/lJrv curl -F "file=@${apk_path}/${branch_name}_${product_flavors}.apk" -F "uKey=13d17385c02ea9ea994d0c985d87ff32" -F "_api_key=5b09af98d5a8ff43f2f39935fa6bfbc1" https://static.pgyer.com/app/qrcode/lJrv
} }
get_code get_code
build_android build_android
#upload_apk upload_apk
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment