Created
August 16, 2011 09:20
-
-
Save Goles/1148722 to your computer and use it in GitHub Desktop.
Gando Games Automatic Engine Template Generation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import shutil | |
import sys | |
import os | |
import subprocess | |
ROOT_PATH = "GGEngine/" | |
SRC_PATH = "src/gengine" | |
GG_USERNAME = "username" | |
GIT_REPO_URL = "ssh://" + GG_USERNAME + "@gandogames.com/path/to/engine.git " | |
def shell_exec(command): | |
subprocess.call(command, shell=True) | |
def header_print(text): | |
print("+\t" + text + "\t") | |
if (os.path.exists(SRC_PATH)): | |
header_print("Pulling GGEngine from Master ") | |
pull_command = """ | |
cd %s && | |
git --git-dir=.git fetch && | |
git --git-dir=.git --work-tree=. merge origin/master | |
""" % SRC_PATH | |
shell_exec(pull_command) | |
else: | |
#checkout gengine. | |
header_print("Cloning Good Game Engine from Master") | |
shell_exec("git clone " + GIT_REPO_URL) | |
#Library Directory Paths. | |
LUA_PATH = SRC_PATH + "/Libraries/Lua/Lua-5.1.4/src/" | |
BOX2D_PATH = SRC_PATH + "/Libraries/Box2D/Box2D/" | |
COCOSDENSHION_PATH = SRC_PATH + "/Libraries/CocosDenshion/" | |
UNIT_TEST_PP_PATH = SRC_PATH + "/Libraries/UnitTest++/UnitTest++/" | |
GGENGINE_PATH = SRC_PATH + "/Classes/Engine " | |
GGENGINE_SCRIPTS_PATH = SRC_PATH + "/Resources/Scripts" | |
GGENGINE_AUDIO_VISUAL_PATH = "\"" + SRC_PATH + "/Resources/Audio " + SRC_PATH + "/Resources/Fonts " + SRC_PATH + "/Resources/Graphics" + "\"" | |
#Template Output Paths | |
LUA_OUT = ROOT_PATH + "lua" | |
BOX2D_OUT = ROOT_PATH + "box2d" | |
COCOSDENSHION_OUT = ROOT_PATH + "ccdenshion" | |
UNIT_TEST_PP_OUT = ROOT_PATH + "unittestpp" | |
GGENGINE_OUT = ROOT_PATH + "ggengine" | |
GGENGINE_SCRIPTS_OUT = ROOT_PATH + "ggengine_scripts" | |
GGENGINE_AUDIO_VISUAL_OUT = ROOT_PATH + "ggengine_audiovisual" | |
#Library Identifiers | |
LUA_ID = "com.gandogames.lualib" | |
BOX2D_ID = "com.gandogames.box2d" | |
COCOSDENSHION_ID = "com.gandogames.ccdenshion" | |
UNIT_TEST_PP_ID = "com.gandogames.unittest" | |
GGENGINE_ID = "com.gandogames.ggengine" | |
GGENGINE_SCRIPTS_ID = "com.gandogames.ggengine_scripts" | |
GGENGINE_AUDIO_VISUAL_ID = "com.gandogames.ggengine_audiovisual" | |
#check for Libraries directory and delete if it exists | |
if (os.path.exists(ROOT_PATH)): | |
shutil.rmtree(ROOT_PATH) | |
#create templates for all the engine required libraries | |
#Lua | |
header_print("Creating Lualib Template (abstract)") | |
shell_exec("python template_generator.py -d " + LUA_PATH + " --description \"Lua Lib\" -i " + LUA_ID + " -c no -o " + LUA_OUT ) | |
#Box2d | |
header_print("Creating Box2d Template (abstract)") | |
shell_exec("python template_generator.py -d " + BOX2D_PATH + " --description \"Box2d Lib\" -i " + BOX2D_ID + " -c no -o " + BOX2D_OUT) | |
#CocosDenshion | |
header_print("Creating CocosDenshion Template (abstract)") | |
shell_exec("python template_generator.py -d " + COCOSDENSHION_PATH + " --description \"CocosDenshion Lib\" -i " + COCOSDENSHION_ID + " -c no -o " + COCOSDENSHION_OUT) | |
#UnitTest++ | |
header_print("Creating UnitTest++ Template (abstract)") | |
shell_exec("python template_generator.py -d " + UNIT_TEST_PP_PATH + " --description \"UnitTest++ Lib\" -i " + UNIT_TEST_PP_ID + " -c no -o " + UNIT_TEST_PP_OUT) | |
#create template for the Engine Lua scripts | |
header_print("Creating GGEngine Scripts Template (abstract)") | |
shell_exec("python template_generator.py -d " + GGENGINE_SCRIPTS_PATH + " --description \"GGEngine Lua Scripts\" -i " + GGENGINE_SCRIPTS_ID + " -c no -o " + GGENGINE_SCRIPTS_OUT) | |
#create template for the Engine audio-vidual Resources | |
header_print("Creating GGEngine Audio/Visual Template (abstract)") | |
shell_exec("python template_generator.py -d " + GGENGINE_AUDIO_VISUAL_PATH + " --description \"GGEngine Audiovisual resources\" -i " + GGENGINE_AUDIO_VISUAL_ID + " -c no -o " + GGENGINE_AUDIO_VISUAL_OUT) | |
#create template for the Engine itself | |
header_print("Creating GGEngine Template (abstract)") | |
shell_exec("python template_generator.py -d " + GGENGINE_PATH + " --description \"Freetype Lib\" -i " + GGENGINE_ID + " --ancestors \"" + LUA_ID + " " + BOX2D_ID + " " + COCOSDENSHION_ID + " " + UNIT_TEST_PP_ID + " " + GGENGINE_AUDIO_VISUAL_ID + " " + GGENGINE_SCRIPTS_ID +"\" -c no -o " + GGENGINE_OUT) | |
#Copy the Base (concrete) OpenGL ES template | |
header_print("Moving Base GL ES Template (concrete)") | |
shell_exec("cp -R base/OpenGLGame.xctemplate GGEngine/") | |
shell_exec("cp -R base/CocoaTouchApplication.xctemplate GGEngine/") | |
shell_exec("cp -R base/StoryboardApplication.xctemplate GGEngine/") | |
shell_exec("cp -R base/iPhoneBase.xctemplate GGEngine/") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment