Merge pull request #1439 from folecr/updatescript

Updated script behaviour.
This commit is contained in:
James Chen 2012-10-10 17:32:30 -07:00
commit 1d4a2cc13c
1 changed files with 26 additions and 9 deletions

View File

@ -24,8 +24,24 @@
# Exit on error
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
COCOS2DX_ROOT="$DIR"/../../../..
# 1. Generate JS bindings
COCOS2DX_ROOT="$COCOS2DX_ROOT" /bin/bash ../../../tojs/genbindings.sh
echo
echo Bindings generated successfully
echo
if [ -z "${REMOTE_AUTOGEN_BINDINGS_REPOSITORY+aaa}" ]; then
echo
echo Environment variable must be set REMOTE_AUTOGEN_BINDINGS_REPOSITORY
echo This script expects to automatically push changes
echo to this repo
echo
echo Exiting with failure.
echo
# example
# REMOTE_AUTOGEN_BINDINGS_REPOSITORY="git@github.com:folecr/cocos2dx-autogen-bindings.git"
# REMOTE_AUTOGEN_BINDINGS_REPOSITORY="$HOME/test/cocos2dx-autogen-bindings"
@ -42,10 +58,6 @@ ELAPSEDSECS=`date +%s`
echo Using "$ELAPSEDSECS" in the branch names for pseudo-uniqueness
GENERATED_BRANCH=autogeneratedbindings_"$ELAPSEDSECS"
COCOS_BRANCH=updategeneratedsubmodule_"$ELAPSEDSECS"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
COCOS2DX_ROOT="$DIR"/../../../..
GENERATED_GITDIR="$COCOS2DX_ROOT"/scripting/javascript/bindings/generated/.git
GENERATED_WORKTREE="$COCOS2DX_ROOT"/scripting/javascript/bindings/generated
@ -55,9 +67,6 @@ gitcmd_GEN="git --git-dir=$GENERATED_GITDIR --work-tree=$GENERATED_WORKTREE"
# testing...
${gitcmd_GEN} status
# 1. Generate JS bindings
COCOS2DX_ROOT="$COCOS2DX_ROOT" /bin/bash ../../../tojs/genbindings.sh
# 2. In JSBindings repo, Check out a branch named "autogeneratedbindings" and commit the auto generated bindings to it
${gitcmd_GEN} add README cocos2dx.cpp cocos2dx.hpp cocos2dxapi.js
${gitcmd_GEN} checkout origin/master -b "$GENERATED_BRANCH"
@ -67,13 +76,21 @@ ${gitcmd_GEN} commit -m "$COMMITTAG : autogenerated bindings"
${gitcmd_GEN} push "$REMOTE_AUTOGEN_BINDINGS_REPOSITORY" "$GENERATED_BRANCH":master
if [ -z "${REMOTE_COCOS2DX_REPOSITORY+aaa}" ]; then
echo Environment variable must be set REMOTE_COCOS2DX_REPOSITORY
echo
echo Environment variable is not set REMOTE_COCOS2DX_REPOSITORY
echo This script will NOT automatically push changes
echo unless this variable is set.
echo
echo Exiting with success.
echo
# example
# REMOTE_COCOS2DX_REPOSITORY="git@github.com:cocos2d/cocos2d-x.git"
# REMOTE_COCOS2DX_REPOSITORY="$HOME/test/cocos2d-x"
exit 1
exit 0
fi
COCOS_BRANCH=updategeneratedsubmodule_"$ELAPSEDSECS"
pushd "${DIR}"
# 4. In Cocos2D-X repo, Checkout a branch named "updategeneratedsubmodule" Update the submodule reference to point to the commit with generated bindings