Merge pull request #11693 from natural-law/v3

[ci skip] Update the travis script for auto generate lua-binding & js-binding.
This commit is contained in:
minggo 2015-05-05 13:41:37 +08:00
commit 261f0ef429
1 changed files with 25 additions and 9 deletions

View File

@ -17,14 +17,17 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_ROOT="$DIR/../.." PROJECT_ROOT="$DIR/../.."
TOLUA_ROOT="$PROJECT_ROOT/tools/tolua" TOLUA_ROOT="$PROJECT_ROOT/tools/tolua"
AUTO_GENERATED_DIR="$PROJECT_ROOT/cocos/scripting/lua-bindings/auto" TOJS_ROOT="$PROJECT_ROOT/tools/tojs"
COMMITTAG="[AUTO]: updating luabinding automatically" LUA_AUTO_GENERATED_DIR="$PROJECT_ROOT/cocos/scripting/lua-bindings/auto"
JS_AUTO_GENERATED_DIR="$PROJECT_ROOT/cocos/scripting/js-bindings/auto"
COMMITTAG="[AUTO]: updating luabinding & jsbinding automatically"
ELAPSEDSECS=`date +%s` ELAPSEDSECS=`date +%s`
COCOS_BRANCH="update_lua_bindings_$ELAPSEDSECS" COCOS_BRANCH="update_lua_bindings_$ELAPSEDSECS"
COCOS_ROBOT_REMOTE="https://${GH_USER}:${GH_PASSWORD}@github.com/${GH_USER}/cocos2d-x.git" COCOS_ROBOT_REMOTE="https://${GH_USER}:${GH_PASSWORD}@github.com/${GH_USER}/cocos2d-x.git"
PULL_REQUEST_REPO="https://api.github.com/repos/cocos2d/cocos2d-x/pulls" PULL_REQUEST_REPO="https://api.github.com/repos/cocos2d/cocos2d-x/pulls"
FETCH_REMOTE_BRANCH="v3" FETCH_REMOTE_BRANCH="v3"
COMMIT_PATH="cocos/scripting/lua-bindings/auto" LUA_COMMIT_PATH="cocos/scripting/lua-bindings/auto"
JS_COMMIT_PATH="cocos/scripting/js-bindings/auto"
# Exit on error # Exit on error
set -e set -e
@ -52,6 +55,11 @@ generate_bindings_glue_codes()
pushd "$TOLUA_ROOT" pushd "$TOLUA_ROOT"
./genbindings.py ./genbindings.py
popd popd
echo "Create auto-generated jsbinding glue codes."
pushd "$TOJS_ROOT"
./genbindings.py
popd
} }
if [ "$GEN_BINDING"x != "YES"x ]; then if [ "$GEN_BINDING"x != "YES"x ]; then
@ -65,8 +73,11 @@ git config user.email ${GH_EMAIL}
git config user.name ${GH_USER} git config user.name ${GH_USER}
popd popd
rm -rf "$AUTO_GENERATED_DIR" rm -rf "$LUA_AUTO_GENERATED_DIR"
mkdir "$AUTO_GENERATED_DIR" mkdir "$LUA_AUTO_GENERATED_DIR"
rm -rf "$JS_AUTO_GENERATED_DIR"
mkdir "$JS_AUTO_GENERATED_DIR"
# 1. Generate LUA bindings # 1. Generate LUA bindings
generate_bindings_glue_codes generate_bindings_glue_codes
@ -97,10 +108,14 @@ git fetch origin ${FETCH_REMOTE_BRANCH}
# Don't exit on non-zero return value # Don't exit on non-zero return value
set +e set +e
git diff FETCH_HEAD --stat --exit-code ${COMMIT_PATH} git diff FETCH_HEAD --stat --exit-code ${LUA_COMMIT_PATH}
DIFF_RETVAL=$? LUA_DIFF_RETVAL=$?
if [ $DIFF_RETVAL -eq 0 ]
git diff FETCH_HEAD --stat --exit-code ${JS_COMMIT_PATH}
JS_DIFF_RETVAL=$?
if [ $LUA_DIFF_RETVAL -eq 0 -a $JS_DIFF_RETVAL -eq 0 ]
then then
echo echo
echo "No differences in generated files" echo "No differences in generated files"
@ -116,7 +131,8 @@ fi
# Exit on error # Exit on error
set -e set -e
git add -f --all "$AUTO_GENERATED_DIR" git add -f --all "$LUA_AUTO_GENERATED_DIR"
git add -f --all "$JS_AUTO_GENERATED_DIR"
git checkout -b "$COCOS_BRANCH" git checkout -b "$COCOS_BRANCH"
git commit -m "$COMMITTAG" git commit -m "$COMMITTAG"