2012-08-06 11:59:37 +08:00
|
|
|
#!/bin/bash
|
|
|
|
#This script is used to finish a android automated compiler.
|
|
|
|
#You should make sure have finished the environment setting.
|
|
|
|
#Here are the environment variables you should set.
|
|
|
|
#$COCOS2DX_ROOT $ANDROID_SDK_ROOT $ANDROID_NDK_ROOT $NDK_ROOT
|
|
|
|
|
|
|
|
antcompile()
|
|
|
|
{
|
|
|
|
#Change API level.(API level:14)
|
|
|
|
sed '/target=/s/=.*$/=android-14/' ant.properties > anttmp.properties
|
|
|
|
cp anttmp.properties ant.properties
|
|
|
|
rm anttmp.properties
|
2012-09-16 16:13:54 +08:00
|
|
|
ant debug
|
2012-08-06 11:59:37 +08:00
|
|
|
compileresult=$[$compileresult+$?]
|
2012-08-23 17:21:11 +08:00
|
|
|
if [ $IsTestCpp == 1 ] && [ $? == 0 ]
|
|
|
|
then
|
|
|
|
cd bin
|
|
|
|
mv TestCpp-debug.apk TestCpp-debug-14.apk
|
|
|
|
cd ..
|
|
|
|
fi
|
2012-08-06 11:59:37 +08:00
|
|
|
|
|
|
|
#Change API level.(API level:15)
|
|
|
|
sed '/target=/s/=.*$/=android-15/' ant.properties > anttmp.properties
|
|
|
|
cp anttmp.properties ant.properties
|
|
|
|
rm anttmp.properties
|
2012-09-16 16:13:54 +08:00
|
|
|
ant debug
|
2012-08-06 11:59:37 +08:00
|
|
|
compileresult=$[$compileresult+$?]
|
2012-08-23 17:21:11 +08:00
|
|
|
if [ $IsTestCpp == 1 ] && [ $? == 0 ]
|
|
|
|
then
|
|
|
|
cd bin
|
|
|
|
mv TestCpp-debug.apk TestCpp-debug-15.apk
|
|
|
|
cd ..
|
|
|
|
fi
|
2012-08-06 11:59:37 +08:00
|
|
|
|
|
|
|
#After all test versions completed,changed current API level to the original.(API level:8)
|
|
|
|
sed '/target=/s/=.*$/=android-8/' ant.properties > anttmp.properties
|
|
|
|
cp anttmp.properties ant.properties
|
|
|
|
rm anttmp.properties
|
|
|
|
}
|
|
|
|
|
|
|
|
#record the relevant catalog
|
|
|
|
compileresult=0
|
|
|
|
CUR=$(pwd)
|
|
|
|
cd ../../../..
|
|
|
|
ROOT=$(pwd)
|
2012-08-23 17:21:11 +08:00
|
|
|
IsTestCpp=1
|
2012-08-06 11:59:37 +08:00
|
|
|
|
|
|
|
#copy configuration files to target.
|
2012-12-21 14:06:20 +08:00
|
|
|
cp $ROOT/tools/jenkins_scripts/ant.properties $ROOT/samples/Cpp/TestCpp/proj.android
|
|
|
|
cp $ROOT/tools/jenkins_scripts/build.xml $ROOT/samples/Cpp/TestCpp/proj.android
|
|
|
|
cp $ROOT/tools/jenkins_scripts/mac/rootconfig-mac.sh $ROOT/samples/Cpp/TestCpp/proj.android
|
2012-12-24 14:26:57 +08:00
|
|
|
cd samples/Cpp/TestCpp/proj.android
|
2012-09-14 16:33:54 +08:00
|
|
|
sh rootconfig-mac.sh TestCpp
|
2012-08-06 11:59:37 +08:00
|
|
|
sh build_native.sh
|
|
|
|
|
|
|
|
#update android project configuration files
|
|
|
|
cd ..
|
|
|
|
android update project -p proj.android
|
|
|
|
cd proj.android
|
|
|
|
antcompile
|
|
|
|
|
2012-08-23 17:21:11 +08:00
|
|
|
IsTestCpp=0
|
|
|
|
|
2012-12-21 14:06:20 +08:00
|
|
|
cp $ROOT/tools/jenkins_scripts/ant.properties $ROOT/samples/Cpp/HelloCpp/proj.android
|
|
|
|
cp $ROOT/tools/jenkins_scripts/build.xml $ROOT/samples/Cpp/HelloCpp/proj.android
|
|
|
|
cp $ROOT/tools/jenkins_scripts/mac/rootconfig-mac.sh $ROOT/samples/Cpp/HelloCpp/proj.android
|
|
|
|
cd ../../Cpp/HelloCpp/proj.android
|
2012-09-14 16:33:54 +08:00
|
|
|
sh rootconfig-mac.sh HelloCpp
|
2012-08-06 11:59:37 +08:00
|
|
|
sh build_native.sh
|
|
|
|
cd ..
|
|
|
|
android update project -p proj.android
|
|
|
|
cd proj.android
|
|
|
|
antcompile
|
|
|
|
|
2012-12-21 14:06:20 +08:00
|
|
|
cp $ROOT/tools/jenkins_scripts/ant.properties $ROOT/samples/Lua/HelloLua/proj.android
|
|
|
|
cp $ROOT/tools/jenkins_scripts/build.xml $ROOT/samples/Lua/HelloLua/proj.android
|
|
|
|
cp $ROOT/tools/jenkins_scripts/mac/rootconfig-mac.sh $ROOT/samples/Lua/HelloLua/proj.android
|
|
|
|
cd ../../Lua/HelloLua/proj.android
|
2012-09-14 16:33:54 +08:00
|
|
|
sh rootconfig-mac.sh HelloLua
|
2012-08-06 11:59:37 +08:00
|
|
|
sh build_native.sh
|
|
|
|
cd ..
|
|
|
|
android update project -p proj.android
|
|
|
|
cd proj.android
|
|
|
|
antcompile
|
|
|
|
|
|
|
|
#return the compileresult.
|
|
|
|
cd ../../..
|
|
|
|
if [ $compileresult != 0 ]; then
|
2012-08-23 17:21:11 +08:00
|
|
|
# git checkout -f
|
|
|
|
# git clean -df -x
|
2012-08-06 11:59:37 +08:00
|
|
|
exit 1
|
|
|
|
else
|
2012-08-23 17:21:11 +08:00
|
|
|
# git checkout -f
|
|
|
|
# git clean -df -x
|
2012-08-27 15:12:55 +08:00
|
|
|
exit 0
|
2012-09-16 16:13:54 +08:00
|
|
|
fi
|