mirror of
https://github.com/u0u0/Cocos2d-Lua-Community.git
synced 2026-06-07 23:07:39 +08:00
sync脚本改为python3实现,简化cmake逻辑。
This commit is contained in:
@@ -1,73 +1,21 @@
|
||||
include(CMakeParseArguments)
|
||||
|
||||
# copy resource `FILES` and `FOLDERS` to TARGET_FILE_DIR/Resources
|
||||
function(cocos_copy_target_res cocos_target)
|
||||
set(oneValueArgs LINK_TO)
|
||||
set(multiValueArgs FOLDERS)
|
||||
cmake_parse_arguments(opt "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT TARGET SYNC_RESOURCE-${cocos_target})
|
||||
message(WARNING "SyncResource targe for ${cocos_target} is not defined")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# linking folders
|
||||
foreach(cc_folder ${opt_FOLDERS})
|
||||
#get_filename_component(link_folder ${opt_LINK_TO} DIRECTORY)
|
||||
get_filename_component(link_folder_abs ${opt_LINK_TO} ABSOLUTE)
|
||||
add_custom_command(TARGET SYNC_RESOURCE-${cocos_target} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E echo " copying to ${link_folder_abs}"
|
||||
COMMAND ${PYTHON_COMMAND} ARGS ${COCOS2DX_ROOT_PATH}/cmake/scripts/sync_folder.py
|
||||
-s ${cc_folder} -d ${link_folder_abs}
|
||||
)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
## create a virtual target SYNC_RESOURCE-${cocos_target}
|
||||
## Update resource files in Resources/ folder everytime when `Run/Debug` target.
|
||||
function(cocos_def_copy_resource_target cocos_target)
|
||||
add_custom_target(SYNC_RESOURCE-${cocos_target} ALL
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Copying resources for ${cocos_target} ..."
|
||||
)
|
||||
add_dependencies(${cocos_target} SYNC_RESOURCE-${cocos_target})
|
||||
set_target_properties(SYNC_RESOURCE-${cocos_target} PROPERTIES
|
||||
FOLDER Utils
|
||||
)
|
||||
endfunction()
|
||||
|
||||
|
||||
function(cocos_copy_lua_scripts cocos_target src_dir dst_dir)
|
||||
set(luacompile_target COPY_LUA-${cocos_target})
|
||||
function(cocos_sync_folder cocos_target src_dir dst_dir)
|
||||
set(luacompile_target COPY_RESOURCE-${cocos_target})
|
||||
if(NOT TARGET ${luacompile_target})
|
||||
add_custom_target(${luacompile_target} ALL
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Copying lua scripts ..."
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Copying resource ..."
|
||||
)
|
||||
add_dependencies(${cocos_target} ${luacompile_target})
|
||||
set_target_properties(${luacompile_target} PROPERTIES
|
||||
FOLDER Utils
|
||||
)
|
||||
endif()
|
||||
if(MSVC)
|
||||
add_custom_command(TARGET ${luacompile_target} POST_BUILD
|
||||
COMMAND ${PYTHON_COMMAND} ARGS ${COCOS2DX_ROOT_PATH}/cmake/scripts/sync_folder.py
|
||||
-s ${src_dir} -d ${dst_dir}
|
||||
)
|
||||
else()
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
add_custom_command(TARGET ${luacompile_target} POST_BUILD
|
||||
COMMAND ${PYTHON_COMMAND} ARGS ${COCOS2DX_ROOT_PATH}/cmake/scripts/sync_folder.py
|
||||
-s ${src_dir} -d ${dst_dir}
|
||||
)
|
||||
else()
|
||||
add_custom_command(TARGET ${luacompile_target} POST_BUILD
|
||||
COMMAND ${PYTHON_COMMAND} ARGS ${COCOS2DX_ROOT_PATH}/cmake/scripts/sync_folder.py
|
||||
-s ${src_dir} -d ${dst_dir} -l ${LUAJIT32_COMMAND} -m ${CMAKE_BUILD_TYPE}
|
||||
COMMAND ${PYTHON_COMMAND} ARGS ${COCOS2DX_ROOT_PATH}/cmake/scripts/sync_folder.py
|
||||
-s ${src_dir} -d ${dst_dir}/64bit -l ${LUAJIT64_COMMAND} -m ${CMAKE_BUILD_TYPE}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_custom_command(TARGET ${luacompile_target} POST_BUILD
|
||||
COMMAND ${Python3_EXECUTABLE} ARGS ${COCOS2DX_ROOT_PATH}/cmake/scripts/sync_folder.py
|
||||
-s ${src_dir} -d ${dst_dir}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
|
||||
@@ -250,11 +198,6 @@ function(setup_cocos_app_config app_name)
|
||||
if (XCODE)
|
||||
cocos_config_app_xcode_property(${app_name})
|
||||
endif()
|
||||
|
||||
if(LINUX OR WINDOWS)
|
||||
cocos_def_copy_resource_target(${app_name})
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
# if cc_variable not set, then set it cc_value
|
||||
|
||||
@@ -14,9 +14,8 @@ if(CMAKE_TOOLCHAIN_FILE)
|
||||
message(STATUS "using toolchain file:" ${CMAKE_TOOLCHAIN_FILE})
|
||||
endif()
|
||||
|
||||
find_program(PYTHON_COMMAND NAMES python2 python)
|
||||
find_program(COCOS_COMMAND NAME cocos
|
||||
PATHS ${COCOS2DX_ROOT_PATH}/tools/cocos2d-console/bin $ENV{COCOS_CONSOLE_ROOT})
|
||||
find_package(Python3)
|
||||
message(STATUS "Python3_Found:" ${Python3_FOUND})
|
||||
|
||||
message(STATUS "PROJECT_NAME:" ${PROJECT_NAME})
|
||||
message(STATUS "PROJECT_SOURCE_DIR:" ${PROJECT_SOURCE_DIR})
|
||||
@@ -25,8 +24,7 @@ message(STATUS "CMAKE_MODULE_PATH:" ${CMAKE_MODULE_PATH})
|
||||
# delete binary dir if you hope a full clean re-build
|
||||
message(STATUS "PROJECT_BINARY_DIR:" ${PROJECT_BINARY_DIR})
|
||||
message(STATUS "ENGINE_BINARY_PATH:" ${ENGINE_BINARY_PATH})
|
||||
message(STATUS "PYTHON_PATH:" ${PYTHON_COMMAND})
|
||||
message(STATUS "COCOS_COMMAND_PATH:" ${COCOS_COMMAND})
|
||||
message(STATUS "Python3_EXECUTABLE:" ${Python3_EXECUTABLE})
|
||||
message(STATUS "HOST_SYSTEM:" ${CMAKE_HOST_SYSTEM_NAME})
|
||||
# the default behavior of build module
|
||||
option(BUILD_LUA_LIBS "Build lua libraries" OFF)
|
||||
@@ -41,22 +39,3 @@ include(CocosConfigDefine)
|
||||
|
||||
# config libraries dependence
|
||||
include(CocosConfigDepend)
|
||||
|
||||
if(COCOS_COMMAND)
|
||||
get_filename_component(cocos2dx_console_dir ${COCOS_COMMAND} DIRECTORY)
|
||||
set(COCOS2DX_LUAJIT_ROOT ${cocos2dx_console_dir}/../plugins/plugin_luacompile/bin)
|
||||
message(STATUS "COCOS2DX_LUAJIT_ROOT:" ${COCOS2DX_LUAJIT_ROOT})
|
||||
if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
|
||||
find_program(LUAJIT32_COMMAND NAMES luajit-win32 PATHS ${COCOS2DX_LUAJIT_ROOT}/32bit NO_SYSTEM_ENVIRONMENT_PATH)
|
||||
find_program(LUAJIT64_COMMAND NAMES luajit-win32 PATHS ${COCOS2DX_LUAJIT_ROOT}/64bit NO_SYSTEM_ENVIRONMENT_PATH)
|
||||
elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
find_program(LUAJIT32_COMMAND NAMES luajit-linux PATHS ${COCOS2DX_LUAJIT_ROOT}/32bit NO_SYSTEM_ENVIRONMENT_PATH)
|
||||
find_program(LUAJIT64_COMMAND NAMES luajit-linux PATHS ${COCOS2DX_LUAJIT_ROOT}/64bit NO_SYSTEM_ENVIRONMENT_PATH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if(WINDOWS OR LINUX)
|
||||
message(STATUS "LUAJIT32_COMMAND:" ${LUAJIT32_COMMAND})
|
||||
message(STATUS "LUAJIT64_COMMAND:" ${LUAJIT64_COMMAND})
|
||||
endif()
|
||||
|
||||
157
cmake/scripts/sync_folder.py
Normal file → Executable file
157
cmake/scripts/sync_folder.py
Normal file → Executable file
@@ -1,104 +1,79 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: UTF-8 -*-
|
||||
"""
|
||||
NAME
|
||||
sync_folder --
|
||||
|
||||
SYNOPSIS
|
||||
sync_folder [-h]
|
||||
|
||||
-h show help
|
||||
-s src path
|
||||
-d dest path
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import sys
|
||||
import getopt
|
||||
import shutil
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
copy_files = []
|
||||
update_files = 0
|
||||
create_files = 0
|
||||
def joinDir(root, *dirs):
|
||||
for item in dirs:
|
||||
root = os.path.join(root, item)
|
||||
return root
|
||||
|
||||
def copy_if_newer(src, dst):
|
||||
global update_files
|
||||
global create_files
|
||||
if not os.path.exists(dst):
|
||||
shutil.copy(src, dst)
|
||||
copy_files.append("Create " + dst)
|
||||
create_files = create_files + 1
|
||||
else:
|
||||
stat_src = os.stat(src)
|
||||
stat_dst = os.stat(dst)
|
||||
if stat_src.st_mtime > stat_dst.st_mtime:
|
||||
shutil.copy(src, dst)
|
||||
copy_files.append("Update " + dst)
|
||||
update_files = update_files + 1
|
||||
def copyFile(src, dest):
|
||||
inFp = open(src, 'rb')
|
||||
outFp = open(dest, 'wb')
|
||||
buff = inFp.read()
|
||||
outFp.write(buff)
|
||||
inFp.close()
|
||||
outFp.close()
|
||||
|
||||
def compile_lua(src, dst, luajit_command):
|
||||
command = "%s -b \"%s\" \"%s\"" % (luajit_command, src, dst)
|
||||
print(" Compiling %s " % src)
|
||||
ret = subprocess.call(command, shell=True, cwd = os.path.dirname(luajit_command))
|
||||
if ret != 0 :
|
||||
print("[error]: %s : failed to compile lua script %s" % (__file__, src))
|
||||
def copyDir(src, dest):
|
||||
for item in os.listdir(src):
|
||||
if "." == item[0]: # ignore hidden files
|
||||
continue
|
||||
|
||||
def compile_if_newer(src, dst, cmd):
|
||||
global update_files
|
||||
global create_files
|
||||
if src.split(".")[-1] != "lua" :
|
||||
return
|
||||
dst = dst.strip() + "c"
|
||||
if not os.path.exists(dst):
|
||||
compile_lua(src, dst, cmd)
|
||||
copy_files.append("Create " + dst)
|
||||
create_files = create_files + 1
|
||||
else:
|
||||
stat_src = os.stat(src)
|
||||
stat_dst = os.stat(dst)
|
||||
if stat_src.st_mtime > stat_dst.st_mtime:
|
||||
compile_lua(src, dst, cmd)
|
||||
copy_files.append("Update " + dst)
|
||||
update_files = update_files + 1
|
||||
|
||||
## copy folder if different
|
||||
def sync_folder(src_dir, dst_dir, luajit, compile):
|
||||
if os.path.isfile(src_dir):
|
||||
if not os.path.exists(os.path.dirname(dst_dir)):
|
||||
os.makedirs(os.path.dirname(dst_dir))
|
||||
if luajit and need_compile:
|
||||
compile_if_newer(src_dir, dst_dir, luajit)
|
||||
nSrc = joinDir(src, item)
|
||||
nDest = joinDir(dest, item)
|
||||
if os.path.isfile(nSrc):
|
||||
copyFile(nSrc, nDest)
|
||||
else:
|
||||
copy_if_newer(src_dir, dst_dir)
|
||||
|
||||
elif os.path.isdir(src_dir):
|
||||
names = os.listdir(src_dir)
|
||||
for name in names:
|
||||
src = os.path.join(src_dir, name)
|
||||
dst = os.path.join(dst_dir, name)
|
||||
sync_folder(src, dst, luajit, need_compile)
|
||||
else:
|
||||
print("[warning] %s: src file %s is bad" % (__file__, src_dir))
|
||||
if not os.path.exists(nDest):
|
||||
os.mkdir(nDest)
|
||||
copyDir(nSrc, nDest)
|
||||
|
||||
if __name__ == "__main__":
|
||||
from argparse import ArgumentParser
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument("-s", dest="src_dir")
|
||||
parser.add_argument("-d", dest="dst_dir")
|
||||
parser.add_argument("-l", dest="luajit", default= None)
|
||||
parser.add_argument("-m", dest="mode", default=None)
|
||||
(args, unkonw) = parser.parse_known_args(sys.argv)
|
||||
# ===== parse args =====
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "hs:d:")
|
||||
except getopt.GetoptError:
|
||||
# print help information and exit:
|
||||
print(__doc__)
|
||||
sys.exit(-2)
|
||||
|
||||
need_compile = True
|
||||
# if args.luajit:
|
||||
# print(" luajit mode '%s'" % (args.mode))
|
||||
srcDir = ""
|
||||
destDir = ""
|
||||
for o, a in opts:
|
||||
if o == "-h":
|
||||
# print help information and exit:
|
||||
print(__doc__)
|
||||
sys.exit(0)
|
||||
if o == "-s":
|
||||
srcDir = a
|
||||
if o == "-d":
|
||||
destDir = a
|
||||
|
||||
if args.mode == "Debug" and args.luajit:
|
||||
need_compile = False
|
||||
print(" -Skip luacompile in debug mode!")
|
||||
|
||||
|
||||
create_files = 0
|
||||
update_files = 0
|
||||
start_at = time.time()
|
||||
sync_folder(args.src_dir, args.dst_dir, args.luajit, need_compile)
|
||||
end_at = time.time()
|
||||
|
||||
if len(copy_files) > 0:
|
||||
# reduce logs
|
||||
last_files = copy_files[-3:]
|
||||
for x in last_files:
|
||||
print(" %s" % x)
|
||||
if len(copy_files) > len(last_files) :
|
||||
print(" ...")
|
||||
print(" %d items updated, %d items created " % (update_files, create_files))
|
||||
print(" takes %s seconds"% (end_at - start_at))
|
||||
if len(srcDir) == 0:
|
||||
print("Error: use -s xxx to set src path")
|
||||
sys.exit(-2)
|
||||
if len(destDir) == 0:
|
||||
print("Error: use -d xxx to set dest path")
|
||||
sys.exit(-2)
|
||||
|
||||
# start sync
|
||||
if os.path.exists(destDir):
|
||||
shutil.rmtree(destDir)
|
||||
os.makedirs(destDir)
|
||||
copyDir(srcDir, destDir)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# ****************************************************************************/
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
set(APP_NAME __PROJECT_COCOS_NAME__)
|
||||
|
||||
@@ -147,6 +147,6 @@ endif()
|
||||
# copy resource on linux or WINDOWS
|
||||
if(LINUX OR WINDOWS)
|
||||
cocos_get_resource_path(APP_RES_DIR ${APP_NAME})
|
||||
cocos_copy_target_res(${APP_NAME} LINK_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders})
|
||||
cocos_copy_lua_scripts(${APP_NAME} ${res_src_folders} ${APP_RES_DIR}/src )
|
||||
cocos_sync_folder(${APP_NAME} ${res_res_folders} ${APP_RES_DIR}/res)
|
||||
cocos_sync_folder(${APP_NAME} ${res_src_folders} ${APP_RES_DIR}/src)
|
||||
endif()
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
{
|
||||
"init_cfg":{
|
||||
"isLandscape": __SCREEN_ISLANDSCAPE__,
|
||||
"isWindowTop": false,
|
||||
"name": "__PROJECT_COCOS_NAME__",
|
||||
"width": 960,
|
||||
"height": 640,
|
||||
"entry": "src/main.lua",
|
||||
"consolePort": 6050,
|
||||
"uploadPort": 6060
|
||||
},
|
||||
"simulator_screen_size": [
|
||||
{
|
||||
"title": "iPhone 3Gs (480x320)",
|
||||
"width": 480,
|
||||
"height": 320
|
||||
},
|
||||
{
|
||||
"title": "iPhone 4 (960x640)",
|
||||
"width": 960,
|
||||
"height": 640
|
||||
},
|
||||
{
|
||||
"title": "iPhone 5 (1136x640)",
|
||||
"width": 1136,
|
||||
"height": 640
|
||||
},
|
||||
{
|
||||
"title": "iPad (1024x768)",
|
||||
"width": 1024,
|
||||
"height": 768
|
||||
},
|
||||
{
|
||||
"title": "iPad Retina (2048x1536)",
|
||||
"width": 2048,
|
||||
"height": 1536
|
||||
},
|
||||
{
|
||||
"title": "Android (800x480)",
|
||||
"width": 800,
|
||||
"height": 480
|
||||
},
|
||||
{
|
||||
"title": "Android (854x480)",
|
||||
"width": 854,
|
||||
"height": 480
|
||||
},
|
||||
{
|
||||
"title": "Android (1280x720)",
|
||||
"width": 1280,
|
||||
"height": 720
|
||||
},
|
||||
{
|
||||
"title": "Android (1920x1080)",
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
import org.gradle.internal.os.OperatingSystem;
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
@@ -40,7 +38,6 @@ android {
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
|
||||
release {
|
||||
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
||||
storeFile file(RELEASE_STORE_FILE)
|
||||
@@ -72,64 +69,6 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
def getCocosCommandPath() {
|
||||
if (OperatingSystem.current().isWindows()) {
|
||||
return 'cocos.bat'
|
||||
}
|
||||
else {
|
||||
|
||||
def env_console_path = System.getenv("COCOS_CONSOLE_ROOT")
|
||||
|
||||
if (env_console_path != null && !env_console_path.trim().isEmpty()) {
|
||||
return new File(env_console_path.trim() + '/cocos').absolutePath
|
||||
}
|
||||
|
||||
// on unix like system, can not get environments variables easily
|
||||
// so run a shell script to get environment variable sets by cocos2d-x setup.py
|
||||
new ByteArrayOutputStream().withStream { os ->
|
||||
def result = exec {
|
||||
executable = "/bin/bash"
|
||||
args = [ "-i", project.file('get_environment.sh')]
|
||||
standardOutput = os
|
||||
}
|
||||
ext.console_path = os.toString().trim()
|
||||
}
|
||||
return new File(console_path + '/cocos').absolutePath;
|
||||
}
|
||||
}
|
||||
|
||||
// a method used to invoke the cocos luacompile command
|
||||
def compileLua(srcDir, dstDir, doCompile, is64bit, doEncrypt) {
|
||||
def compileArgs = ['luacompile', '-s', srcDir, '-d', dstDir]
|
||||
if (!doCompile) {
|
||||
compileArgs << '--disable-compile'
|
||||
}
|
||||
else if (is64bit) {
|
||||
compileArgs << '--bytecode-64bit'
|
||||
}
|
||||
|
||||
if (doEncrypt) {
|
||||
compileArgs << '-e'
|
||||
compileArgs << '-k'
|
||||
compileArgs << project.property('PROP_LUA_ENCRYPT_KEY')
|
||||
compileArgs << '-b'
|
||||
compileArgs << project.property('PROP_LUA_ENCRYPT_SIGN')
|
||||
}
|
||||
|
||||
// commandLine compileArgs
|
||||
println 'running command : ' + 'cocos ' + compileArgs.join(' ')
|
||||
exec {
|
||||
// if you meet problem, just replace `getCocosCommandPath()` to the path of cocos command
|
||||
executable getCocosCommandPath()
|
||||
args compileArgs
|
||||
}
|
||||
|
||||
// remove the lua files in dstDir
|
||||
delete fileTree(dstDir) {
|
||||
include '**/*.lua'
|
||||
}
|
||||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
def project_root_folder = "${projectDir}/../../../.."
|
||||
def dest_assets_folder = "${projectDir}/assets"
|
||||
@@ -146,87 +85,13 @@ android.applicationVariants.all { variant ->
|
||||
into dest_assets_folder + "/res"
|
||||
}
|
||||
|
||||
copy {
|
||||
from project_root_folder + "/src"
|
||||
into dest_assets_folder + "/src"
|
||||
def isRelease = (variant.name.compareTo('release') == 0)
|
||||
if (!isRelease) {
|
||||
copy {
|
||||
from project_root_folder + "/src"
|
||||
into dest_assets_folder + "/src"
|
||||
}
|
||||
}
|
||||
|
||||
// copy {
|
||||
// from "${projectDir}/../../../cocos2d-x/cocos/scripting/lua-bindings/script"
|
||||
// into dest_assets_folder + "/src/cocos"
|
||||
// }
|
||||
|
||||
// compile & encrypt the scripts if necessary
|
||||
// def compileScript = (variant.name.compareTo('release') == 0)
|
||||
// if (project.hasProperty('PROP_COMPILE_SCRIPT')) {
|
||||
// compileScript = (PROP_COMPILE_SCRIPT.compareTo('1') == 0)
|
||||
// }
|
||||
|
||||
// def encryptLua = project.hasProperty('PROP_LUA_ENCRYPT') && (PROP_LUA_ENCRYPT.compareTo('1') == 0)
|
||||
// if (compileScript || encryptLua) {
|
||||
// // -1 means not build bytecode
|
||||
// // 0 means build 32bit only
|
||||
// // 1 means build 64bit only
|
||||
// // 2 means build both 32bit & 64bit
|
||||
// def buildType = -1
|
||||
// if (compileScript) {
|
||||
// def need64 = false
|
||||
// def need32 = false
|
||||
// def abis = PROP_APP_ABI.split(':').collect{it as String}
|
||||
// abis.each{ abi->
|
||||
// if (abi.compareTo('arm64-v8a') == 0) {
|
||||
// need64 = true
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// need32 = true
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (need64 && need32) {
|
||||
// buildType = 2
|
||||
// }
|
||||
// else if (need64) {
|
||||
// buildType = 1
|
||||
// }
|
||||
// else {
|
||||
// buildType = 0
|
||||
// }
|
||||
// }
|
||||
|
||||
// // invoke cocos command to compile & encrypt the lua files
|
||||
// switch (buildType) {
|
||||
// case -1:
|
||||
// compileLua(dest_assets_folder + "/src",
|
||||
// dest_assets_folder + "/src",
|
||||
// false, false, encryptLua)
|
||||
// break
|
||||
// case 0:
|
||||
// compileLua(dest_assets_folder + "/src",
|
||||
// dest_assets_folder + "/src",
|
||||
// true, false, encryptLua)
|
||||
// break
|
||||
// case 1:
|
||||
// compileLua(dest_assets_folder + "/src",
|
||||
// dest_assets_folder + "/src/64bit",
|
||||
// true, true, encryptLua)
|
||||
|
||||
// // remove the lua files in src dir
|
||||
// delete fileTree(dest_assets_folder + "/src") {
|
||||
// include '**/*.lua'
|
||||
// }
|
||||
// delete dest_assets_folder + "/src/cocos"
|
||||
// break
|
||||
// case 2:
|
||||
// compileLua(dest_assets_folder + "/src",
|
||||
// dest_assets_folder + "/src/64bit",
|
||||
// true, true, encryptLua)
|
||||
// compileLua(dest_assets_folder + "/src",
|
||||
// dest_assets_folder + "/src",
|
||||
// true, false, encryptLua)
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
}
|
||||
tasks.getByName("pre${targetName}Build").dependsOn copyTaskName
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user