mirror of https://github.com/axmolengine/axmol.git
Optimize the implementation of generating binary templates.
This commit is contained in:
parent
e21634f618
commit
a680638de2
|
@ -22,7 +22,6 @@ class CocosBinTemplateGenerator(object):
|
|||
# get path variables
|
||||
self.cur_dir = os.path.realpath(os.path.dirname(__file__))
|
||||
self.repo_x = os.path.realpath(args.repo_x)
|
||||
self.temp_dir = os.path.join(self.cur_dir, os.pardir, "templates")
|
||||
self.lib_dir = os.path.join(self.repo_x, 'prebuilt')
|
||||
self.engine_template_dir = os.path.join(self.repo_x, "templates")
|
||||
|
||||
|
@ -43,29 +42,14 @@ class CocosBinTemplateGenerator(object):
|
|||
self.modify_binary_mk()
|
||||
self.gen_templates()
|
||||
|
||||
# copy the templates into the templates folder of engine
|
||||
excopy.copy_files_in_dir(self.temp_dir, os.path.join(self.repo_x, "templates"))
|
||||
|
||||
# remove the temp dir
|
||||
utils_cocos.rmdir(self.temp_dir)
|
||||
|
||||
def clean_template(self):
|
||||
utils_cocos.rmdir(self.temp_dir)
|
||||
utils_cocos.rmdir(os.path.join(self.engine_template_dir, "cpp-template-binary"))
|
||||
utils_cocos.rmdir(os.path.join(self.engine_template_dir, "lua-template-binary"))
|
||||
utils_cocos.rmdir(os.path.join(self.engine_template_dir, "js-template-binary"))
|
||||
|
||||
def copy_template(self):
|
||||
for item in self.config_json[CocosBinTemplateGenerator.KEY_COPY_CONFIG]:
|
||||
excopy.copy_files_with_config(item, self.repo_x, self.temp_dir)
|
||||
|
||||
templates_dir = os.path.join(self.cur_dir, os.path.pardir, "bin-templates")
|
||||
excopy.copy_files_in_dir(os.path.join(templates_dir, "cpp-template-default"),
|
||||
os.path.join(self.temp_dir, "cpp-template-binary"))
|
||||
excopy.copy_files_in_dir(os.path.join(templates_dir, "lua-template-runtime"),
|
||||
os.path.join(self.temp_dir, "lua-template-binary"))
|
||||
excopy.copy_files_in_dir(os.path.join(templates_dir, "js-template-runtime"),
|
||||
os.path.join(self.temp_dir, "js-template-binary"))
|
||||
excopy.copy_files_with_config(item, self.repo_x, self.engine_template_dir)
|
||||
|
||||
def modify_binary_mk(self):
|
||||
android_libs = os.path.join(self.lib_dir, "android")
|
||||
|
@ -85,7 +69,7 @@ class CocosBinTemplateGenerator(object):
|
|||
return config_json
|
||||
|
||||
def gen_templates(self):
|
||||
dst_dir = self.temp_dir
|
||||
dst_dir = self.engine_template_dir
|
||||
x_path = self.repo_x
|
||||
lib_dir = self.lib_dir
|
||||
# modify the VS project file of templates
|
||||
|
@ -168,7 +152,7 @@ class CocosBinTemplateGenerator(object):
|
|||
if not os.path.isdir(fullPath):
|
||||
continue
|
||||
|
||||
if not re.match(".*-template-.*", name):
|
||||
if not re.match(".*-template-binary", name):
|
||||
continue
|
||||
|
||||
cfg_path = os.path.join(fullPath, ".cocos-project.json")
|
||||
|
|
|
@ -155,6 +155,18 @@
|
|||
{
|
||||
"from": "cocos/platform/android/java/src",
|
||||
"to": "js-template-binary/frameworks/runtime-src/proj.android/src"
|
||||
},
|
||||
{
|
||||
"from": "tools/framework-compile/bin-templates/cpp-template-default",
|
||||
"to": "cpp-template-binary"
|
||||
},
|
||||
{
|
||||
"from": "tools/framework-compile/bin-templates/lua-template-runtime",
|
||||
"to": "lua-template-binary"
|
||||
},
|
||||
{
|
||||
"from": "tools/framework-compile/bin-templates/js-template-runtime",
|
||||
"to": "js-template-binary"
|
||||
}
|
||||
],
|
||||
"modify_config": [
|
||||
|
|
Loading…
Reference in New Issue