Solve the error in framework-compile on Mac.

This commit is contained in:
Bin Zhang 2015-06-26 12:01:45 +08:00
parent d508d2ecdd
commit cc6f02584b
3 changed files with 40 additions and 14 deletions

View File

@ -117,6 +117,14 @@ class CocosBinTemplateGenerator(object):
self.modify_android_build_cfg(lua_build_cfg, "lua") self.modify_android_build_cfg(lua_build_cfg, "lua")
self.modify_android_build_cfg(js_build_cfg, "js") 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, "lua-template-binary/.settings/version.json"))
self.modify_version_json(os.path.join(dst_dir, "js-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) json.dump(cfg_info, f, sort_keys=True, indent=4)
f.close() 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): def modify_android_build_cfg(self, cfg_path, language):
f = open(cfg_path) f = open(cfg_path)
content = f.read() content = f.read()
@ -190,7 +214,9 @@ class CocosBinTemplateGenerator(object):
replace_str = "../../cocos2d-x" replace_str = "../../cocos2d-x"
if replace_str is not None: 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 = open(cfg_path, "w")
f.write(content) f.write(content)

View File

@ -87,8 +87,8 @@ class CocosLibsCompiler(object):
if self.build_mac: if self.build_mac:
self.compile_mac_ios() self.compile_mac_ios()
if self.build_android: if self.build_android:
self.compile_android("lua")
self.compile_android("js") self.compile_android("js")
self.compile_android("lua")
def build_win32_proj(self, cmd_path, sln_path, proj_name, mode): def build_win32_proj(self, cmd_path, sln_path, proj_name, mode):

View File

@ -64,6 +64,13 @@
"RuntimeJsImpl.*" "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", "from": "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios",
"to": "lua-template-binary/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", "from": "cocos/platform/android/java/src",
"to": "cpp-template-binary/proj.android/src", "to": "cpp-template-binary/proj.android/src"
"include": [
"*.java"
]
}, },
{ {
"from": "cocos/platform/android/java/src", "from": "cocos/platform/android/java/src",
"to": "lua-template-binary/frameworks/runtime-src/proj.android/src", "to": "lua-template-binary/frameworks/runtime-src/proj.android/src"
"include": [
"*.java"
]
}, },
{ {
"from": "cocos/platform/android/java/src", "from": "cocos/platform/android/java/src",
"to": "js-template-binary/frameworks/runtime-src/proj.android/src", "to": "js-template-binary/frameworks/runtime-src/proj.android/src"
"include": [
"*.java"
]
} }
], ],
"modify_config": [ "modify_config": [
@ -174,6 +172,8 @@
"cocos/scripting/js-bindings/proj.android/Android.mk", "cocos/scripting/js-bindings/proj.android/Android.mk",
"cocos/scripting/lua-bindings/proj.android/Android.mk", "cocos/scripting/lua-bindings/proj.android/Android.mk",
"cocos/storage/local-storage/Android.mk", "cocos/storage/local-storage/Android.mk",
"external/bullet/Android.mk",
"external/recast/Android.mk",
"external/flatbuffers/Android.mk", "external/flatbuffers/Android.mk",
"external/Box2D/Android.mk", "external/Box2D/Android.mk",
"cocos/editor-support/cocosbuilder/Android.mk", "cocos/editor-support/cocosbuilder/Android.mk",