env.build_file_name="_.apk" pipeline { environment { unity_app="C:/Application/Unity2019.4.26f1c1/Editor/Unity.exe" sharePath="${WORKSPACE}/pandora_share_proj" pandora_cli_proj = "${WORKSPACE}/pandora_cli_proj" pandora_pro_dir= "${pandora_cli_proj}/pandora" build_graph="Assets/ZXToolkit/AssetGraph/Graph/BuildGraph.asset" log_dir="${WORKSPACE}/log/android" build_name="pandora_${publishChannel}_${version}_date" outpath="D:/DockerContainer/nginx/www" disableLog="false" lang="en" gameIP="111.231.250.180" maintenanceIP="111.231.250.180" } agent { node { label 'a3_win_1' customWorkspace 'D:/client_workspace/pandora' } } stages { stage('InitPyEnv') { steps{ bat label: '', script:''' java -version python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple psutil python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests python -m pip install -i https://pypi.douban.com/simple xlrd==1.2.0 ''' } } stage('更新cli和share代码') { steps { bat label: '', script:''' python D:/client_workspace/pandora/svn_update.py ''' } } stage('编译ExcelExcelExpor') { steps { bat label: '', script:''' echo %sharePath% cd %sharePath%/ExcelExport python ./excelTolua.py python ./ExportLanguageToText.py ''' } } stage('编译proto') { steps { bat label: '', script:''' cd %sharePath%/protocol python ./export_lua.py ''' } } stage('Set Env Value') { steps { script{ // 设置默认渠道 env.publishChannel = "${publishChannel}" ?: "google_oversea" if ("${useJapanConfig}" == "true") { env.publishChannel = "google_japan" } if ("${useSoutheastAsiaConfig}" == "true") { env.publishChannel = "google_southeast" } // 判断构建图配置 if ("${isUsingNewAB}" == "true") { build_graph = "Assets/ZXToolkit/AssetGraph/Graph/BuildGraph_new.asset" } // 构建名称 buid_name = "pandora_${publishChannel}_${version}_${new Date().format('yyyyMMddHHmmss')}" echo "$buid_name" if ("${development}" == "true") { buid_name = "${buid_name}_development" } echo "$buid_name" // 输出文件名 env.build_file_name = "${buid_name}.apk" if ("${mode}" == "aab") { env.build_file_name = "${buid_name}.aab" } } } } stage('Build') { steps { bat label: '', script:''' cd /D %pandora_cli_proj% python %pandora_cli_proj%/../pandora_share_proj/MacBuild/build_generate_common.py debug=%debug% version=%version% disableLog=%disableLog% versionIP="%versionIP%" mode=%mode% publishChannel=%publishChannel% gameIP=%gameIP% maintenanceIP=%maintenanceIP% lang=%lang% if "%useJapanConfig%"=="true" ( echo "use japan config" python %pandora_cli_proj%/../pandora_share_proj/MacBuild/build_copy_config.py JP ) if "%useSoutheastAsiaConfig%"=="true" ( echo "use SoutheastAsia config" python %pandora_cli_proj%/../pandora_share_proj/MacBuild/build_copy_config.py SEA ) python C:/Users/A/Desktop/build/build/parallel_builds.py %target% \ "C:/Application/Unity2019.4.26f1c1/Editor/Unity.exe" \ %pandora_cli_proj% \ "C:/Program Files/Java/jdk-11/bin/java.exe" \ "C:/Application/Unity2019.4.26f1c1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-6.1.1.jar" \ %outpath% \ %build_file_name% \ %debug% %version% %disableLog% %versionIP% %mode% %publishChannel% %gameIP% %maintenanceIP% %lang% \ %isUsingUWATools% %useJapanConfig% %useSoutheastAsiaConfig% %useCustomPackagename% %isUsingUWAPoco% if not exist %outpath%/%build_file_name% ( echo "apk or aab not exist" exit /b 1 ) ''' } } } post { success { wrap([$class: 'BuildUser']) { script { buildUser = "${BUILD_USER}" } } buildName "#${BUILD_NUMBER} ---> ${version}" buildDescription "点击下载: pandora_${version}" //sh label: '', script: """sh ${u2china_share_proj}/JenkinsFile/feishu_buildPackage.sh ${buildUser} ${appVersion} SUCCESS ${JOB_NAME} apk""" } failure { wrap([$class: 'BuildUser']) { script { buildUser = "${BUILD_USER}" echo "FAILURE" } } //sh label: '', script: """sh ${u2china_share_proj}/JenkinsFile/feishu_buildPackage.sh ${buildUser} ${appVersion} FAILURE ${JOB_NAME} apk""" } } }