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.
296 lines
11 KiB
296 lines
11 KiB
1 month ago
|
env.build_file_name="_.apk"
|
||
|
env.publishChannel=""
|
||
|
env.outpath="D:/DockerContainer/nginx_2h/www/"
|
||
|
env.subpath=""
|
||
|
env.buildUser=""
|
||
|
|
||
|
pipeline
|
||
|
{
|
||
|
environment
|
||
|
{
|
||
|
unity_app="C:/Application/Unity2022.3.14f1/Editor/Unity.exe"
|
||
|
sharePath="${WORKSPACE}/trunk/share"
|
||
|
pandora_cli_proj = "${WORKSPACE}/trunk/client"
|
||
|
pandora_pro_dir= "${pandora_cli_proj}/client"
|
||
|
log_dir="${WORKSPACE}/log/android"
|
||
|
build_name="2h_${publishChannel}_${version}_date"
|
||
|
disableLog="${disableLog}"
|
||
|
lang="en"
|
||
|
gameIP="111.231.250.180"
|
||
|
maintenanceIP="111.231.250.180"
|
||
|
SVN_Credentials=credentials('2H_SVN_TOKEN')
|
||
|
feshu_url="8d1b6a92-fd8c-4c58-9e81-b2912ee1a641"
|
||
|
}
|
||
|
|
||
|
agent {
|
||
|
node {
|
||
|
label 'windows_1'
|
||
|
}
|
||
|
}
|
||
|
options{
|
||
|
timestamps()
|
||
|
}
|
||
|
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% all D:/soft/Apache-Subversion-1.10.3/bin/svn.exe false %SVN_Credentials_USR% %SVN_Credentials_PSW%
|
||
|
rem python ./build_ci/u2c/CleanSVNUnversioned.py
|
||
|
'''
|
||
|
}
|
||
|
}
|
||
|
stage('替换WxContext文件Context文件') {
|
||
|
steps {
|
||
|
script {
|
||
|
def filePath = "${pandora_cli_proj}/client/Assets/WX-WASM-SDK-V2/Runtime/WxContext.cs"
|
||
|
def templateContent = """
|
||
|
namespace WeChatWASM
|
||
|
{
|
||
|
public class WxContext
|
||
|
{
|
||
|
public const string CDN = "${CDN_URL}${CDN_SUB_PATH}/";
|
||
|
}
|
||
|
}
|
||
|
"""
|
||
|
echo "filePath is ${filePath}."
|
||
|
writeFile(file: filePath, text: templateContent.trim())
|
||
|
echo "WxContext文件已写入到 ${filePath}."
|
||
|
|
||
|
def contextFilePath = "${pandora_cli_proj}/client/Assets/Scripts/Base/Context.cs"
|
||
|
def contextTemplateContent = """
|
||
|
namespace GM
|
||
|
{
|
||
|
public static class Context
|
||
|
{
|
||
|
public static string[] versionIPs = new string[] { "${VERSION_SERVER}" };
|
||
|
public static int versionPort = ${VERSION_SERVER_PORT};
|
||
|
public static string gameIP = "anhei-xcx-websocket.zealshow.com";
|
||
|
// public static int gamePort = 49720;
|
||
|
public static int gamePort = 9710;
|
||
|
public static string maintenanceIP = "panduola-xcx-websocket.shyxhy.com";
|
||
|
public static string buildMode = "apk";
|
||
|
public static string lang = "zh";
|
||
|
public static string appVersion = "${Version}";
|
||
|
public static string publishChannel = "google_oversea";
|
||
|
public static string connectLobbyIP = gameIP;
|
||
|
}
|
||
|
}
|
||
|
"""
|
||
|
writeFile(file: contextFilePath, text: contextTemplateContent.trim())
|
||
|
echo "Context文件已写入到 ${contextFilePath}."
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
stage('编译ExcelExcel 和 pb')
|
||
|
{
|
||
|
steps
|
||
|
{
|
||
|
bat label: '',
|
||
|
script:'''
|
||
|
CHCP 65001
|
||
|
|
||
|
echo %sharePath%
|
||
|
|
||
|
cd %sharePath%/protocol
|
||
|
call gen.bat nopause
|
||
|
cd %sharePath%/protocol_cli
|
||
|
call update_client_proto_no_pause.bat
|
||
|
|
||
|
cd %sharePath%/ExcelExport
|
||
|
|
||
|
python ExportLanguageToText.py
|
||
|
call run_SpeedWin.bat nopause
|
||
|
'''
|
||
|
}
|
||
|
}
|
||
|
|
||
|
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/ChangeTextFormat.asset target=%target%
|
||
|
'''
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//apk暂时用offline模式,后面也加入到并行阶段中
|
||
|
// stage('Upload Cdn'){
|
||
|
// when { expression { params.skip_test != true } }
|
||
|
// steps
|
||
|
// {
|
||
|
// bat label:'',
|
||
|
// script:'''
|
||
|
// cd /D %WORKSPACE%/2h/android_common/
|
||
|
// echo %Version%
|
||
|
// python ./UploadCDN.py %Version% %pandora_pro_dir% %CDN_SUB_PATH% %CDN_URL% %UploadRefresh_VersionFile%
|
||
|
// '''
|
||
|
// }
|
||
|
// }
|
||
|
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 = "anhei_${publishChannel}_${version}_${timestamp}"
|
||
|
echo "buid_name is: $buid_name"
|
||
|
if ("${debug}" == "true") {
|
||
|
buid_name = "${buid_name}_debug"
|
||
|
}
|
||
|
echo "buid_name is $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('Build')
|
||
|
{
|
||
|
steps
|
||
|
{
|
||
|
bat label: '',
|
||
|
script:'''
|
||
|
cd /D %WORKSPACE%
|
||
|
python ./build_ci/parallel_builds.py %target% \
|
||
|
%unity_app% \
|
||
|
%pandora_cli_proj% \
|
||
|
"C:/Program Files/Java/jdk-11/bin/java.exe" \
|
||
|
"C:/Application/Unity2022.3.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-7.2.jar" \
|
||
|
%outpath% \
|
||
|
%build_file_name% \
|
||
|
%debug% %version% %disableLog% %mode% %publishChannel% %lang% \
|
||
|
%isUsingUWATools% %config_flag% ".." %useCustomPackagename% %isUsingUWAPoco%
|
||
|
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}"
|
||
|
}
|
||
|
}
|
||
|
script {
|
||
|
currentBuild.description = """
|
||
|
<div style="display: flex;justify-content: center;">
|
||
|
<a href=\"http://10.0.22.46:8001${env.subpath}/${env.build_file_name}\">点击下载: 2h_${version}</a>
|
||
|
</div>
|
||
|
"""
|
||
|
}
|
||
|
// 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%
|
||
|
// '''
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|