Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 10th, 2012  |  syntax: None  |  size: 4.18 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/python
  2. import shutil
  3. import sys
  4. import os
  5. import subprocess
  6.  
  7. ROOT_PATH = "GGEngine/"
  8. SRC_PATH = "src/gengine"
  9. GG_USERNAME = "username"
  10. GIT_REPO_URL = "ssh://" + GG_USERNAME + "@gandogames.com/path/to/engine.git "
  11.  
  12. def shell_exec(command):
  13.         subprocess.call(command, shell=True)
  14.        
  15. def header_print(text):
  16.         print("+\t" + text + "\t")
  17.  
  18. if (os.path.exists(SRC_PATH)):
  19.         header_print("Pulling GGEngine from Master ")
  20.  
  21.         pull_command = """
  22.                                         cd %s &&
  23.                                         git --git-dir=.git fetch &&
  24.                                         git --git-dir=.git --work-tree=. merge origin/master
  25.                                         """ % SRC_PATH
  26.                                                                        
  27.         shell_exec(pull_command)
  28.  
  29. else:
  30.         #checkout gengine.
  31.         header_print("Cloning Good Game Engine from Master")
  32.         shell_exec("git clone " + GIT_REPO_URL)
  33.  
  34. #Library Directory Paths.
  35. LUA_PATH = SRC_PATH + "/Libraries/Lua/Lua-5.1.4/src/"
  36. BOX2D_PATH = SRC_PATH + "/Libraries/Box2D/Box2D/"
  37. COCOSDENSHION_PATH = SRC_PATH + "/Libraries/CocosDenshion/"
  38. UNIT_TEST_PP_PATH = SRC_PATH + "/Libraries/UnitTest++/UnitTest++/"
  39. GGENGINE_PATH = SRC_PATH + "/Classes/Engine "
  40. GGENGINE_SCRIPTS_PATH =  SRC_PATH + "/Resources/Scripts"
  41. GGENGINE_AUDIO_VISUAL_PATH = "\"" + SRC_PATH + "/Resources/Audio " + SRC_PATH + "/Resources/Fonts " + SRC_PATH + "/Resources/Graphics" + "\""
  42.  
  43. #Template Output Paths
  44. LUA_OUT = ROOT_PATH + "lua"
  45. BOX2D_OUT = ROOT_PATH + "box2d"
  46. COCOSDENSHION_OUT = ROOT_PATH + "ccdenshion"
  47. UNIT_TEST_PP_OUT = ROOT_PATH + "unittestpp"
  48. GGENGINE_OUT = ROOT_PATH + "ggengine"
  49. GGENGINE_SCRIPTS_OUT = ROOT_PATH + "ggengine_scripts"
  50. GGENGINE_AUDIO_VISUAL_OUT = ROOT_PATH + "ggengine_audiovisual"
  51.  
  52. #Library Identifiers
  53. LUA_ID = "com.gandogames.lualib"
  54. BOX2D_ID = "com.gandogames.box2d"
  55. COCOSDENSHION_ID = "com.gandogames.ccdenshion"
  56. UNIT_TEST_PP_ID = "com.gandogames.unittest"
  57. GGENGINE_ID = "com.gandogames.ggengine"
  58. GGENGINE_SCRIPTS_ID = "com.gandogames.ggengine_scripts"
  59. GGENGINE_AUDIO_VISUAL_ID = "com.gandogames.ggengine_audiovisual"
  60.  
  61. #check for Libraries directory and delete if it exists
  62. if (os.path.exists(ROOT_PATH)):
  63.         shutil.rmtree(ROOT_PATH)
  64.  
  65. #create templates for all the engine required libraries
  66.  
  67. #Lua
  68. header_print("Creating Lualib Template (abstract)")
  69. shell_exec("python template_generator.py -d " + LUA_PATH + " --description \"Lua Lib\" -i " + LUA_ID + " -c no -o " + LUA_OUT )
  70.  
  71. #Box2d
  72. header_print("Creating Box2d Template (abstract)")
  73. shell_exec("python template_generator.py -d " + BOX2D_PATH + " --description \"Box2d Lib\" -i " + BOX2D_ID + " -c no -o " + BOX2D_OUT)
  74.  
  75. #CocosDenshion
  76. header_print("Creating CocosDenshion Template (abstract)")
  77. shell_exec("python template_generator.py -d " + COCOSDENSHION_PATH + " --description \"CocosDenshion Lib\" -i " + COCOSDENSHION_ID + " -c no -o " + COCOSDENSHION_OUT)
  78.  
  79. #UnitTest++
  80. header_print("Creating UnitTest++ Template (abstract)")
  81. 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)
  82.  
  83. #create template for the Engine Lua scripts
  84. header_print("Creating GGEngine Scripts Template (abstract)")
  85. shell_exec("python template_generator.py -d " + GGENGINE_SCRIPTS_PATH + " --description \"GGEngine Lua Scripts\" -i " + GGENGINE_SCRIPTS_ID + " -c no -o " + GGENGINE_SCRIPTS_OUT)
  86.  
  87. #create template for the Engine audio-vidual Resources
  88. header_print("Creating GGEngine Audio/Visual Template (abstract)")
  89. 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)
  90.  
  91. #create template for the Engine itself
  92. header_print("Creating GGEngine Template (abstract)")
  93. 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)
  94.  
  95. #Copy the Base (concrete) OpenGL ES template
  96. header_print("Moving Base GL ES Template (concrete)")
  97. shell_exec("cp -R base/OpenGLGame.xctemplate GGEngine/")
  98. shell_exec("cp -R base/CocoaTouchApplication.xctemplate GGEngine/")
  99. shell_exec("cp -R base/StoryboardApplication.xctemplate GGEngine/")
  100. shell_exec("cp -R base/iPhoneBase.xctemplate GGEngine/")