In this weekend, I successfully used python to deal with .xcodeproj folder, change a existing project into a new one.
The source code is here https://github.com/walzer/cocos2d-x/tree/create-hybrid-project/template-hybrid
Create a new project with extensions & chipmunk:
./create-project.py
project MyGamepackage com.MyCompany.AwesomeGamemodules extensions chipmunkproject HelloWorld
Create a new project using lua script:
bq. ./create-project.pypackage com.PSY.GangnamStylelanguage lua
The design is :
- All libraries and header search paths are already added into HelloCpp, HelloLua, HelloJavascript
- This script create-project.py will copy HelloLanguage to cocos2d-x/project/<project_name>/ folder, rename HelloLanguage to <project_name>
- create-project.py will call template-hybrid/script_/process_proj.py, e.g. script_ios/process_proj.py
- process_proj.py in each platform will deal with files in cocos2d-x/project/<project_name>/proj., rename files, replace strings and, remove useless modules.
Comoon design is to add modules into a existing project file, such as Titanium and Cordova do. But my design is firstly we have a big-fat-all-involved project, then remove useless modules from it. Deleting texts via regex is easier than adding texts to specified lines.
I would like to invite your suggestion on this case. This feature #1488 is still on early stage.