axmol/tools/travis-scripts/run-script.sh

109 lines
3.8 KiB
Bash
Raw Normal View History

#!/bin/bash
# exit this script if any commmand fails
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
COCOS2DX_ROOT="$DIR"/../..
if [ -z "$NDK_ROOT" ]; then
export NDK_ROOT=$HOME/bin/android-ndk
fi
if [ -z "$PYTHON_BIN" ]; then
export PYTHON_BIN=/usr/bin/python
fi
if [ "$GEN_COCOS_FILES"x = "YES"x ]; then
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
exit 0
fi
if [ -z "${GH_EMAIL}" ]; then
echo "GH_EMAIL not set"
2014-02-27 16:23:38 +08:00
exit 1
fi
if [ -z "${GH_USER}" ]; then
echo "GH_USER not set"
2014-02-27 16:23:38 +08:00
exit 1
fi
if [ -z "${GH_PASSWORD}" ]; then
echo "GH_USER not set"
2014-02-27 16:23:38 +08:00
exit 1
fi
cd $COCOS2DX_ROOT/tools/travis-scripts
2014-03-06 14:00:48 +08:00
./generate-cocosfiles.sh
elif [ "$PLATFORM"x = "android"x ]; then
export NDK_ROOT=$HOME/bin/android-ndk
2013-07-24 17:26:45 +08:00
# Generate binding glue codes
echo "Generating bindings glue codes ..."
cd $COCOS2DX_ROOT/tools/travis-scripts
2014-03-06 14:00:48 +08:00
./generate-cocosfiles.sh
2013-06-11 11:31:24 +08:00
cd $COCOS2DX_ROOT
2013-07-24 17:26:45 +08:00
# Create a directory for temporary objects
# mkdir android_build_objs
2013-07-24 17:26:45 +08:00
# PROJECTS=("test-cpp" "test-javascript" "test-lua")
# for i in ${PROJECTS[*]}; do
# ln -s $COCOS2DX_ROOT/android_build_objs $COCOS2DX_ROOT/tests/$i/proj.android/obj
# done
2013-07-24 17:26:45 +08:00
2013-11-01 11:46:02 +08:00
# Build all samples
echo "Building all samples ..."
cd $COCOS2DX_ROOT/build
2013-12-10 18:26:10 +08:00
./android-build.py -n "NDK_BUG=0 -j10" all
2013-07-24 17:26:45 +08:00
elif [ "$PLATFORM"x = "nacl"x ]; then
export NACL_SDK_ROOT=$HOME/bin/nacl_sdk/pepper_canary
export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_x86_newlib/bin
export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_arm_newlib/bin
2013-11-01 11:46:02 +08:00
cd $COCOS2DX_ROOT/build
make -j4
elif [ "$PLATFORM"x = "linux"x ]; then
# Generate binding glue codes
echo "Generating bindings glue codes ..."
cd $COCOS2DX_ROOT/tools/travis-scripts
2014-03-06 14:00:48 +08:00
./generate-cocosfiles.sh
echo "Building cocos2d-x"
2013-11-01 11:46:02 +08:00
cd $COCOS2DX_ROOT/build
2013-11-04 18:59:39 +08:00
mkdir -p linux-build
cd linux-build
2013-12-10 18:26:10 +08:00
cmake ../..
2013-11-04 18:59:39 +08:00
make -j10
elif [ "$PLATFORM"x = "emscripten"x ]; then
# Generate binding glue codes
echo "Generating bindings glue codes ..."
cd $COCOS2DX_ROOT/tools/travis-scripts
2014-03-06 14:00:48 +08:00
./generate-cocosfiles.sh
2013-11-01 11:46:02 +08:00
cd $COCOS2DX_ROOT/build
export PYTHON=/usr/bin/python
export LLVM=$HOME/bin/clang+llvm-3.2/bin
export LLVM_ROOT=$LLVM
EMCC_DEBUG=1 make PLATFORM=emscripten -j 8
elif [ "$PLATFORM"x = "ios"x ]; then
cd $COCOS2DX_ROOT/tools/travis-scripts
2014-03-06 14:00:48 +08:00
./generate-cocosfiles.sh
cd $COCOS2DX_ROOT
xctool/xctool.sh -project samples/Cpp/HelloCpp/proj.ios/HelloCpp.xcodeproj -scheme HelloCpp test
xctool/xctool.sh -project samples/Cpp/SimpleGame/proj.ios/SimpleGame.xcodeproj -scheme SimpleGame test
xctool/xctool.sh -project samples/Cpp/TestCpp/proj.ios/TestCpp.xcodeproj -scheme TestCpp test
#xctool/xctool.sh -project samples/Cpp/AssetsManagerTest/proj.ios/AssetsManagerTest.xcodeproj -scheme AssetsManagerTest test
#xctool/xctool.sh -project samples/Javascript/CocosDragonJS/proj.ios/CocosDragonJS.xcodeproj -scheme CocosDragonJS test
#xctool/xctool.sh -project samples/Javascript/CrystalCraze/proj.ios/CrystalCraze.xcodeproj -scheme CrystalCraze test
xctool/xctool.sh -project samples/Javascript/MoonWarriors/proj.ios/MoonWarriors.xcodeproj -scheme MoonWarriors test
xctool/xctool.sh -project samples/Javascript/TestJavascript/proj.ios/TestJavascript.xcodeproj -scheme TestJavascript test
#xctool/xctool.sh -project samples/Javascript/WatermelonWithMe/proj.ios/WatermelonWithMe.xcodeproj -scheme WatermelonWithMe test
xctool/xctool.sh -project samples/Lua/HelloLua/proj.ios/HelloLua.xcodeproj -scheme HelloLua test
xctool/xctool.sh -project samples/Lua/TestLua/proj.ios/TestLua.xcodeproj -scheme TestLua test
else
echo "Unknown \$PLATFORM: '$PLATFORM'"
exit 1
fi