mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2025-10-09 07:05:23 +00:00
初始化
This commit is contained in:
56
cocos2d-x/tools/travis-scripts/before-install.sh
Executable file
56
cocos2d-x/tools/travis-scripts/before-install.sh
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
COCOS2DX_ROOT="$DIR"/../..
|
||||
HOST_NAME=""
|
||||
|
||||
pushd $COCOS2DX_ROOT
|
||||
python download-deps.py -r=yes
|
||||
popd
|
||||
|
||||
mkdir -p $HOME/bin
|
||||
cd $HOME/bin
|
||||
|
||||
function install_android_ndk()
|
||||
{
|
||||
# Download android ndk
|
||||
if [ $TRAVIS_OS_NAME = 'osx' ]; then
|
||||
HOST_NAME="darwin"
|
||||
else
|
||||
HOST_NAME="linux"
|
||||
fi
|
||||
echo "Download android-ndk-r16b-${HOST_NAME}-x86_64.zip ..."
|
||||
curl -O http://dl.google.com/android/repository/android-ndk-r16b-${HOST_NAME}-x86_64.zip
|
||||
echo "Decompress android-ndk-r16b-${HOST_NAME}-x86_64.zip ..."
|
||||
unzip -q android-ndk-r16b-${HOST_NAME}-x86_64.zip
|
||||
# Rename ndk
|
||||
mv android-ndk-r16b android-ndk
|
||||
}
|
||||
|
||||
function install_clang()
|
||||
{
|
||||
if [ ! -f $COCOS2DX_ROOT/tools/bindings-generator/libclang/libclang.so ]; then
|
||||
echo "Download clang"
|
||||
curl -O http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz
|
||||
echo "Decompress clang"
|
||||
tar xpf ./clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz
|
||||
cp ./clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/lib/libclang.so.5.0 $COCOS2DX_ROOT/tools/bindings-generator/libclang/libclang.so
|
||||
else
|
||||
echo "Skip downloading clang"
|
||||
echo " file $COCOS2DX_ROOT/tools/bindings-generator/libclang/libclang.so exists!"
|
||||
fi
|
||||
}
|
||||
|
||||
function install_python_module_for_osx()
|
||||
{
|
||||
sudo easy_install pip
|
||||
sudo -H pip install pyyaml
|
||||
sudo -H pip install Cheetah
|
||||
}
|
||||
|
||||
#we only use osx for generate bindings
|
||||
install_android_ndk
|
||||
install_python_module_for_osx
|
||||
install_clang
|
149
cocos2d-x/tools/travis-scripts/config.gitingore
Normal file
149
cocos2d-x/tools/travis-scripts/config.gitingore
Normal file
@@ -0,0 +1,149 @@
|
||||
#This configure file use .gitingore rules.
|
||||
#So you can config this file like config .gitingore
|
||||
#
|
||||
|
||||
# Ignore thumbnails created by windows
|
||||
Thumbs.db
|
||||
.git
|
||||
|
||||
/node_modules
|
||||
/tools/make-package/cocos2d-x.zip
|
||||
/simulator_*.zip
|
||||
/prebuilt_*.zip
|
||||
|
||||
# ignore copy files which not needed by new project
|
||||
/lib
|
||||
/linux-build
|
||||
/samples
|
||||
/templates
|
||||
/tests
|
||||
/plugin/samples
|
||||
/tools
|
||||
/utils
|
||||
/licenses
|
||||
/simulator
|
||||
/build/build
|
||||
/cocos/scripting/js-bindings/proj.ios_mac/build/cocos2d_js_bindings.build
|
||||
|
||||
|
||||
.gitattributes
|
||||
.gitignore
|
||||
.gitmodules
|
||||
.travis.yml
|
||||
/setup.py
|
||||
/auto-build-src.bat
|
||||
/auto-build.bat
|
||||
/download-deps.py
|
||||
/gulpfile.js
|
||||
/package.json
|
||||
/README.md
|
||||
|
||||
# Ignore files build by Visual Studio
|
||||
win32-msvc-vs201*-x86
|
||||
*.obj
|
||||
*.exe
|
||||
*.pdb
|
||||
*.aps
|
||||
*.vcproj.*.user
|
||||
*.vspscc
|
||||
*_i.c
|
||||
*.i
|
||||
*.icf
|
||||
*_p.c
|
||||
*.ncb
|
||||
*.suo
|
||||
*.tlb
|
||||
*.tlh
|
||||
*.bak
|
||||
*.cache
|
||||
*.ilk
|
||||
*.log
|
||||
[Bb]in
|
||||
[Dd]ebug/
|
||||
[Dd]ebug.win32/
|
||||
*.sbr
|
||||
*.sdf
|
||||
obj/
|
||||
[Rr]elease/
|
||||
[Rr]elease.win32/
|
||||
_ReSharper*/
|
||||
[Tt]est[Rr]esult*
|
||||
ipch/
|
||||
*.opensdf
|
||||
|
||||
# Ignore files build by ndk and eclipse
|
||||
bin/
|
||||
obj/
|
||||
gen/
|
||||
assets/
|
||||
local.properties
|
||||
|
||||
# Ignore python compiled files
|
||||
*.pyc
|
||||
|
||||
# Ignore files build by airplay and marmalade
|
||||
build_*_xcode/
|
||||
build_*_vc10/
|
||||
|
||||
# Ignore files build by xcode
|
||||
*.mode*v*
|
||||
*.pbxuser
|
||||
*.xcbkptlist
|
||||
*.xcscheme
|
||||
*.xcworkspacedata
|
||||
*.xcuserstate
|
||||
*.xccheckout
|
||||
xcschememanagement.plist
|
||||
.DS_Store
|
||||
._.*
|
||||
xcuserdata/
|
||||
DerivedData/
|
||||
|
||||
# Ignore files built by AppCode
|
||||
.idea/
|
||||
|
||||
# Ignore files built by bada
|
||||
.Simulator-Debug/
|
||||
.Target-Debug/
|
||||
.Target-Release/
|
||||
|
||||
# Ignore files built by blackberry
|
||||
Simulator/
|
||||
Device-Debug/
|
||||
Device-Release/
|
||||
|
||||
# Ignore vim swaps
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Ignore files created by create_project.py
|
||||
/projects
|
||||
|
||||
# CTags
|
||||
tags
|
||||
|
||||
# Ignore web dir
|
||||
/web
|
||||
|
||||
#include
|
||||
!/tools/cocos2d-console/console/bin/
|
||||
!/plugin-x/plugin-x_ios.xcworkspace/
|
||||
!/cocos/2d/platform/android/java/res/
|
||||
# Permit plugins to ship third-party libraries.
|
||||
!/plugin/plugins/*/proj.android/libs/*.jar
|
||||
!/plugin/plugins/*/proj.android/libs
|
||||
!/tools/bindings-generator/tools/win32/*
|
||||
!/cocos/platform/android/java/libs
|
||||
!/cocos/platform/android/ControllerManualAdapter/libs
|
||||
!/external/win32/libs/Debug/*
|
||||
|
||||
/*.zip
|
||||
v*-lua-runtime-*.zip
|
||||
|
||||
# android build tmp files
|
||||
/cocos/platform/android/libcocos2dx/.gradle
|
||||
/cocos/platform/android/libcocos2dx/build
|
||||
/cocos/platform/android/libcocos2dx/libcocos2dx.iml
|
||||
|
||||
# xcode build tmp data
|
||||
*build/XCBuildData
|
29
cocos2d-x/tools/travis-scripts/for-each-file-in-dir.sh
Executable file
29
cocos2d-x/tools/travis-scripts/for-each-file-in-dir.sh
Executable file
@@ -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 "]"
|
||||
|
129
cocos2d-x/tools/travis-scripts/generate-bindings.sh
Executable file
129
cocos2d-x/tools/travis-scripts/generate-bindings.sh
Executable file
@@ -0,0 +1,129 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Generate script bindings for Cocos2D-X-lite
|
||||
# ... using Android NDK system headers
|
||||
# ... and push these changes to remote repos
|
||||
|
||||
# Dependencies
|
||||
#
|
||||
# For bindings generator:
|
||||
# (see tools/tojs/genbindings.py for the defaults used if the environment is not customized)
|
||||
#
|
||||
# * $PYTHON_BIN
|
||||
# * $CLANG_ROOT
|
||||
# * $NDK_ROOT
|
||||
#
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
PROJECT_ROOT="$DIR/../.."
|
||||
TOJS_ROOT="$PROJECT_ROOT/tools/tojs"
|
||||
JS_AUTO_GENERATED_DIR="$PROJECT_ROOT/cocos/scripting/js-bindings/auto"
|
||||
COMMITTAG="[ci skip][AUTO]: updating jsbinding automatically"
|
||||
ELAPSEDSECS=`date +%s`
|
||||
COCOS_BRANCH="update_js_bindings_$ELAPSEDSECS"
|
||||
COCOS_ROBOT_REMOTE="https://${GH_USER}:${GH_PASSWORD}@github.com/${GH_USER}/cocos2d-x-lite.git"
|
||||
PULL_REQUEST_REPO="https://api.github.com/repos/cocos-creator/cocos2d-x-lite/pulls"
|
||||
FETCH_REMOTE_BRANCH=$1
|
||||
JS_COMMIT_PATH="cocos/scripting/js-bindings/auto"
|
||||
|
||||
# Exit on error
|
||||
set -e
|
||||
|
||||
generate_bindings_glue_codes()
|
||||
{
|
||||
echo "Create auto-generated jsbinding glue codes."
|
||||
pushd "$TOJS_ROOT"
|
||||
./genbindings.py
|
||||
rm userconf.ini
|
||||
popd
|
||||
}
|
||||
|
||||
pushd "$PROJECT_ROOT"
|
||||
#Set git user for cocos2d-js repo
|
||||
git config user.email ${GH_EMAIL}
|
||||
git config user.name ${GH_USER}
|
||||
popd
|
||||
|
||||
# 1. Generate js bindings
|
||||
generate_bindings_glue_codes
|
||||
|
||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "${GH_EMAIL}" ]; then
|
||||
echo "GH_EMAIL not set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${GH_USER}" ]; then
|
||||
echo "GH_USER not set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${GH_PASSWORD}" ]; then
|
||||
echo "GH_USER not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo Bindings generated successfully
|
||||
echo
|
||||
|
||||
echo
|
||||
echo Using "'$COMMITTAG'" in the commit messages
|
||||
echo
|
||||
|
||||
|
||||
echo Using "$ELAPSEDSECS" in the branch names for pseudo-uniqueness
|
||||
|
||||
# 2. In Bindings repo, Check if there are any files that are different from the index
|
||||
|
||||
pushd "$PROJECT_ROOT"
|
||||
|
||||
# Run status to record the output in the log
|
||||
git status
|
||||
|
||||
echo
|
||||
echo Comparing with origin HEAD ...
|
||||
echo
|
||||
|
||||
git fetch origin ${FETCH_REMOTE_BRANCH}
|
||||
|
||||
# Don't exit on non-zero return value
|
||||
set +e
|
||||
|
||||
git diff FETCH_HEAD --stat --exit-code ${JS_COMMIT_PATH}
|
||||
|
||||
JS_DIFF_RETVAL=$?
|
||||
if [ $JS_DIFF_RETVAL -eq 0 ]
|
||||
then
|
||||
echo
|
||||
echo "No differences in generated files"
|
||||
echo "Exiting with success."
|
||||
echo
|
||||
exit 0
|
||||
else
|
||||
echo
|
||||
echo "Generated files differ from HEAD. Continuing."
|
||||
echo
|
||||
fi
|
||||
|
||||
# Exit on error
|
||||
set -e
|
||||
|
||||
git add -f --all "$JS_AUTO_GENERATED_DIR"
|
||||
git checkout -b "$COCOS_BRANCH"
|
||||
git commit -m "$COMMITTAG"
|
||||
|
||||
#Set remotes
|
||||
git remote add upstream "$COCOS_ROBOT_REMOTE" 2> /dev/null > /dev/null
|
||||
git fetch upstream --no-recurse-submodules
|
||||
|
||||
echo "Pushing to Robot's repo ..."
|
||||
# git push -fq upstream "$COCOS_BRANCH" 2> /dev/null
|
||||
git push -fq upstream "$COCOS_BRANCH"
|
||||
|
||||
# 7.
|
||||
echo "Sending Pull Request to base repo ..."
|
||||
curl --user "${GH_USER}:${GH_PASSWORD}" --request POST --data "{ \"title\": \"$COMMITTAG\", \"body\": \"\", \"head\": \"${GH_USER}:${COCOS_BRANCH}\", \"base\": \"${TRAVIS_BRANCH}\"}" "${PULL_REQUEST_REPO}" 2> /dev/null > /dev/null
|
||||
|
||||
popd
|
124
cocos2d-x/tools/travis-scripts/generate-cocosfiles.sh
Executable file
124
cocos2d-x/tools/travis-scripts/generate-cocosfiles.sh
Executable file
@@ -0,0 +1,124 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "${GH_EMAIL}" ]; then
|
||||
echo "GH_EMAIL not set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${GH_USER}" ]; then
|
||||
echo "GH_USER not set"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${GH_PASSWORD}" ]; then
|
||||
echo "GH_USER not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
PROJECT_ROOT="$DIR"/../..
|
||||
|
||||
COMMITTAG="[AUTO][ci skip]: updating cocos2dx_files.json"
|
||||
PUSH_REPO="https://api.github.com/repos/cocos-creator/cocos2d-x-lite/pulls"
|
||||
OUTPUT_FILE_PATH="${PROJECT_ROOT}/templates/cocos2dx_files.json"
|
||||
FETCH_REMOTE_BRANCH=$1
|
||||
COMMIT_PATH="templates/cocos2dx_files.json"
|
||||
|
||||
# Exit on error
|
||||
set -e
|
||||
|
||||
generate_cocosfiles_json()
|
||||
{
|
||||
echo "Updates cocos_files.json"
|
||||
./generate-template-files.py
|
||||
}
|
||||
|
||||
generate_cocosfiles_json
|
||||
|
||||
pushd "$PROJECT_ROOT"
|
||||
#Set git user for cocos2d-x repo
|
||||
git config user.email ${GH_EMAIL}
|
||||
git config user.name ${GH_USER}
|
||||
popd
|
||||
|
||||
|
||||
# 1. Updates cocos_files.json
|
||||
generate_cocosfiles_json
|
||||
|
||||
echo
|
||||
echo cocos_files.json was generated successfully
|
||||
echo
|
||||
|
||||
echo
|
||||
echo Using "'$COMMITTAG'" in the commit messages
|
||||
echo
|
||||
|
||||
ELAPSEDSECS=`date +%s`
|
||||
echo Using "$ELAPSEDSECS" in the branch names for pseudo-uniqueness
|
||||
|
||||
|
||||
# 2. Check if there are any files that are different from the index
|
||||
|
||||
pushd "$PROJECT_ROOT"
|
||||
|
||||
# Run status to record the output in the log
|
||||
git status
|
||||
|
||||
echo
|
||||
echo Comparing with origin HEAD ...
|
||||
echo
|
||||
|
||||
git fetch origin ${FETCH_REMOTE_BRANCH}
|
||||
|
||||
# Don't exit on non-zero return value
|
||||
set +e
|
||||
git diff FETCH_HEAD --stat --exit-code ${COMMIT_PATH}
|
||||
|
||||
DIFF_RETVAL=$?
|
||||
if [ $DIFF_RETVAL -eq 0 ]
|
||||
then
|
||||
echo
|
||||
echo "No differences in cocos_files.json"
|
||||
echo "Exiting with success."
|
||||
echo
|
||||
exit 0
|
||||
else
|
||||
echo
|
||||
echo "Generated files differ from HEAD. Continuing."
|
||||
echo
|
||||
fi
|
||||
|
||||
# Exit on error
|
||||
set -e
|
||||
|
||||
popd
|
||||
|
||||
COCOS_BRANCH=update_cocosfiles_"$ELAPSEDSECS"
|
||||
|
||||
pushd "${DIR}"
|
||||
|
||||
cd "${PROJECT_ROOT}"
|
||||
git add templates/cocos2dx_files.json
|
||||
git checkout -b "$COCOS_BRANCH"
|
||||
git commit -m "$COMMITTAG"
|
||||
#Set remotes
|
||||
# should not add remote twice
|
||||
upstream_cnt=$(git remote get-url upstream 2>/dev/null | wc -l)
|
||||
if [ $upstream_cnt -eq 0 ]
|
||||
then
|
||||
git remote add upstream https://${GH_USER}:${GH_PASSWORD}@github.com/${GH_USER}/cocos2d-x-lite.git 2> /dev/null > /dev/null
|
||||
fi
|
||||
|
||||
git fetch upstream --no-recurse-submodules
|
||||
|
||||
echo "Pushing to Robot's repo ..."
|
||||
# print log
|
||||
git push -fq upstream "$COCOS_BRANCH"
|
||||
|
||||
# 5.
|
||||
echo "Sending Pull Request to base repo ..."
|
||||
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
|
175
cocos2d-x/tools/travis-scripts/generate-template-files.py
Executable file
175
cocos2d-x/tools/travis-scripts/generate-template-files.py
Executable file
@@ -0,0 +1,175 @@
|
||||
#!/usr/bin/python
|
||||
#coding=utf-8
|
||||
"""****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import json
|
||||
|
||||
class CocosFileList:
|
||||
"""
|
||||
Function:
|
||||
List cocos engine's files and save to "../module/cocos_file_list.json".
|
||||
config "config.gitingore" file can set exclude or include files.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.excludeConfig=[]
|
||||
self.inludeConfig=[]
|
||||
self.rootDir = ""
|
||||
self.fileList_com=[]
|
||||
self.fileList_js=[]
|
||||
|
||||
self.jsPath = ["cocos/scripting/js-bindings", "external/spidermonkey", "tools/bindings-generator", "tools/tojs" ]
|
||||
|
||||
def readIngoreFile(self, fileName):
|
||||
"""
|
||||
Read configure file which use ".gitingore"'s rules.
|
||||
"""
|
||||
pfile = ""
|
||||
try:
|
||||
pfile = open(fileName, 'r')
|
||||
except IOError:
|
||||
return
|
||||
|
||||
for line in pfile:
|
||||
line = line.strip()
|
||||
if not line or line[0] == "#":
|
||||
continue
|
||||
|
||||
#convert .gitingore regular expression to python's regular expression
|
||||
line=line.replace('.', '\\.')
|
||||
line=line.replace('*', '.*')
|
||||
line="%s$" %line
|
||||
if line[0] == "!":
|
||||
self.inludeConfig.append(line[1:])
|
||||
else:
|
||||
self.excludeConfig.append(line)
|
||||
pfile.close()
|
||||
|
||||
def parseFileList(self, rootDir):
|
||||
self.rootDir = os.path.abspath(rootDir)
|
||||
self.__parseFileList(rootDir)
|
||||
|
||||
def __parseFileList(self, folderdir):
|
||||
"""
|
||||
"""
|
||||
for item in os.listdir(folderdir):
|
||||
path = os.path.join(folderdir, item)
|
||||
relativePath = path[len(self.rootDir)+1:len(path)]
|
||||
relativePath = relativePath.replace('\\', '/')
|
||||
if os.path.isdir(path):
|
||||
if (
|
||||
self.__bInclude("/%s" %relativePath) or
|
||||
self.__bInclude("/%s/" %relativePath) or
|
||||
self.__bInclude(item) or
|
||||
self.__bInclude("%s/" %item)
|
||||
):
|
||||
|
||||
foundJSModule = False
|
||||
for jsPath in self.jsPath:
|
||||
if relativePath.upper().find(jsPath.upper()) == 0:
|
||||
foundJSModule = True
|
||||
break
|
||||
|
||||
if foundJSModule:
|
||||
self.fileList_js.append("%s/" %relativePath)
|
||||
else:
|
||||
self.fileList_com.append("%s/" %relativePath)
|
||||
self.__parseFileList(path)
|
||||
continue
|
||||
if (
|
||||
self.__bExclude("/%s" %relativePath) or
|
||||
self.__bExclude("/%s/" %relativePath) or
|
||||
self.__bExclude(item) or
|
||||
self.__bExclude("%s/" %item)
|
||||
):
|
||||
continue
|
||||
self.__parseFileList(path)
|
||||
else:
|
||||
if (
|
||||
not self.__bInclude("/%s" %relativePath) and
|
||||
not self.__bInclude(item)
|
||||
):
|
||||
if (
|
||||
self.__bExclude("/%s" %relativePath) or
|
||||
self.__bExclude(item)
|
||||
):
|
||||
continue
|
||||
# print(relativePath)
|
||||
|
||||
foundJSModule = False
|
||||
for jsPath in self.jsPath:
|
||||
if relativePath.upper().find(jsPath.upper()) == 0:
|
||||
foundJSModule = True
|
||||
break
|
||||
|
||||
if foundJSModule:
|
||||
self.fileList_js.append(relativePath)
|
||||
else:
|
||||
self.fileList_com.append(relativePath)
|
||||
|
||||
def __bExclude(self, item):
|
||||
bexclude = False
|
||||
for index in range(len(self.excludeConfig)):
|
||||
if re.match(self.excludeConfig[index], item):
|
||||
bexclude = True
|
||||
break
|
||||
return bexclude
|
||||
|
||||
def __bInclude(self, item):
|
||||
binclude = False
|
||||
for index in range(len(self.inludeConfig)):
|
||||
if re.match(self.inludeConfig[index], item):
|
||||
binclude = True
|
||||
break
|
||||
return binclude
|
||||
|
||||
def writeFileList(self,fileName):
|
||||
"""
|
||||
Save content to file with json format.
|
||||
"""
|
||||
f = open(fileName,"w")
|
||||
self.fileList_com.sort()
|
||||
self.fileList_js.sort()
|
||||
content ={'common':self.fileList_com,'js':self.fileList_js}
|
||||
json.dump(content,f,sort_keys=True,indent=4)
|
||||
f.close()
|
||||
return True
|
||||
|
||||
# ------------ main --------------
|
||||
if __name__ == '__main__':
|
||||
|
||||
cocos_root =os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
|
||||
cocos_file_path =os.path.abspath(os.path.join(cocos_root, "templates", "cocos2dx_files.json"))
|
||||
cocos_file_ingore =os.path.abspath(os.path.join(os.path.dirname(__file__), "config.gitingore"))
|
||||
# print ("begin list files")
|
||||
cocosObj = CocosFileList()
|
||||
cocosObj.readIngoreFile(cocos_file_ingore)
|
||||
cocosObj.parseFileList(cocos_root)
|
||||
cocosObj.writeFileList(cocos_file_path)
|
||||
# print ("had list files to cocos_file_list.json")
|
||||
|
21
cocos2d-x/tools/travis-scripts/run-script.sh
Executable file
21
cocos2d-x/tools/travis-scripts/run-script.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
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
|
||||
|
||||
# to fix git error: shallow update not allowed
|
||||
# https://stackoverflow.com/questions/28983842/remote-rejected-shallow-update-not-allowed-after-changing-git-remote-url
|
||||
#git remote add old https://github.com/cocos-creator/cocos2d-x-lite
|
||||
#git fetch --unshallow old
|
||||
|
||||
cd $COCOS2DX_ROOT/tools/travis-scripts
|
||||
./generate-bindings.sh $TRAVIS_BRANCH
|
||||
|
||||
cd $COCOS2DX_ROOT/tools/travis-scripts
|
||||
./generate-cocosfiles.sh $TRAVIS_BRANCH
|
||||
exit 0
|
Reference in New Issue
Block a user