You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.5 KiB

1 month ago
# 引入模块
import subprocess
import sys
def log(*str):
print(*str, flush=True)
UNITY_EDITOR = '"C:\\Program Files\\Unity 2022.3.14f1\\Editor\\Unity.exe"'
if __name__ == '__main__':
UNITY_EDITOR = sys.argv[1] #unity位置
UNITY_PROJECT_PATH = sys.argv[2] # 项目路径
RELEASE_DEFINE_SYMBOL = sys.argv[3] # 需要定义的宏定义
isDevelopmentBuild = sys.argv[4] # 是否DevelopmentBuild
cdnPath = sys.argv[5] # cdn路径
outputDir = sys.argv[6] # 输出路径
version = sys.argv[7] # 版本
# 设置宏
log("RELEASE_DEFINE_SYMBOL : %s" % RELEASE_DEFINE_SYMBOL)
log(UNITY_EDITOR)
_CHILD = subprocess.Popen(UNITY_EDITOR + " -quit "
+ " -batchmode " + " -projectPath " + UNITY_PROJECT_PATH
+ " -logFile ./RELEASE_DEFINE_SYMBOL.log"
+ " -executeMethod XAsset.Build.PerformBuildWxMiniGame.CommandLineSetDefineSymbol --DEFINE_SYMBOL=" + RELEASE_DEFINE_SYMBOL
, shell=True)
_EXIT_CODE = _CHILD.wait()
if _EXIT_CODE != 0:
exit(_EXIT_CODE)
log("Set RELEASE_DEFINE_SYMBOL OK")
log("isDevelopmentBuild : %s" % isDevelopmentBuild)
_CHILD2 = subprocess.Popen(UNITY_EDITOR + " -quit "
+ " -batchmode "
+ " -profiler-maxusedmemory 32777216"
+ " -logFile ./SetDevelopmentBuild.log"
+ " -projectPath " + UNITY_PROJECT_PATH
+ " -executeMethod XAsset.Build.PerformBuildWxMiniGame.CommandLineSetDevelopmentBuild "
+ " --DEVELOPMENT_BUILD=" + isDevelopmentBuild
+ " --CDN_PATH=" + cdnPath
+ " --OUTPUT_DIR=" + outputDir
+ " --BUILD_VERSION=" + version
, shell=True)
_EXIT_CODE2 = _CHILD2.wait()
if _EXIT_CODE2 != 0:
exit(_EXIT_CODE2)
log("Set DevelopmentBuild OK")
_CHILD3 = subprocess.Popen(UNITY_EDITOR + " -quit "
+ " -batchmode " + " -projectPath " + UNITY_PROJECT_PATH
+ " -logFile ./ExportWxMiniGame.log"
+ " -executeMethod XAsset.Build.PerformBuildWxMiniGame.ExportMiniGame"
, shell=True)
_EXIT_CODE3 = _CHILD3.wait()
if _EXIT_CODE3 != 0:
exit(_EXIT_CODE3)
log("ExportWxMiniGame Ok!")