2015年02月05日
cocos2dx, 游戏开发
批量创建渠道包脚本
#!/bin/bash
channel_start=101
channel_end=110
apk_name_prefix=sxlm_release_v2.0.0_lequsdk_tysf
target_dir=/Users/liangwei/Downloads
for (( channel=$channel_start;channel<=$channel_end; channel++ ))
do
echo "==========创建渠道包,渠道号:$channel ..."
echo "替换渠道配置文件 AndroidManifest.xml "
sed -ig "s/android\:name=\"channel\" android\:value=\"sxlm_\([0-9]*\)\"/android\:name=\"channel\" android\:value=\"sxlm_$channel\"/g" AndroidManifest.xml
check=`grep "android:name=\"channel\" android:value=\"sxlm_$channel\"" AndroidManifest.xml`
if [[ -z $check ]]; then
echo "AndroidManifest.xml 无法替换所指定的渠道"
exit
fi
echo "替换渠道配置文件 ../scripts/app/GameConfig.lua "
sed -ig "s/GAME_CHANNEL=\([0-9]*\)/GAME_CHANNEL=$channel/g" ../scripts/app/GameConfig.lua
check=`grep "GAME_CHANNEL=$channel" ../scripts/app/GameConfig.lua`
if [[ -z $check ]]; then
echo "../scripts/app/GameConfig.lua 无法替换所指定的渠道"
exit
fi
echo "编译..."
./build_native.sh >/dev/null
echo "ant 打包..."
ant release >/dev/null
echo "拷贝文件..."
cp bin/Sxlm-release.apk "$target_dir/$apk_name_prefix""_channel$channel.apk"
done