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.
 
 
 
 
 
 

288 lines
11 KiB

env.build_file_name="_.apk"
env.publishChannel=""
env.outpath="D:/DockerContainer/nginx/www"
env.subpath=""
env.buildUser=""
pipeline
{
environment
{
unity_app="C:/Application/Unity2019.4.40f1/Editor/Unity.exe"
sharePath="${WORKSPACE}/pandora_share_proj"
pandora_cli_proj = "${WORKSPACE}/pandora_cli_proj"
pandora_pro_dir= "${pandora_cli_proj}/pandora"
log_dir="${WORKSPACE}/log/android"
build_name="pandora_${publishChannel}_${version}_date"
disableLog="${disableLog}"
lang="en"
gameIP="111.231.250.180"
maintenanceIP="111.231.250.180"
SVN_Credentials=credentials('PANDORA_SVN_TOKEN')
feshu_url="8d1b6a92-fd8c-4c58-9e81-b2912ee1a641"
}
agent {
node {
label 'a3_win_1'
}
}
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:'''
cd /D %WORKSPACE%
python ./build_ci/u2c/CheckoutShare.py %Branch% share D:/soft/Apache-Subversion-1.10.3/bin/svn.exe false %SVN_Credentials_USR% %SVN_Credentials_PSW%
python ./build_ci/u2c/CheckoutShare.py %Branch% client D:/soft/Apache-Subversion-1.10.3/bin/svn.exe false %SVN_Credentials_USR% %SVN_Credentials_PSW%
python ./build_ci/u2c/CleanSVNUnversioned.py
'''
}
}
stage('pre process')
{
steps
{
bat label: '',
script:'''
cd /D %WORKSPACE%
python ./build_ci/cache_files.py %WORKSPACE% pandora_cli_proj/pandora/ProjectSettings/ProjectSettings.asset tmp/orgin/ProjectSettings.asset tmp/cache/ProjectSettings.asset
'''
}
}
stage('编译ExcelExcelExpor')
{
steps
{
bat label: '',
script:'''
echo %sharePath%
cd %sharePath%/ExcelExport
if "%config_flag%"=="JP" (
echo "use japan config"
python ./excelTolua.py region jp
)
if "%config_flag%"=="KR" (
echo "use KR config"
python ./excelTolua.py region kr
)
if "%config_flag%"=="ZH" (
echo "use ZH config"
python ./excelTolua.py region zh
)
if "%config_flag%"=="EN" (
echo "use EN config"
python ./excelTolua.py region en
)
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 ("${config_flag}" == "JP") {
env.publishChannel = "google_japan"
}
if ("${config_flag}" == "SEA") {
env.publishChannel = "google_southeast"
}
if ("${config_flag}" == "KR") {
env.publishChannel = "google_korea"
}
if ("${config_flag}" == "ZH") {
env.publishChannel = "google_china"
}
if ("${config_flag}" == "EN") {
env.publishChannel = "google_en"
}
timestamp = new Date().format('yyyyMMddHHmmss')
// 构建名称
buid_name = "pandora_${publishChannel}_${version}_${timestamp}"
echo "$buid_name"
if ("${debug}" == "true") {
buid_name = "${buid_name}_debug"
}
echo "$buid_name"
// 输出文件名
env.build_file_name = "${buid_name}.apk"
if ("${mode}" == "aab") {
env.build_file_name = "${buid_name}.aab"
}
env.subpath = "${env.subpath}/${env.publishChannel}/${target}/${version}/${mode}/${timestamp}"
echo "${env.outpath}"
env.outpath = "${env.outpath}/${env.subpath}"
echo "${env.outpath}"
}
}
}
stage('ProcessPrefabLanguageTexs')
{
steps
{
bat label: '',
script:'''
%unity_app% -quit -batchmode -buildTarget %target% -projectPath %pandora_pro_dir% -logFile - -executeMethod XAsset.Build.AssetBuildScript.ProcessPrefabLanguageTexs graph=Assets/ZXToolkit/AssetGraph/Graph/BuildGraph_Preprocess.asset target=%target%
'''
}
}
stage('ProcessTextureFormat')
{
steps
{
bat label: '',
script:'''
%unity_app% -quit -batchmode -buildTarget %target% -projectPath %pandora_pro_dir% -logFile - -executeMethod XAsset.Build.AssetBuildScript.ProcessTextureFormat graph=Assets/ZXToolkit/AssetGraph/Graph/SpineImageImporter.asset target=%target%
'''
}
}
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% versionPort=%versionPort%
if "%config_flag%"=="JP" (
echo "use japan config"
python %pandora_cli_proj%/../pandora_share_proj/MacBuild/build_copy_config.py JP
)
if "%config_flag%"=="KR" (
echo "use japan config"
python %pandora_cli_proj%/../pandora_share_proj/MacBuild/build_copy_config.py KR
)
if "%config_flag%"=="SEA" (
echo "use SoutheastAsia config"
python %pandora_cli_proj%/../pandora_share_proj/MacBuild/build_copy_config.py SEA
)
if "%config_flag%"=="ZH" (
echo "use ZH config"
python %pandora_cli_proj%/../pandora_share_proj/MacBuild/build_copy_config.py ZH
)
if "%config_flag%"=="EN" (
echo "use EN config"
python %pandora_cli_proj%/../pandora_share_proj/MacBuild/build_copy_config.py EN
)
cd /D %WORKSPACE%
python ./build_ci/parallel_builds.py %target% \
%unity_app% \
%pandora_cli_proj% \
"C:/Program Files/Java/jdk1.8.0_361/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% %config_flag% ".." %useCustomPackagename% %isUsingUWAPoco% %thinkingAnalyticsMode%
if not exist %outpath%/%build_file_name% (
echo "apk or aab not exist"
exit /b 1
)
'''
}
}
stage('ProcessAabNoSplitRes')
{
steps
{
bat label: '',
script:'''
if "%mode%"=="aab" (
echo "process aab"
%unity_app% -quit -batchmode -buildTarget %target% -projectPath %pandora_pro_dir% -logFile - -executeMethod XAsset.Build.AssetBuildScript.ProcessAabNoSplitRes graph=Assets/ZXToolkit/AssetGraph/Graph/BuildGraph_Aab_PostProcess.asset target=$target$ outpath=%outpath%/%build_file_name%
)
'''
}
}
stage('post process')
{
steps
{
bat label: '',
script:'''
cd /D %WORKSPACE%
python ./build_ci/cache_files.py %WORKSPACE% pandora_cli_proj/pandora/ProjectSettings/ProjectSettings.asset tmp/orgin/ProjectSettings.asset tmp/cache/ProjectSettings.asset true
'''
}
}
}
post
{
success
{
wrap([$class: 'BuildUser']) {
script {
env.buildUser = "${BUILD_USER}"
}
}
buildName "#${BUILD_NUMBER} ---> ${version}"
buildDescription "<a href=\"http://10.0.23.47:7980/${env.subpath}/${env.build_file_name}\">点击下载: pandora_${version}</a>"
//sh label: '', script: """sh ${u2china_share_proj}/JenkinsFile/feishu_buildPackage.sh ${buildUser} ${appVersion} SUCCESS ${JOB_NAME} apk"""
bat label: '',
script:'''
"C:/Program Files/Git/bin/sh.exe" %WORKSPACE%/build_ci/u2c/feishu_buildPackage.sh %buildUser% %Branch% SUCCESS "%config_flag%-%mode%" %build_file_name% %subpath% %feshu_url%
'''
}
failure
{
wrap([$class: 'BuildUser']) {
script {
env.buildUser = "${BUILD_USER}"
echo "FAILURE"
}
}
//sh label: '', script: """sh ${u2china_share_proj}/JenkinsFile/feishu_buildPackage.sh ${buildUser} ${appVersion} FAILURE ${JOB_NAME} apk"""
bat label: '',
script:'''
"C:/Program Files/Git/bin/sh.exe" %WORKSPACE%/build_ci/u2c/feishu_buildPackage.sh %buildUser% %Branch% FAILURE "%config_flag%-%mode%" %build_file_name% %subpath% %feshu_url%
'''
}
}
}