From 58cdf07a35923070bfcfce529c170e3072459456 Mon Sep 17 00:00:00 2001 From: chuanweizhang2013 Date: Wed, 5 Mar 2014 18:31:31 +0800 Subject: [PATCH 1/6] add --- templates/cocos2dx_files.json.REMOVED.git-id | 1 - 1 file changed, 1 deletion(-) delete mode 100644 templates/cocos2dx_files.json.REMOVED.git-id diff --git a/templates/cocos2dx_files.json.REMOVED.git-id b/templates/cocos2dx_files.json.REMOVED.git-id deleted file mode 100644 index 80626e1cff..0000000000 --- a/templates/cocos2dx_files.json.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -1283277b97cce107c19ac971a0648a5720e341c5 \ No newline at end of file From dfdb6c4158b80c6aa4dc12db9776044035d2a88b Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 6 Mar 2014 13:54:24 +0800 Subject: [PATCH 2/6] [travis ci] Adds 'for-each-file-in-dir.sh' for generating file list in cocos2d. CocosRobot will send a PR for that change. --- .travis.yml | 1 + tools/travis-scripts/for-each-file-in-dir.sh | 29 ++++++++++++++++++++ tools/travis-scripts/generate-cocosfiles.sh | 14 ++++------ 3 files changed, 36 insertions(+), 8 deletions(-) create mode 100755 tools/travis-scripts/for-each-file-in-dir.sh diff --git a/.travis.yml b/.travis.yml index 2b2dceb5fb..4c07791079 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: cpp env: matrix: + - GEN_COCOS_FILES=YES - PLATFORM=linux DEBUG=1 CC_COMPILER=gcc CXX_COMPILER=g++ - PLATFORM=linux DEBUG=1 CC_COMPILER=clang CXX_COMPILER=clang++ # Since switching to C++11 only the ARM version of the nactive client diff --git a/tools/travis-scripts/for-each-file-in-dir.sh b/tools/travis-scripts/for-each-file-in-dir.sh new file mode 100755 index 0000000000..ad63b9062c --- /dev/null +++ b/tools/travis-scripts/for-each-file-in-dir.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# exit this script if any commmand fails +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +PROJECT_ROOT="$DIR"/../.. + +shopt -s dotglob + +echo_all_files() { + for file in $1/* + do + if [ -d "$file" ]; then + echo_all_files "$file" + else + relative_path="${file##*${PROJECT_ROOT}/}" + prefix=${relative_path:0:5} + if [ "$prefix"x != ".git/"x ]; then + echo "\"$relative_path\"," + fi + fi + done +} + +echo "[" +echo_all_files ${PROJECT_ROOT} +echo "]" + diff --git a/tools/travis-scripts/generate-cocosfiles.sh b/tools/travis-scripts/generate-cocosfiles.sh index 606f28fff7..2974ae325a 100755 --- a/tools/travis-scripts/generate-cocosfiles.sh +++ b/tools/travis-scripts/generate-cocosfiles.sh @@ -1,8 +1,8 @@ #!/bin/bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -COCOS2DX_ROOT="$DIR"/../.. -COCOSFILES_CREATOR_ROOT=$COCOS2DX_ROOT/tools/project-creator/config-create +PROJECT_ROOT="$DIR"/../.. + COMMITTAG="[AUTO][ci skip]" # Exit on error @@ -11,9 +11,7 @@ set -e generate_cocosfiles_json() { echo "Updates cocos_files.json" - pushd "$COCOSFILES_CREATOR_ROOT" - ./create_config.py - popd + ./for-each-file-in-dir.sh > ${PROJECT_ROOT}/templates/cocos2dx_files.json } if [ "$GEN_COCOS_FILES"x != "YES"x ]; then @@ -21,7 +19,7 @@ if [ "$GEN_COCOS_FILES"x != "YES"x ]; then exit 0 fi -pushd "$COCOS2DX_ROOT" +pushd "$PROJECT_ROOT" #Set git user for cocos2d-x repo git config user.email ${GH_EMAIL} git config user.name ${GH_USER} @@ -51,7 +49,7 @@ echo Using "$ELAPSEDSECS" in the branch names for pseudo-uniqueness # 2. Check if there are any files that are different from the index -pushd "$COCOS2DX_ROOT" +pushd "$PROJECT_ROOT" # Run status to record the output in the log git status @@ -88,7 +86,7 @@ COCOS_BRANCH=update_cocosfiles_"$ELAPSEDSECS" pushd "${DIR}" # 3. In Cocos2D-X repo, Checkout a branch named "updategeneratedsubmodule" Update the submodule reference to point to the commit with generated bindings -cd "${COCOS2DX_ROOT}" +cd "${PROJECT_ROOT}" git add . git checkout -b "$COCOS_BRANCH" git commit -m "$COMMITTAG : updating tools/project-creator/module/cocos_files.json" From c206384eddd096669bd74b8554d881f51504816b Mon Sep 17 00:00:00 2001 From: lihex Date: Thu, 6 Mar 2014 13:56:18 +0800 Subject: [PATCH 3/6] rename template config file --- tools/cocos2d-console | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cocos2d-console b/tools/cocos2d-console index cef397668e..c788443bab 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit cef397668e1220f2b9b4262ee18fcffedb8347ca +Subproject commit c788443babb3505c4668cb7079f0c9a0e450c6e0 From 738a4f5debdc7067d5cd98f368e211e6be78719a Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 6 Mar 2014 14:00:48 +0800 Subject: [PATCH 4/6] Uncomments '.generate-cocosfiles.sh'. --- tools/travis-scripts/run-script.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/travis-scripts/run-script.sh b/tools/travis-scripts/run-script.sh index f3760f5da2..c51e52e067 100755 --- a/tools/travis-scripts/run-script.sh +++ b/tools/travis-scripts/run-script.sh @@ -32,14 +32,14 @@ if [ "$GEN_COCOS_FILES"x = "YES"x ]; then fi cd $COCOS2DX_ROOT/tools/travis-scripts - # ./generate-cocosfiles.sh + ./generate-cocosfiles.sh elif [ "$PLATFORM"x = "android"x ]; then export NDK_ROOT=$HOME/bin/android-ndk # Generate binding glue codes echo "Generating bindings glue codes ..." cd $COCOS2DX_ROOT/tools/travis-scripts - # ./generate-cocosfiles.sh + ./generate-cocosfiles.sh cd $COCOS2DX_ROOT @@ -66,7 +66,7 @@ elif [ "$PLATFORM"x = "linux"x ]; then # Generate binding glue codes echo "Generating bindings glue codes ..." cd $COCOS2DX_ROOT/tools/travis-scripts - # ./generate-cocosfiles.sh + ./generate-cocosfiles.sh echo "Building cocos2d-x" cd $COCOS2DX_ROOT/build @@ -79,7 +79,7 @@ elif [ "$PLATFORM"x = "emscripten"x ]; then # Generate binding glue codes echo "Generating bindings glue codes ..." cd $COCOS2DX_ROOT/tools/travis-scripts - # ./generate-cocosfiles.sh + ./generate-cocosfiles.sh cd $COCOS2DX_ROOT/build export PYTHON=/usr/bin/python @@ -88,7 +88,7 @@ elif [ "$PLATFORM"x = "emscripten"x ]; then EMCC_DEBUG=1 make PLATFORM=emscripten -j 8 elif [ "$PLATFORM"x = "ios"x ]; then cd $COCOS2DX_ROOT/tools/travis-scripts - # ./generate-cocosfiles.sh + ./generate-cocosfiles.sh cd $COCOS2DX_ROOT xctool/xctool.sh -project samples/Cpp/HelloCpp/proj.ios/HelloCpp.xcodeproj -scheme HelloCpp test From 5490e441922c47b5a4eb7fd2c59e96342bf154d1 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 6 Mar 2014 06:09:07 +0000 Subject: [PATCH 5/6] [AUTO][ci skip] : updating tools/project-creator/module/cocos_files.json --- templates/cocos2dx_files.json.REMOVED.git-id | 1 + 1 file changed, 1 insertion(+) create mode 100644 templates/cocos2dx_files.json.REMOVED.git-id diff --git a/templates/cocos2dx_files.json.REMOVED.git-id b/templates/cocos2dx_files.json.REMOVED.git-id new file mode 100644 index 0000000000..1a8a41cef2 --- /dev/null +++ b/templates/cocos2dx_files.json.REMOVED.git-id @@ -0,0 +1 @@ +c95c8696018ed9dbb68d20bb12242bfc8de6c273 \ No newline at end of file From 5ca25d854f6c5935ecc2762952b4a1d774de8b56 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 6 Mar 2014 14:10:50 +0800 Subject: [PATCH 6/6] [travis ci] Updates generate-cocosfiles.sh. --- tools/travis-scripts/generate-cocosfiles.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tools/travis-scripts/generate-cocosfiles.sh b/tools/travis-scripts/generate-cocosfiles.sh index 2974ae325a..55869cac59 100755 --- a/tools/travis-scripts/generate-cocosfiles.sh +++ b/tools/travis-scripts/generate-cocosfiles.sh @@ -3,7 +3,10 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PROJECT_ROOT="$DIR"/../.. -COMMITTAG="[AUTO][ci skip]" +COMMITTAG="[AUTO][ci skip]: updating cocos2dx_files.json" +PUSH_REPO="https://api.github.com/repos/cocos2d/cocos2d-x/pulls" +OUTPUT_FILE_PATH="${PROJECT_ROOT}/templates/cocos2dx_files.json" + # Exit on error set -e @@ -11,7 +14,7 @@ set -e generate_cocosfiles_json() { echo "Updates cocos_files.json" - ./for-each-file-in-dir.sh > ${PROJECT_ROOT}/templates/cocos2dx_files.json + ./for-each-file-in-dir.sh > "${OUTPUT_FILE_PATH}" } if [ "$GEN_COCOS_FILES"x != "YES"x ]; then @@ -33,12 +36,6 @@ echo echo cocos_files.json was generated successfully echo - -if [ -z "${COMMITTAG+aaa}" ]; then -# ... if COMMITTAG is not set, use this machine's hostname - COMMITTAG=`hostname -s` -fi - echo echo Using "'$COMMITTAG'" in the commit messages echo @@ -85,11 +82,10 @@ COCOS_BRANCH=update_cocosfiles_"$ELAPSEDSECS" pushd "${DIR}" -# 3. In Cocos2D-X repo, Checkout a branch named "updategeneratedsubmodule" Update the submodule reference to point to the commit with generated bindings cd "${PROJECT_ROOT}" git add . git checkout -b "$COCOS_BRANCH" -git commit -m "$COMMITTAG : updating tools/project-creator/module/cocos_files.json" +git commit -m "$COMMITTAG" #Set remotes git remote add upstream https://${GH_USER}:${GH_PASSWORD}@github.com/${GH_USER}/cocos2d-x.git 2> /dev/null > /dev/null # 4. In Cocos2D-X repo, Push the commit to cocos2d-x repository @@ -99,6 +95,6 @@ git push -fq upstream "$COCOS_BRANCH" 2> /dev/null # 5. echo "Sending Pull Request to base repo ..." -curl --user "${GH_USER}:${GH_PASSWORD}" --request POST --data "{ \"title\": \"$COMMITTAG : updating tools/project-creator/module/cocos_files.json\", \"body\": \"\", \"head\": \"${GH_USER}:${COCOS_BRANCH}\", \"base\": \"${TRAVIS_BRANCH}\"}" https://api.github.com/repos/cocos2d/cocos2d-x/pulls 2> /dev/null > /dev/null +curl --user "${GH_USER}:${GH_PASSWORD}" --request POST --data "{ \"title\": \"$COMMITTAG\", \"body\": \"\", \"head\": \"${GH_USER}:${COCOS_BRANCH}\", \"base\": \"${TRAVIS_BRANCH}\"}" "${PUSH_REPO}" 2> /dev/null > /dev/null popd