def copy_resources(app_android_root):
# remove app_android_root/assets if it exists
assets_dir = os.path.join(app_android_root, "assets")
if os.path.isdir(assets_dir):
shutil.rmtree(assets_dir)
# copy resources
os.mkdir(assets_dir)
resources_dir = os.path.join(app_android_root, "../Resources")
if os.path.isdir(resources_dir):
copy_files(resources_dir, assets_dir)
--------copy cocos_lib_path start
def copy_src_files(src, dst):
for item in os.listdir(src):
path = os.path.join(src, item)
if not item.startswith('.') and os.path.isfile(path):
shutil.copy(path, dst)
if os.path.isdir(path):
new_dst = os.path.join(dst, item)
if not os.path.exists(new_dst):
os.mkdir(new_dst)
copy_src_files(path, new_dst)
def copy_src(app_android_root,cocos_root):
android_src_dir = os.path.join(app_android_root,"src")
cocos_src_path = os.path.join(cocos_root, "cocos/2d/platform/android/java/src")
if not os.path.exists(android_src_dir) :
os.mkdir(android_src_dir)
if os.path.isdir(cocos_src_path):
copy_src_files(cocos_src_path,android_src_dir)
if android_platform is not None:
sdk_root = check_environment_variables_sdk()
if android_platform.isdigit():
android_platform = 'android-'+android_platform
else:
print 'please use vaild android platform'
exit(1)
if build_mode is None:
build_mode = 'debug'
elif build_mode != 'release':
build_mode = 'debug'