From 56ceb4b6d55c12b2865fcaeeadaf67b15f5e2189 Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 6 Mar 2014 14:44:33 +0800 Subject: [PATCH 1/3] update readme and release note --- README.md | 10 ++++++---- docs/RELEASE_NOTES.md | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7036f82ffb..2d27574bc5 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,15 @@ How to start a new game ----------------------- 1. Download the code from [cocos2d download site][4] -2. Enter `tools/project-creator` -3. Run the `create_project.py` script +2. Run `setup.py` +3. Run the `cocos` script Example: - $ cd cocos2d-x/tools/project-creator - $ ./create_project.py -n mygame -k com.your_company.mygame -l cpp -p /home/mygame + $ cd cocos2d-x + $ ./setup.py + $ source FILE_TO_SAVE_SYSTEM_VARIABLE + $ cocos new mygame -p com.your_company.mygame -l cpp -d /home/mygame $ cd /home/mygame ### Build new project for android ### diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index af6e495c10..5be76be356 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -76,7 +76,7 @@ * gcc 4.7 for Linux or Android. For Android ndk-r9 or newer is required. * Visual Studio 2012 (for Windows) -## Run samples +## How to run TestCpp ### Mac OSX & iOS @@ -94,7 +94,7 @@ Can run sample on Android in two ways: **By commnad** $ cd cocos2d-x - $ ./install.py + $ ./setup.py $ cd build $ ./android-build.py -p 10 $ adb install cocos2d-x/tests/proj.android/bin/TestDemo-debug.apk @@ -104,7 +104,7 @@ Then click item on Android device to run tests. Available value of `-p` is the A **Using Eclipse** $ cd cocos2d-x - $ ./install.py + $ ./setup.py $ cd build $ ./android-build.py @@ -139,6 +139,16 @@ Run $ cd bin/testcpp $ ./testcpp +## How to start a new game + + $ cd cocos2d-x + $ ./setup.py + $ source FILE_TO_RECORD_SYSTEM_VARIABLE +`FILE_TO_RECORD_SYSTEM_VARIABLE` may be `~/.bash_profile`, `~/.bash_login` or `~./.profile` + + $ cocos new MyGame -p com.MyCompany.MyGame -l cpp -d directory_to_save +Because `cocos run` command is not ready, so you should do it manually as running `TestCpp`. After `cocos run` command is finished, can just run `cocos run` to run the new game on demand target. + # Highlights of v3.0 From c2cd349da5dfdea8a5138566d0655b481de609eb Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 6 Mar 2014 14:56:22 +0800 Subject: [PATCH 2/3] Uses 'generate-tempate-files.py' to generate cocos2dx_files.json --- tools/travis-scripts/config.gitingore | 112 +++++++++++++ tools/travis-scripts/generate-cocosfiles.sh | 3 +- .../travis-scripts/generate-template-files.py | 149 ++++++++++++++++++ 3 files changed, 262 insertions(+), 2 deletions(-) create mode 100644 tools/travis-scripts/config.gitingore create mode 100755 tools/travis-scripts/generate-template-files.py diff --git a/tools/travis-scripts/config.gitingore b/tools/travis-scripts/config.gitingore new file mode 100644 index 0000000000..e16be3535a --- /dev/null +++ b/tools/travis-scripts/config.gitingore @@ -0,0 +1,112 @@ +#This configure file use .gitingore rules. +#So you can config this file like config .gitingore +# + +# Ignore thumbnails created by windows +Thumbs.db +.git + +# ignore copy files +/lib +/linux-build +/samples +/templates +/tests +/plugin/samples +/tools + +.gitattributes +.gitignore +.gitmodules +.travis.yml +setup.py + +# 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 +libs/ +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 + +#include +!/tools/cocos2d-console/console/bin/ +!/plugin-x/plugin-x_ios.xcworkspace/ + diff --git a/tools/travis-scripts/generate-cocosfiles.sh b/tools/travis-scripts/generate-cocosfiles.sh index 55869cac59..1014bc303e 100755 --- a/tools/travis-scripts/generate-cocosfiles.sh +++ b/tools/travis-scripts/generate-cocosfiles.sh @@ -7,14 +7,13 @@ 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 generate_cocosfiles_json() { echo "Updates cocos_files.json" - ./for-each-file-in-dir.sh > "${OUTPUT_FILE_PATH}" + ./generate-template-files.py } if [ "$GEN_COCOS_FILES"x != "YES"x ]; then diff --git a/tools/travis-scripts/generate-template-files.py b/tools/travis-scripts/generate-template-files.py new file mode 100755 index 0000000000..ee974866be --- /dev/null +++ b/tools/travis-scripts/generate-template-files.py @@ -0,0 +1,149 @@ +#!/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 + +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=[] + + 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) + ): + self.fileList.append("%s/" %relativePath) + 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) + self.fileList.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.sort() + content = "[\n\"%s\"\n]" % ("\",\n\"".join(self.fileList)) + f.write(content) + 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") + From e95ce5ab3da6f3afcadaaa50695f3a5b571862f3 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 6 Mar 2014 06:59:49 +0000 Subject: [PATCH 3/3] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cocos2dx_files.json.REMOVED.git-id b/templates/cocos2dx_files.json.REMOVED.git-id index 1a8a41cef2..43b9fbd38c 100644 --- a/templates/cocos2dx_files.json.REMOVED.git-id +++ b/templates/cocos2dx_files.json.REMOVED.git-id @@ -1 +1 @@ -c95c8696018ed9dbb68d20bb12242bfc8de6c273 \ No newline at end of file +b8e377ea1413a393a14914cae394a4d6a414b2c4 \ No newline at end of file