You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

174 lines
5.4 KiB

#!/bin/bash
set -x
for i in "$@"; do
if [[ $i = *"="* ]]; then
eval "$i"
fi
done
cur_dir=$(cd $(dirname $0); pwd)
share_dir=$cur_dir/..
obb_outputdir="E:/www/arpg"
www_dir=""
output_url="http://192.168.1.246:8000/test"
stableAPK_dir="E:/www/arpg/released"
dailyAPK_dir="E:/www/arpg/test"
unity_app="C:/Unity/Editor/Unity.exe"
output_dir=$share_dir/../build/android
log_dir=$output_dir/../log/android
build_graph="Assets/ZXToolkit/AssetGraph/Graph/BuildGraph.asset"
arpg_cli_dir=$share_dir/../pandora_cli_proj
arpg_pro_dir=$arpg_cli_dir/pandora
if [ $publishChannel == "" ]; then
publishChannel="google_oversea"
fi
if [ $isUsingNewAB == "true" ]; then
build_graph="Assets/ZXToolkit/AssetGraph/Graph/BuildGraph_new.asset"
fi
buid_name=${buildNumber}_pandora_${publishChannel}_${version}_`date "+%Y%m%d_%H%M%S"`
if [ $development == "true" ]; then
buid_name=${buid_name}_development
fi
if [ $stable == "true" ]; then
www_dir=$stableAPK_dir
output_url="http://192.168.1.246:8000/released"
else
www_dir=$dailyAPK_dir
fi
if [ $obb == "true" ]; then
buid_name=${buid_name}_obb
fi
packge_name="com.herogame.gplay.redtide2"
outpath=$output_dir/${buid_name}.apk
outobb=$output_dir/${buid_name}.main.obb
obb_name=main.${version##*.}.$packge_name.obb
if [ ! -d ${output_dir} ]; then
mkdir ${output_dir}
fi
if [ ! -d ${log_dir} ]; then
mkdir ${log_dir}
fi
cd $arpg_cli_dir
# git fetch
# git clean -f -d
# git checkout -f $client_branch
# if [ "$tag" != "" ]; then
# git reset $tag --hard
# fi
# git pull
# svn cleanup --remove-unversioned
# svn revert --depth=infinity .
# svn update
python $arpg_cli_dir/../pandora_share_proj/MacBuild/build_generate_common.py debug=$debug version=$version disableLog=$disableLog versionIP="${versionIP}" gameIP=$gameIP lang=$lang maintenanceIP=$maintenanceIP mode=$mode publishChannel=$publishChannel
# ret=$?
# if [ $ret != 0 ]; then
# exit $ret
# fi
# git_log_msg=`git --no-pager log --max-count 30 --since=1.days --pretty=format:"%s"`
# git_log_msg=$(echo "$git_log_msg" | awk 'BEGIN{RS="\n";ORS="\\n";}{print $0}')
# ret=$?
# if [ $ret != 0 ]; then
# cat ${log_dir}/${buid_name}.log
# exit $ret
# fi
# ui=$arpg_cli_dir/arpg/Assets/RawResources/UI
# # git add *.meta *.*.meta
# # git commit -m "builder commit sprite tag"
# # git pull
# # git push
# svn $ui add *.meta --force
# svn $ui commit -m "builder commit sprite tag"
$unity_app -quit -batchmode -projectPath $arpg_pro_dir -logFile ${log_dir}/${buid_name}.log -executeMethod XAsset.Build.AssetBuildScript.RunBuild version=$version channel=$channel outpath=$outpath development=$development versionIP=$versionIP lang=$lang buildNumber=$buildNumber rebuildBundle=$rebuildBundle isUsingUWATools=$isUsingUWATools isUsingUWAPoco=$isUsingUWAPoco mode=$mode target=$target publishChannel=$publishChannel graph=$build_graph thinkingAnalyticsMode=$thinkingAnalyticsMode
ret=$?
echo "buildFinish ret:${ret}"
resources=$arpg_cli_dir/pandora/Assets/RawResources
svn add $resources/*.meta --force
svn commit $resources -m "builder commit"
if [ ! -f ${outpath} ]; then
echo "apk not found."
cat ${log_dir}/${buid_name}.log
exit 1
fi
echo "copy to www"
cp -f $outpath $www_dir/${buid_name}.apk
obb_dir=$obb_outputdir/obb/$buildNumber
obbinfo=$obb_outputdir/info/${buildNumber}_obbinfo
if [ -f ${outobb} ]; then
if [ ! -d ${obb_dir} ]; then
mkdir ${obb_dir}
fi
cp -f $outobb $obb_dir/$obb_name
python $share_dir/MacBuild/obb_postprocess.py $buildNumber $obb_dir/$obb_name $obb_outputdir/info
fi
# if [ "$no_home_page" != "true" ]; then
# cd $www_dir/
# rm *.apk
# cp -f $outpath $www_dir/${buid_name}.apk
# rm -rf index.html
# echo "<!DOCTYPE html>
# <html>
# <head>
# <meta charset="utf-8">
# <title>IOS</title>
# </head>
# <body>
# <br><a href=\"itms-services://?action=download-manifest&url=https://192.168.1.245/app.plist\"><font size=\"100\">安装ios</font></a></br>
# <br><a href=\"/"${buid_name}".apk\"><font size=\"100\">"${buid_name}"</font></a></br>
# <br><a href=\"/server.crt\"><font size=\"100\">证书安装</font></a></br>
# <br><a href=\"/android\"><font size=\"100\">Android往期版本</font></a></br>
# <br><a href=\"/ios\"><font size=\"100\">ios往期版本</font></a></br>
# </body>
# </html>" > index.html
# fi
cd $output_dir
rm *.apk
rm *.zip
rm *.obb
echo "build success."
if [ $push_message == "true" ]; then
curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=36fe45fc-d47d-4776-bbfd-e75bfdfd15e7' \
-H 'Content-Type: application/json charset=UTF-8"' \
-d "{\"msgtype\":\"markdown\", \"markdown\":{\"content\":\"## Android New Version\\n[${buid_name}](${output_url}/${buid_name}.apk)\"}}"
fi
#默认为245机器人
push_url="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=ea70d61f-2196-4f8b-90b1-4c7872a38593"
if test $machine_id -eq "246"
then
push_url="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=7b410698-446f-4a4d-8c7d-95a197b9436a"
fi
if [ $push_message_to_machine == "true" ]; then
curl $push_url \
-H 'Content-Type: application/json charset=UTF-8"' \
-d "{\"msgtype\":\"markdown\", \"markdown\":{\"content\":\"## Android New Version\\n[${buid_name}](${output_url}/${buid_name}.apk)\"}}"
fi
echo "push_message_to_machine."
# scp -P 56000 $www_dir/${buid_name}.apk mmog@111.231.250.180:/data/wwwroot/arpgbuildapk/