From cc6f02584bb4065d1a2000f6008140830835772a Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Fri, 26 Jun 2015 12:01:45 +0800 Subject: [PATCH] Solve the error in framework-compile on Mac. --- .../bin/gen_cocos_binary_template.py | 28 ++++++++++++++++++- tools/framework-compile/bin/gen_cocos_libs.py | 2 +- .../bin/template_binary_config.json | 24 ++++++++-------- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/tools/framework-compile/bin/gen_cocos_binary_template.py b/tools/framework-compile/bin/gen_cocos_binary_template.py index 98b25db956..0365807619 100755 --- a/tools/framework-compile/bin/gen_cocos_binary_template.py +++ b/tools/framework-compile/bin/gen_cocos_binary_template.py @@ -117,6 +117,14 @@ class CocosBinTemplateGenerator(object): self.modify_android_build_cfg(lua_build_cfg, "lua") self.modify_android_build_cfg(js_build_cfg, "js") + # modify the project.properties for templates + cpp_prop_file = os.path.join(dst_dir, "cpp-template-binary/proj.android/project.properties") + lua_prop_file = os.path.join(dst_dir, "lua-template-binary/frameworks/runtime-src/proj.android/project.properties") + js_prop_file = os.path.join(dst_dir, "js-template-binary/frameworks/runtime-src/proj.android/project.properties") + self.modify_project_properties(cpp_prop_file) + self.modify_project_properties(lua_prop_file) + self.modify_project_properties(js_prop_file) + self.modify_version_json(os.path.join(dst_dir, "lua-template-binary/.settings/version.json")) self.modify_version_json(os.path.join(dst_dir, "js-template-binary/.settings/version.json")) @@ -177,6 +185,22 @@ class CocosBinTemplateGenerator(object): json.dump(cfg_info, f, sort_keys=True, indent=4) f.close() + def modify_project_properties(self, cfg_path): + f = open(cfg_path) + lines = f.readlines() + f.close() + + new_lines = [] + pattern = r'android\.library\.reference.*' + for line in lines: + temp_str = line.strip() + if not re.match(pattern, temp_str): + new_lines.append(line) + + f = open(cfg_path, 'w') + f.writelines(new_lines) + f.close() + def modify_android_build_cfg(self, cfg_path, language): f = open(cfg_path) content = f.read() @@ -190,7 +214,9 @@ class CocosBinTemplateGenerator(object): replace_str = "../../cocos2d-x" if replace_str is not None: - content = content.replace(replace_str, self.repo_x) + framework_version = self.version.strip() + framework_version = framework_version.replace(' ', '-') + content = content.replace(replace_str, "${COCOS_FRAMEWORKS}/%s" % framework_version) f = open(cfg_path, "w") f.write(content) diff --git a/tools/framework-compile/bin/gen_cocos_libs.py b/tools/framework-compile/bin/gen_cocos_libs.py index 58727112ae..04b03a8ca0 100755 --- a/tools/framework-compile/bin/gen_cocos_libs.py +++ b/tools/framework-compile/bin/gen_cocos_libs.py @@ -87,8 +87,8 @@ class CocosLibsCompiler(object): if self.build_mac: self.compile_mac_ios() if self.build_android: - self.compile_android("lua") self.compile_android("js") + self.compile_android("lua") def build_win32_proj(self, cmd_path, sln_path, proj_name, mode): diff --git a/tools/framework-compile/bin/template_binary_config.json b/tools/framework-compile/bin/template_binary_config.json index 98927b14d5..2f7a2a988d 100755 --- a/tools/framework-compile/bin/template_binary_config.json +++ b/tools/framework-compile/bin/template_binary_config.json @@ -64,6 +64,13 @@ "RuntimeJsImpl.*" ] }, + { + "from": "tools/simulator/frameworks/runtime-src/Classes", + "to": "lua-template-binary/frameworks/runtime-src/Classes", + "include": [ + "lua_module_register.h" + ] + }, { "from": "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios", "to": "lua-template-binary/frameworks/runtime-src/proj.ios_mac/ios", @@ -136,24 +143,15 @@ }, { "from": "cocos/platform/android/java/src", - "to": "cpp-template-binary/proj.android/src", - "include": [ - "*.java" - ] + "to": "cpp-template-binary/proj.android/src" }, { "from": "cocos/platform/android/java/src", - "to": "lua-template-binary/frameworks/runtime-src/proj.android/src", - "include": [ - "*.java" - ] + "to": "lua-template-binary/frameworks/runtime-src/proj.android/src" }, { "from": "cocos/platform/android/java/src", - "to": "js-template-binary/frameworks/runtime-src/proj.android/src", - "include": [ - "*.java" - ] + "to": "js-template-binary/frameworks/runtime-src/proj.android/src" } ], "modify_config": [ @@ -174,6 +172,8 @@ "cocos/scripting/js-bindings/proj.android/Android.mk", "cocos/scripting/lua-bindings/proj.android/Android.mk", "cocos/storage/local-storage/Android.mk", + "external/bullet/Android.mk", + "external/recast/Android.mk", "external/flatbuffers/Android.mk", "external/Box2D/Android.mk", "cocos/editor-support/cocosbuilder/Android.mk",