合并鸿蒙分支代码
parent
53eae428ea
commit
2b60989256
|
|
@ -614,6 +614,14 @@ namespace Framework
|
|||
//手机短信验证码登录失败
|
||||
PhoneCodeLoginFail,
|
||||
PhoneCodeLoginSuc,
|
||||
/// <summary>
|
||||
/// 华为登录成功
|
||||
/// </summary>
|
||||
HarmonyLoginSuccess,
|
||||
/// <summary>
|
||||
/// 鸿蒙选择手机登录
|
||||
/// </summary>
|
||||
HarmonyToPhoneLogin,
|
||||
|
||||
//邮箱绑定
|
||||
BindMailSuccess,
|
||||
|
|
|
|||
|
|
@ -62,5 +62,9 @@ namespace GameWrapper.Pay
|
|||
/// iOS支付服务
|
||||
/// </summary>
|
||||
public static IPaymentService ApplePaymentService { get; set; }
|
||||
/// <summary>
|
||||
/// Harmony支付服务
|
||||
/// </summary>
|
||||
public static IPaymentService HarmonyPaymentService { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit c9f3d240e225879be8a12975e17b664537d133a5
|
||||
Subproject commit aeee43ff92267b1c9e3d64aab6b6af7c2d998df2
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
# 宏定义列表,供脚本添加到 PlayerSettings 的宏定义中
|
||||
Define_list:
|
||||
- BI_PHXH # BI
|
||||
- LOGIN_PHONE # 手机登录
|
||||
- USE_YOO # YooAsset资源管理
|
||||
- USE_HCLR # HybridCLR热更
|
||||
- NODECANVAS # NodeCanvas
|
||||
- ODIN_INSPECTOR
|
||||
- ODIN_INSPECTOR_3
|
||||
- ODIN_INSPECTOR_3_1
|
||||
- ODIN_VALIDATOR
|
||||
- ODIN_VALIDATOR_3_1
|
||||
- SDK_HARMONY
|
||||
- READ_STREAMING_ASSETS_WITH_WEB_REQUEST
|
||||
|
||||
# 应用包名
|
||||
PackageName: "com.kedrgame.xuesong.huawei"
|
||||
|
||||
# 是否海外渠道
|
||||
IsOversea: false
|
||||
|
||||
# 多语言配置
|
||||
Language: "Lan_CN"
|
||||
|
||||
# 当前版本号
|
||||
Version: "1.0.0"
|
||||
|
||||
# BuildCode
|
||||
BuildCode: 4
|
||||
|
||||
# 构建资源远程上传路径
|
||||
OssRemoteUploadPath: "oss://nld-pre/client_res/Build"
|
||||
AssetsEndPoint: "oss-cn-hangzhou.aliyuncs.com"
|
||||
|
||||
# 阿里云 OSS 配置
|
||||
ConfigAccessKeyId: "LTAI5t7eqAcg9e9hhPfwq2PL"
|
||||
ConfigAccessKeySecret: "XYMXX2Wj3LISNDQ4TYxlIStnCVnmrP"
|
||||
ConfigBucketName: "nld-ios-xqk7mz9r2sfbvnhp"
|
||||
ConfigURL: "https://xqk7mz9r2sfbvnhp-cdn.kedrgame.com"
|
||||
|
||||
# http请求配置
|
||||
AppAccessKey: "bYFEOhDAWNtISptP"
|
||||
AppKey: "xYq_CUsU1q_K1w1uGDO3S9R7Y7-zcZ0K-C45_Aqz-xU="
|
||||
|
||||
# BI服务器配置
|
||||
PhxhBiAccessKeyId: "yd9kWI798IWyyq1t" # BI AccessKeyId
|
||||
PhxhBiScretKey: "iQLHTbOqeXtZZpxOZve-PDxTK9DkHPSKRbpXb30eS3g=" # BI SecretKey
|
||||
|
||||
# 崩溃监控配置(仅 Android)
|
||||
CrashSight_Android:
|
||||
id: "669a94ce69" # 崩溃上报的 App ID
|
||||
key: "d9412717-2416-4270-b8bc-f7a0805f988f" # 崩溃上报的 Key
|
||||
|
||||
# TalkingData初始化
|
||||
TalkingData:
|
||||
appid: "2D0025FE20F34810BADABEFC00D32D22" # 测试包的App ID
|
||||
channel: "Dev" # 上报渠道
|
||||
|
||||
# 数数科技(ThinkingData)初始化
|
||||
ThinkingData:
|
||||
appid: "81d12d9e725543dd81210fbf3f0740b8" # 数数科技App ID
|
||||
serverurl: "https://phxh-receiver.kedrgame.com/" # 数数科技数据接收地址
|
||||
|
||||
Packages:
|
||||
- ThinkingData@1.0.0
|
||||
|
|
@ -10,6 +10,9 @@ Define_list:
|
|||
- ODIN_INSPECTOR_3_1
|
||||
- ODIN_VALIDATOR
|
||||
- ODIN_VALIDATOR_3_1
|
||||
- SDK_HARMONY
|
||||
- READ_STREAMING_ASSETS_WITH_WEB_REQUEST
|
||||
- DEBUG
|
||||
|
||||
# 应用包名
|
||||
PackageName: "com.kedrgame.xuesong.huawei"
|
||||
|
|
@ -21,7 +24,7 @@ IsOversea: false
|
|||
Language: "Lan_CN"
|
||||
|
||||
# 当前版本号
|
||||
Version: "0.8.0"
|
||||
Version: "1.0.0"
|
||||
|
||||
# BuildCode
|
||||
BuildCode: 4
|
||||
|
|
@ -51,8 +54,4 @@ TalkingData:
|
|||
channel: "Dev" # 上报渠道
|
||||
|
||||
Packages:
|
||||
- CrashSight@latest
|
||||
- WXPay@1.0.0
|
||||
- AliPay@0.0.1
|
||||
- ThinkingData@1.0.0
|
||||
- TalkingData@0.0.1
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
def PLATFORM_PARAM = "OpenHarmony"
|
||||
def PROFILE_PARAM = "Debug"
|
||||
def HAP_NAME = "NLDBuild.hap"
|
||||
def BUILD_NAME = "NLDBuild"
|
||||
|
||||
// 构建时候的参数
|
||||
def CHANNEL_PARAM = params.Channel
|
||||
|
|
@ -10,6 +11,9 @@ def HOTUPDATE_PARAM = params.Enable_Hot_Update
|
|||
def AAB_PARAM = params.AAB
|
||||
def OBFUZ = params.Obfuz
|
||||
def DEV_PARAM = true
|
||||
def PackDefaultRes = params.PackDefaultRes
|
||||
def PackDllRes = params.PackDllRes
|
||||
def PackConfigRes = params.PackConfigRes
|
||||
def ANDROIDKEYSTORE = "/Users/mayuanzheng/key/phxh_android.keystore"
|
||||
def ANDROIDKEYALIAS = "avery"
|
||||
def UPLOAD_SYMBOL = params.UploadSymbol
|
||||
|
|
@ -28,7 +32,7 @@ def BUILD_PATH
|
|||
def log_path
|
||||
|
||||
def GetRemote(){
|
||||
return 'dev';
|
||||
return 'feature/harmony_dev';
|
||||
}
|
||||
|
||||
def CheckRemoteBranchExists(repoUrl, branchName) {
|
||||
|
|
@ -98,7 +102,7 @@ pipeline {
|
|||
if (!CheckRemoteBranchExists(repoUrl, remote)) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】远程分支 ${remote} 不存在,使用默认分支 main"
|
||||
SendMessageToWechat(message)
|
||||
remote = 'main' // 回退到默认分支
|
||||
remote = 'dev' // 回退到默认分支
|
||||
}
|
||||
|
||||
echo "拉取分支:${remote}"
|
||||
|
|
@ -117,8 +121,10 @@ pipeline {
|
|||
echo "更新PhxhSDK子模块到最新版本"
|
||||
dir("${WORKSPACE}/ProjectNLD/Assets/PhxhSDK") {
|
||||
sh "git fetch origin"
|
||||
sh "git checkout ${remote} || git checkout main"
|
||||
sh "git pull origin ${remote} || git pull origin main"
|
||||
sh "git checkout ${remote} || git checkout dev"
|
||||
sh "git pull origin ${remote} || git pull origin dev"
|
||||
// 清理未被git跟踪的残留目录(如历史上曾作为嵌套git仓库存在的ThirdParty/YooAsset)
|
||||
sh "git clean -fd"
|
||||
}
|
||||
echo "PhxhSDK子模块更新完成"
|
||||
|
||||
|
|
@ -132,9 +138,9 @@ pipeline {
|
|||
def branch = GetRemote();
|
||||
// 检查远程分支是否存在
|
||||
if (!CheckRemoteBranchExists(gameplayUrl, branch)) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】远程分支 ${branch} 不存在,使用默认分支 main"
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】远程分支 ${branch} 不存在,使用默认分支 dev"
|
||||
SendMessageToWechat(message)
|
||||
branch = 'main' // 回退到默认分支
|
||||
branch = 'dev' // 回退到默认分支
|
||||
}
|
||||
|
||||
// 执行 GamePlay 仓库拉取
|
||||
|
|
@ -163,10 +169,10 @@ pipeline {
|
|||
// 根据参数动态设置团结引擎版本
|
||||
echo "使用团结引擎版本: ${TUANJIE_VERSION}"
|
||||
def tuanjiePath = "/Applications/Tuanjie/Hub/Editor/${TUANJIE_VERSION}/Tuanjie.app/Contents/MacOS/Tuanjie"
|
||||
sh """cat > $WORKSPACE/Tool/build_tools/local_env_tuanjie.sh << EOF
|
||||
#!/bin/bash
|
||||
UNITY_PATH=\"${tuanjiePath}\"
|
||||
EOF"""
|
||||
sh "echo 'UNITY_PATH=\"${tuanjiePath}\"' >> $WORKSPACE/Tool/build_tools/local_env_tuanjie.sh"
|
||||
// 设置命令行工具路径(hvigor构建hap时需要,参考华为文档: 搭建流水线-命令行工具)
|
||||
def commandlineToolDir = "/Users/mayuanzheng/harmony-command-line-tools"
|
||||
sh "echo 'COMMANDLINE_TOOL_DIR=\"${commandlineToolDir}\"' >> $WORKSPACE/Tool/build_tools/local_env_tuanjie.sh"
|
||||
sh "cat $WORKSPACE/Tool/build_tools/local_env_tuanjie.sh"
|
||||
} catch (err) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】获取项目配置失败"
|
||||
|
|
@ -246,6 +252,13 @@ EOF"""
|
|||
}
|
||||
stage('打包') {
|
||||
steps {
|
||||
script {
|
||||
// 首包构建前,先删除旧的 Harmony 导出工程目录,避免增量污染
|
||||
if (params.Build_InitApp == true){
|
||||
def harmony_export_path="$WORKSPACE/Builds/$CHANNEL_PARAM/$PLATFORM_PARAM/$VERSION_PARAM/$BUILD_NAME"
|
||||
sh "if [ -d '${harmony_export_path}' ]; then rm -rf '${harmony_export_path}'; echo '已删除旧Harmony工程: ${harmony_export_path}'; fi"
|
||||
}
|
||||
}
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/build_tuanjie.sh"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/hot_update_tuanjie.sh"
|
||||
script {
|
||||
|
|
@ -254,11 +267,11 @@ EOF"""
|
|||
PROFILE_PARAM="AllLocal"
|
||||
|
||||
if(params.Build_InitApp == false){
|
||||
build_result=sh(script: "$WORKSPACE/Tool/build_tools/hot_update_tuanjie.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${PROFILE_PARAM} ${CHANNEL_PARAM} ${HOTUPDATE_PARAM} ${DEBUGBUILD_PARAM} ${ANDROIDKEYSTORE} ${ANDROIDKEYALIAS} ${OBFUZ}", returnStatus: true, returnStdout: false)
|
||||
build_result=sh(script: "$WORKSPACE/Tool/build_tools/hot_update_tuanjie.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${PROFILE_PARAM} ${CHANNEL_PARAM} ${HOTUPDATE_PARAM} ${DEBUGBUILD_PARAM} ${ANDROIDKEYSTORE} ${ANDROIDKEYALIAS} ${OBFUZ} ${PackDefaultRes} ${PackDllRes} ${PackConfigRes}", returnStatus: true, returnStdout: false)
|
||||
log_path="$BUILD_PATH/UpdatePreviousBuild.log"
|
||||
}
|
||||
else
|
||||
build_result=sh(script: "$WORKSPACE/Tool/build_tools/build_tuanjie.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${PROFILE_PARAM} ${CHANNEL_PARAM} ${HOTUPDATE_PARAM} ${DEBUGBUILD_PARAM} ${AAB_PARAM} ${DEV_PARAM} ${ANDROIDKEYSTORE} ${ANDROIDKEYALIAS} ${OBFUZ} ${UPLOAD_SYMBOL}", returnStatus: true, returnStdout: false)
|
||||
build_result=sh(script: "$WORKSPACE/Tool/build_tools/build_tuanjie.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${PROFILE_PARAM} ${CHANNEL_PARAM} ${HOTUPDATE_PARAM} ${DEBUGBUILD_PARAM} ${AAB_PARAM} ${DEV_PARAM} ${ANDROIDKEYSTORE} ${ANDROIDKEYALIAS} ${OBFUZ} ${UPLOAD_SYMBOL} ${PackDefaultRes} ${PackDllRes} ${PackConfigRes}", returnStatus: true, returnStdout: false)
|
||||
|
||||
def parse_log = "../../$log_path"
|
||||
// 打包失败
|
||||
|
|
@ -297,8 +310,8 @@ EOF"""
|
|||
{
|
||||
def upload_incremental_result=0
|
||||
def last_manifest_path="$WORKSPACE/ProjectNLD/ServerData/LastManifests/${CHANNEL_PARAM}"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/upload_incremental_oss.sh"
|
||||
upload_incremental_result = sh(script: "$WORKSPACE/Tool/build_tools/upload_incremental_oss.sh ${asset_path} ${upload_path} ${ASSETS_END_POINT_PARAM} ${last_manifest_path}", returnStatus: true, returnStdout: false)
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/upload_incremental_oss_tuanjie.sh"
|
||||
upload_incremental_result = sh(script: "$WORKSPACE/Tool/build_tools/upload_incremental_oss_tuanjie.sh ${asset_path} ${upload_path} ${ASSETS_END_POINT_PARAM} ${last_manifest_path}", returnStatus: true, returnStdout: false)
|
||||
if(upload_incremental_result != 0)
|
||||
{
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】上传资源失败"
|
||||
|
|
@ -308,9 +321,9 @@ EOF"""
|
|||
}
|
||||
else
|
||||
{
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/upload_oss.sh"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/upload_oss_tuanjie.sh"
|
||||
def upload_result=0
|
||||
upload_result = sh(script: "$WORKSPACE/Tool/build_tools/upload_oss.sh ${asset_path} ${upload_path} ${ASSETS_END_POINT_PARAM}", returnStatus: true, returnStdout: false)
|
||||
upload_result = sh(script: "$WORKSPACE/Tool/build_tools/upload_oss_tuanjie.sh ${asset_path} ${upload_path} ${ASSETS_END_POINT_PARAM}", returnStatus: true, returnStdout: false)
|
||||
if(upload_result != 0)
|
||||
{
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】上传资源失败"
|
||||
|
|
@ -322,27 +335,34 @@ EOF"""
|
|||
}
|
||||
}
|
||||
}
|
||||
stage('导出hap') {
|
||||
steps {
|
||||
script {
|
||||
// 首包构建才需要导出hap
|
||||
if (params.Build_InitApp == true){
|
||||
def harmony_project_path="$WORKSPACE/Builds/$CHANNEL_PARAM/$PLATFORM_PARAM/$VERSION_PARAM/$BUILD_NAME"
|
||||
def export_result=0
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/build_hap.sh"
|
||||
// 先加载 local_env_tuanjie.sh 再执行 build_hap.sh,确保 COMMANDLINE_TOOL_DIR 等变量可用
|
||||
export_result = sh(
|
||||
script: "bash $WORKSPACE/Tool/build_tools/build_hap.sh ${harmony_project_path}",
|
||||
returnStatus: true,
|
||||
returnStdout: false
|
||||
)
|
||||
if(export_result != 0)
|
||||
{
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】导出hap失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '导出hap' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('上传hap') {
|
||||
steps {
|
||||
script {
|
||||
// 增量更新不需要上传包体
|
||||
if (params.Build_InitApp == true){
|
||||
def hap_path="$WORKSPACE/Builds/$CHANNEL_PARAM/$PLATFORM_PARAM/$VERSION_PARAM/$HAP_NAME"
|
||||
def upload_path="${OSS_UPLOAD_PATH_PARAM}/${CHANNEL_PARAM}/${PLATFORM_PARAM}/"
|
||||
def upload_path_with_version="${OSS_UPLOAD_PATH_PARAM}/${CHANNEL_PARAM}/${PLATFORM_PARAM}/${VERSION_PARAM}/"
|
||||
def upload_result=0
|
||||
def upload_result_with_version=0
|
||||
|
||||
upload_result=sh(script: "$WORKSPACE/Tool/build_tools/upload_oss.sh ${hap_path} ${upload_path} ${ASSETS_END_POINT_PARAM}", returnStatus: true, returnStdout: false)
|
||||
upload_result_with_version=sh(script: "$WORKSPACE/Tool/build_tools/upload_oss.sh ${hap_path} ${upload_path_with_version} ${ASSETS_END_POINT_PARAM}", returnStatus: true, returnStdout: false)
|
||||
|
||||
if(upload_result != 0 || upload_result_with_version != 0)
|
||||
{
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】上传HAP失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '上传hap' stage")
|
||||
}
|
||||
}
|
||||
echo "跳过上传hap到OSS(hap已通过导出hap stage生成到构建目录)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -386,9 +406,9 @@ EOF"""
|
|||
steps {
|
||||
script {
|
||||
if (params.Build_InitApp == true){
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/debug_send_version.sh"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/debug_send_version_tuanjie.sh"
|
||||
def result=0
|
||||
result = sh(script: "$WORKSPACE/Tool/build_tools/debug_send_version.sh")
|
||||
result = sh(script: "$WORKSPACE/Tool/build_tools/debug_send_version_tuanjie.sh")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -399,7 +419,7 @@ EOF"""
|
|||
try{
|
||||
archiveArtifacts artifacts: "$log_path" , followSymlinks: false
|
||||
if (params.Build_InitApp == true)
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/*.apk" , followSymlinks: false
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/*.hap" , followSymlinks: false
|
||||
}
|
||||
catch(Exception e){
|
||||
SendMessageToWechat(e.message + "\r\n" + e.stackTrace)
|
||||
|
|
@ -409,7 +429,6 @@ EOF"""
|
|||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
stage('通知') {
|
||||
steps {
|
||||
script {
|
||||
|
|
@ -423,6 +442,5 @@ EOF"""
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,417 @@
|
|||
// 对应管线任务参数
|
||||
def PLATFORM_PARAM = "OpenHarmony"
|
||||
def PROFILE_PARAM = "Debug"
|
||||
def HAP_NAME = "NLDBuild.hap"
|
||||
|
||||
// 构建时候的参数
|
||||
def CHANNEL_PARAM = params.Channel
|
||||
def DEBUGBUILD_PARAM = params.DebugBuild
|
||||
def HOTUPDATE_PARAM = params.Enable_Hot_Update
|
||||
def AAB_PARAM = params.AAB
|
||||
def OBFUZ = params.Obfuz
|
||||
def DEV_PARAM = false
|
||||
def PackDefaultRes = params.PackDefaultRes
|
||||
def PackDllRes = params.PackDllRes
|
||||
def PackConfigRes = params.PackConfigRes
|
||||
def ANDROIDKEYSTORE = "/Users/mayuanzheng/key/phxh_android.keystore"
|
||||
def ANDROIDKEYALIAS = "avery"
|
||||
def UPLOAD_SYMBOL = params.UploadSymbol
|
||||
def TUANJIE_VERSION = params.TuanjieVersion ?: "2022.3.62t7" // 团结引擎版本
|
||||
|
||||
// Jenkins 归档地址
|
||||
def ARTIFACT_URL = "http://${env.PHXH_BUILDER_IP_ADDRESS}:8080/job/${env.JOB_NAME}/"
|
||||
|
||||
def VERSION_PARAM = "尚未获取" // 版本号 根据项目获取
|
||||
def OSS_UPLOAD_PATH_PARAM // 上传地址,根据项目获取
|
||||
def ASSETS_END_POINT_PARAM // Assets endPoint,根据项目获取
|
||||
|
||||
// 构建地址
|
||||
def BUILD_PATH
|
||||
// 日志地址
|
||||
def log_path
|
||||
|
||||
def GetRemote(){
|
||||
return 'release/harmony_1_0_0';
|
||||
}
|
||||
|
||||
def CheckRemoteBranchExists(repoUrl, branchName) {
|
||||
def result = sh(
|
||||
script: "git ls-remote --heads ${repoUrl} refs/heads/${branchName}",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
if (result == '') {
|
||||
echo "警告: 远程分支 ${branchName} 不存在于 ${repoUrl}"
|
||||
return false
|
||||
}
|
||||
|
||||
echo "远程分支 ${branchName} 存在"
|
||||
return true
|
||||
}
|
||||
|
||||
def SendMessageToWechat(message){
|
||||
if (!message) {
|
||||
return }
|
||||
def INNER_ROBOT="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=3c92758c-1128-4931-ac8d-f19669d7befe"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/send_wechat_message.sh"
|
||||
sh "$WORKSPACE/Tool/build_tools/send_wechat_message.sh '${INNER_ROBOT}' '@all' '${message}'"
|
||||
}
|
||||
|
||||
def ParseBuildLogError(logPath){
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/parse_unity_build_log.sh"
|
||||
|
||||
// 转译 "\[Build Exception\]:" 取消使用
|
||||
// def exceptionFlag = '\\[Build Exception\\]:'
|
||||
def errorMessage = sh(script: "${WORKSPACE}/Tool/build_tools/parse_unity_build_log.sh ${logPath} 'error CS' true true", returnStdout: true).trim()
|
||||
def exceptionMessage = sh(script: "${WORKSPACE}/Tool/build_tools/parse_unity_build_log.sh ${logPath} 'Build Exception' false true", returnStdout: true).trim()
|
||||
def sceneMessage = sh(script: "${WORKSPACE}/Tool/build_tools/parse_unity_build_log.sh ${logPath} 'Problem detected while' true true", returnStdout: true).trim()
|
||||
def multipleMessage = sh(script: "${WORKSPACE}/Tool/build_tools/parse_unity_build_log.sh ${logPath} 'Multiple Unity' true false", returnStdout: true).trim()
|
||||
def processSceneMessage = sh(script: "${WORKSPACE}/Tool/build_tools/parse_unity_build_log.sh ${logPath} 'Failed to process scene' true false", returnStdout: true).trim()
|
||||
|
||||
SendMessageToWechat(errorMessage)
|
||||
SendMessageToWechat(exceptionMessage)
|
||||
SendMessageToWechat(sceneMessage)
|
||||
SendMessageToWechat(multipleMessage)
|
||||
SendMessageToWechat(processSceneMessage)
|
||||
}
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage('拉最新工程') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
def currentPath = sh(script: 'pwd', returnStdout: true).trim()
|
||||
echo "cd ${currentPath}"
|
||||
|
||||
// 1. 还原子模块修改
|
||||
def gitDirExists = sh(script: '[ -d ".git" ] && echo "true" || echo "false"', returnStdout: true).trim()
|
||||
def scriptPathExists = fileExists("${WORKSPACE}/Tool/build_tools/git_revert_modules_modification.sh")
|
||||
if (gitDirExists == 'true' && scriptPathExists) {
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/git_revert_modules_modification.sh"
|
||||
sh "$WORKSPACE/Tool/build_tools/git_revert_modules_modification.sh $WORKSPACE"
|
||||
}
|
||||
|
||||
// 2. 拉取主项目代码
|
||||
def repoUrl = 'http://1.14.122.170:3000/PHXH/NLDClient.git'
|
||||
def remote = GetRemote();
|
||||
echo "获取到分支名字:${remote}"
|
||||
// 检查远程分支是否存在
|
||||
if (!CheckRemoteBranchExists(repoUrl, remote)) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】远程分支 ${remote} 不存在,使用默认分支 main"
|
||||
SendMessageToWechat(message)
|
||||
remote = 'dev' // 回退到默认分支
|
||||
}
|
||||
|
||||
echo "拉取分支:${remote}"
|
||||
checkout scmGit(
|
||||
branches: [[name: "*/${remote}"]],
|
||||
extensions: [
|
||||
checkoutOption(60),
|
||||
lfs(),
|
||||
cloneOption(noTags: false, reference: '', shallow: false, timeout: 120),
|
||||
submodule(recursiveSubmodules: true, reference: '', timeout: 1200)
|
||||
],
|
||||
userRemoteConfigs: [[url: repoUrl]]
|
||||
)
|
||||
|
||||
// 3. 删除旧 GamePlay_Dll 文件夹
|
||||
def gameplayDllPath = "${WORKSPACE}/ProjectNLD/Assets/Code/Scripts/GamePlay_Dll"
|
||||
sh "if [ -d '${gameplayDllPath}' ]; then rm -rf '${gameplayDllPath}'; fi"
|
||||
|
||||
// 4. 拉取 GamePlay 仓库
|
||||
def gameplayTargetPath = "${WORKSPACE}/ProjectNLD/Assets/Code/Scripts/GamePlay"
|
||||
def gameplayUrl = "http://1.14.122.170:3000/PHXH/GamePlay.git"
|
||||
def branch = GetRemote();
|
||||
// 检查远程分支是否存在
|
||||
if (!CheckRemoteBranchExists(gameplayUrl, branch)) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】远程分支 ${branch} 不存在,使用默认分支 dev"
|
||||
SendMessageToWechat(message)
|
||||
branch = 'dev' // 回退到默认分支
|
||||
}
|
||||
|
||||
// 执行 GamePlay 仓库拉取
|
||||
sh "chmod +x ${WORKSPACE}/Tool/build_tools/git_pull_gameplay.sh"
|
||||
sh "$WORKSPACE/Tool/build_tools/git_pull_gameplay.sh ${gameplayTargetPath} ${gameplayUrl} ${branch}"
|
||||
} catch (err) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】拉最新工程失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '拉最新工程' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('获取项目配置') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
// 将项目相关配置复制到打包路径下
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/copy_env.sh"
|
||||
sh "$WORKSPACE/Tool/build_tools/copy_env.sh $WORKSPACE/Tool/build_env"
|
||||
|
||||
// 将打包机器相关配置复制到打包路径下
|
||||
echo "copy local env file to $WORKSPACE"
|
||||
sh "cp /Users/mayuanzheng/Builds/local_env_tuanjie.sh $WORKSPACE/Tool/build_tools/"
|
||||
|
||||
// 根据参数动态设置团结引擎版本
|
||||
echo "使用团结引擎版本: ${TUANJIE_VERSION}"
|
||||
def tuanjiePath = "/Applications/Tuanjie/Hub/Editor/${TUANJIE_VERSION}/Tuanjie.app/Contents/MacOS/Tuanjie"
|
||||
sh "echo 'UNITY_PATH=\"${tuanjiePath}\"' >> $WORKSPACE/Tool/build_tools/local_env_tuanjie.sh"
|
||||
sh "cat $WORKSPACE/Tool/build_tools/local_env_tuanjie.sh"
|
||||
} catch (err) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】获取项目配置失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '获取项目配置' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('修改渠道文件夹') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
// 先安装pyyaml
|
||||
sh "pip3 install pyyaml --user"
|
||||
// 调用python脚本修改渠道文件夹
|
||||
echo "根据 [${params.Channel}] 渠道修改文件夹"
|
||||
def channelPath = "${WORKSPACE}/Tool/Channels/${CHANNEL_PARAM}"
|
||||
def sdkPath = "${WORKSPACE}/Tool/sdk_packages"
|
||||
echo "Channel Path: ${channelPath}"
|
||||
echo "SDK Path: ${sdkPath}"
|
||||
// python脚本: Tool/py_tools/PreHandle.py <sdk_path> <channel_path>
|
||||
sh "chmod +x $WORKSPACE/Tool/py_tools/PreHandle.py"
|
||||
// 使用 returnStatus 获取脚本的退出码
|
||||
def pythonResult = sh(script: "python3 $WORKSPACE/Tool/py_tools/PreHandle.py ${sdkPath} ${channelPath}", returnStatus: true)
|
||||
if (pythonResult != 0) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】修改渠道文件夹失败: pythonResult=${pythonResult}"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '修改渠道文件夹' stage")
|
||||
}
|
||||
} catch (err) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】根据渠道修改工程失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '修改渠道文件夹' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('根据渠道修改工程') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
echo "根据 [${params.Channel}] 渠道修改工程"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/modify_project_by_channel.sh"
|
||||
sh "$WORKSPACE/Tool/build_tools/modify_project_by_channel.sh $WORKSPACE ${CHANNEL_PARAM}"
|
||||
} catch (err) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】根据渠道修改工程失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '根据渠道修改工程' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('根据渠道获取相关参数') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
echo "根据 [${params.Channel}] 渠道获取相关参数"
|
||||
def playersettings = "${WORKSPACE}/Tool/Channels/${CHANNEL_PARAM}/ChannelSetting.yaml"
|
||||
// 1. 读取并解析 YAML,得到一个 Groovy Map
|
||||
def cfg = readYaml(file: playersettings)
|
||||
// 2. 提取字段 根据 YAML 键名取值
|
||||
VERSION_PARAM = (cfg?.Version ?: '').trim()
|
||||
OSS_UPLOAD_PATH_PARAM = (cfg?.OssRemoteUploadPath ?: '').trim()
|
||||
ASSETS_END_POINT_PARAM = (cfg?.AssetsEndPoint ?: '').trim()
|
||||
// 3.其他数据
|
||||
BUILD_PATH = "Builds/$CHANNEL_PARAM/$PLATFORM_PARAM/$VERSION_PARAM"
|
||||
log_path="$BUILD_PATH/build.log"
|
||||
echo "获取到的版本是 ${VERSION_PARAM}, 获取到的上传地址是 ${OSS_UPLOAD_PATH_PARAM},获取到的assets-oss-endpoint是 ${ASSETS_END_POINT_PARAM}"
|
||||
} catch (err) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】根据渠道获取相关参数失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '根据渠道获取相关参数' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('打包') {
|
||||
steps {
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/build_tuanjie.sh"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/hot_update_tuanjie.sh"
|
||||
script {
|
||||
def build_result
|
||||
if(params.Debug_AllLocal == true)
|
||||
PROFILE_PARAM="AllLocal"
|
||||
|
||||
if(params.Build_InitApp == false){
|
||||
build_result=sh(script: "$WORKSPACE/Tool/build_tools/hot_update_tuanjie.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${PROFILE_PARAM} ${CHANNEL_PARAM} ${HOTUPDATE_PARAM} ${DEBUGBUILD_PARAM} ${ANDROIDKEYSTORE} ${ANDROIDKEYALIAS} ${OBFUZ} ${PackDefaultRes} ${PackDllRes} ${PackConfigRes}", returnStatus: true, returnStdout: false)
|
||||
log_path="$BUILD_PATH/UpdatePreviousBuild.log"
|
||||
}
|
||||
else
|
||||
build_result=sh(script: "$WORKSPACE/Tool/build_tools/build_tuanjie.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${PROFILE_PARAM} ${CHANNEL_PARAM} ${HOTUPDATE_PARAM} ${DEBUGBUILD_PARAM} ${AAB_PARAM} ${DEV_PARAM} ${ANDROIDKEYSTORE} ${ANDROIDKEYALIAS} ${OBFUZ} ${UPLOAD_SYMBOL} ${PackDefaultRes} ${PackDllRes} ${PackConfigRes}", returnStatus: true, returnStdout: false)
|
||||
|
||||
def parse_log = "../../$log_path"
|
||||
// 打包失败
|
||||
if(build_result != 0)
|
||||
{
|
||||
// 归档并分析日志
|
||||
archiveArtifacts artifacts: "$log_path" , followSymlinks: false
|
||||
ParseBuildLogError(parse_log)
|
||||
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】构建失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '打包' stage")
|
||||
}
|
||||
// 保底捕捉一次 Build Finished, Result: Failure.
|
||||
else{
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/check_unity_build_result.sh"
|
||||
def check_result = sh(script: "sh $WORKSPACE/Tool/build_tools/check_unity_build_result.sh ${parse_log}", returnStatus: true)
|
||||
if (check_result != 0) {
|
||||
// 归档日志
|
||||
archiveArtifacts artifacts: "$log_path" , followSymlinks: false
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】构建失败 日志捕捉到 Build Finished, Result: Failure."
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '打包' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('上传资源') {
|
||||
steps {
|
||||
script {
|
||||
def asset_path="$WORKSPACE/ProjectNLD/ServerData/${PLATFORM_PARAM}"
|
||||
def upload_path="${OSS_UPLOAD_PATH_PARAM}/${CHANNEL_PARAM}/${PLATFORM_PARAM}/${VERSION_PARAM}"
|
||||
|
||||
if(params.Upload_Incremental == true)
|
||||
{
|
||||
def upload_incremental_result=0
|
||||
def last_manifest_path="$WORKSPACE/ProjectNLD/ServerData/LastManifests/${CHANNEL_PARAM}"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/upload_incremental_oss_tuanjie.sh"
|
||||
upload_incremental_result = sh(script: "$WORKSPACE/Tool/build_tools/upload_incremental_oss_tuanjie.sh ${asset_path} ${upload_path} ${ASSETS_END_POINT_PARAM} ${last_manifest_path}", returnStatus: true, returnStdout: false)
|
||||
if(upload_incremental_result != 0)
|
||||
{
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】上传资源失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '上传资源' stage")
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/upload_oss_tuanjie.sh"
|
||||
def upload_result=0
|
||||
upload_result = sh(script: "$WORKSPACE/Tool/build_tools/upload_oss_tuanjie.sh ${asset_path} ${upload_path} ${ASSETS_END_POINT_PARAM}", returnStatus: true, returnStdout: false)
|
||||
if(upload_result != 0)
|
||||
{
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】上传资源失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '上传资源' stage")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('上传hap') {
|
||||
steps {
|
||||
script {
|
||||
// 增量更新不需要上传包体
|
||||
if (params.Build_InitApp == true){
|
||||
//def hap_path="$WORKSPACE/Builds/$CHANNEL_PARAM/$PLATFORM_PARAM/$VERSION_PARAM/$HAP_NAME"
|
||||
//def upload_path="${OSS_UPLOAD_PATH_PARAM}/${CHANNEL_PARAM}/${PLATFORM_PARAM}/"
|
||||
//def upload_path_with_version="${OSS_UPLOAD_PATH_PARAM}/${CHANNEL_PARAM}/${PLATFORM_PARAM}/${VERSION_PARAM}/"
|
||||
//def upload_result=0
|
||||
//def upload_result_with_version=0
|
||||
|
||||
//upload_result=sh(script: "$WORKSPACE/Tool/build_tools/upload_oss_tuanjie.sh ${hap_path} ${upload_path} ${ASSETS_END_POINT_PARAM}", returnStatus: true, returnStdout: false)
|
||||
//upload_result_with_version=sh(script: "$WORKSPACE/Tool/build_tools/upload_oss_tuanjie.sh ${hap_path} ${upload_path_with_version} ${ASSETS_END_POINT_PARAM}", returnStatus: true, returnStdout: false)
|
||||
|
||||
//if(upload_result != 0 || upload_result_with_version != 0)
|
||||
//{
|
||||
//def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】上传HAP失败"
|
||||
//SendMessageToWechat(message)
|
||||
//error("Failure of the '上传hap' stage")
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('上传符号表') {
|
||||
steps {
|
||||
script {
|
||||
if(UPLOAD_SYMBOL == true)
|
||||
{
|
||||
// 增量更新不需要上传符号表
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/upload_symbol_file.sh"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/upload_symbol_file_firebase.sh"
|
||||
if (params.Build_InitApp == true){
|
||||
def playersettings = "${WORKSPACE}/Tool/Channels/${CHANNEL_PARAM}/ChannelSetting.yaml"
|
||||
def cfg = readYaml(file: playersettings)
|
||||
def symbol_path="$WORKSPACE/Builds/$CHANNEL_PARAM/$PLATFORM_PARAM/$VERSION_PARAM"
|
||||
def upload_result=0
|
||||
if('GoogleDev' == params.Channel)
|
||||
{
|
||||
def FIREBASE_APP_ID = (cfg?.FIREBASE_APP_ID ?: '').trim()
|
||||
echo "获取到的Firebase App ID ${FIREBASE_APP_ID}"
|
||||
upload_result = sh(script: "$WORKSPACE/Tool/build_tools/upload_symbol_file_firebase.sh ${VERSION_PARAM} ${symbol_path} ${FIREBASE_APP_ID}", returnStatus: true, returnStdout: false)
|
||||
}
|
||||
else
|
||||
{
|
||||
def crashsightConfig = cfg?."CrashSight_${PLATFORM_PARAM}"
|
||||
def crashsightId = (crashsightConfig?.id ?: '').trim()
|
||||
def crashsightKey = (crashsightConfig?.key ?: '').trim()
|
||||
upload_result = sh(script: "$WORKSPACE/Tool/build_tools/upload_symbol_file.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${symbol_path} ${crashsightId} ${crashsightKey}", returnStatus: true, returnStdout: false)
|
||||
}
|
||||
if(upload_result != 0)
|
||||
{
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】上传符号表异常"
|
||||
SendMessageToWechat(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('发布debug版本号') {
|
||||
steps {
|
||||
script {
|
||||
if (params.Build_InitApp == true){
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/debug_send_version_tuanjie.sh"
|
||||
def result=0
|
||||
result = sh(script: "$WORKSPACE/Tool/build_tools/debug_send_version_tuanjie.sh")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('归档') {
|
||||
steps {
|
||||
script {
|
||||
try{
|
||||
archiveArtifacts artifacts: "$log_path" , followSymlinks: false
|
||||
if (params.Build_InitApp == true)
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/*.hap" , followSymlinks: false
|
||||
}
|
||||
catch(Exception e){
|
||||
SendMessageToWechat(e.message + "\r\n" + e.toString())
|
||||
currentBuild.result = 'FAILURE'
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('通知') {
|
||||
steps {
|
||||
script {
|
||||
if (params.Build_InitApp == true) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】客户端打包上传成功!下载链接:${ARTIFACT_URL}"
|
||||
SendMessageToWechat(message)
|
||||
} else {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】客户端增量更新上传成功!下载链接:${ARTIFACT_URL}"
|
||||
SendMessageToWechat(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 6ea0e91f55d493e765004854d37dbd8ac542226d
|
||||
Subproject commit 28ce11c377f31dc9feef467378189712b8576cd9
|
||||
Loading…
Reference in New Issue