Merge branch 'feature/split_build' into dev
commit
f1aee39603
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d11a6cac5ec82a94e9ce4b93e4adf3f4
|
||||
guid: a468c2be85133e945b9e4b61f9d575c1
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 07d3075d6c048394086852042ab9736b
|
||||
guid: 6eb3e4eefd7e0244db8a0dd821fcdc36
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d11a6cac5ec82a94e9ce4b93e4adf3f4
|
||||
guid: 2f5922e38c7791247b826711633f179d
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 07d3075d6c048394086852042ab9736b
|
||||
guid: 8b7966c5144ead044bb904b872939c42
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ MonoBehaviour:
|
|||
UniqueBundleName: 1
|
||||
Packages:
|
||||
- PackageName: DefaultPackage
|
||||
PackageDesc:
|
||||
PackageDesc: "\u9ED8\u8BA4\u8D44\u6E90"
|
||||
EnableAddressable: 0
|
||||
LocationToLower: 0
|
||||
IncludeAssetGUID: 0
|
||||
|
|
@ -45,19 +45,6 @@ MonoBehaviour:
|
|||
FilterRuleName: CollectAll
|
||||
AssetTags:
|
||||
UserData:
|
||||
- GroupName: Config_Common
|
||||
GroupDesc:
|
||||
AssetTags:
|
||||
ActiveRuleName: EnableGroup
|
||||
Collectors:
|
||||
- CollectPath: Assets/Config
|
||||
CollectorGUID: d3e5101ac58a142ff98b2bad4a50f203
|
||||
CollectorType: 0
|
||||
AddressRuleName: AddressByFileName
|
||||
PackRuleName: PackGroup
|
||||
FilterRuleName: CollectAll
|
||||
AssetTags:
|
||||
UserData:
|
||||
- GroupName: UI
|
||||
GroupDesc:
|
||||
AssetTags:
|
||||
|
|
@ -119,27 +106,6 @@ MonoBehaviour:
|
|||
FilterRuleName: CollectAll
|
||||
AssetTags:
|
||||
UserData:
|
||||
- GroupName: HotUpdateDlls
|
||||
GroupDesc:
|
||||
AssetTags:
|
||||
ActiveRuleName: EnableGroup
|
||||
Collectors:
|
||||
- CollectPath: Assets/HotUpdateDlls/HotUpdateDll
|
||||
CollectorGUID: fc0a59196e2c827448097ec5198b2901
|
||||
CollectorType: 0
|
||||
AddressRuleName: AddressByFileName
|
||||
PackRuleName: PackGroup
|
||||
FilterRuleName: CollectAll
|
||||
AssetTags:
|
||||
UserData:
|
||||
- CollectPath: Assets/HotUpdateDlls/MetaDataDll
|
||||
CollectorGUID: 9379cb20c9c63464da9daa6fe5375f00
|
||||
CollectorType: 0
|
||||
AddressRuleName: AddressByFileName
|
||||
PackRuleName: PackGroup
|
||||
FilterRuleName: CollectAll
|
||||
AssetTags:
|
||||
UserData:
|
||||
- GroupName: Scenes
|
||||
GroupDesc:
|
||||
AssetTags:
|
||||
|
|
@ -396,7 +362,7 @@ MonoBehaviour:
|
|||
AssetTags:
|
||||
UserData:
|
||||
- PackageName: RawPackage
|
||||
PackageDesc:
|
||||
PackageDesc: "\u4EC5\u5F15\u7528\u8DEF\u5F84"
|
||||
EnableAddressable: 0
|
||||
LocationToLower: 0
|
||||
IncludeAssetGUID: 0
|
||||
|
|
@ -416,24 +382,45 @@ MonoBehaviour:
|
|||
FilterRuleName: CollectAll
|
||||
AssetTags:
|
||||
UserData:
|
||||
- PackageName: TestPackage
|
||||
PackageDesc:
|
||||
- PackageName: DllPackage
|
||||
PackageDesc: "\u903B\u8F91\u8D44\u6E90"
|
||||
EnableAddressable: 0
|
||||
LocationToLower: 0
|
||||
IncludeAssetGUID: 0
|
||||
IgnoreDefaultType: 1
|
||||
AutoCollectShaders: 1
|
||||
Groups:
|
||||
- GroupName: Test
|
||||
- GroupName: Dll
|
||||
GroupDesc:
|
||||
AssetTags:
|
||||
ActiveRuleName: EnableGroup
|
||||
Collectors:
|
||||
- CollectPath: Assets/_Test/Audio
|
||||
CollectorGUID: 75b0d58bca322234fa3e6b6d82d8c93a
|
||||
- CollectPath: Assets/HotUpdateDlls
|
||||
CollectorGUID: 4625a9ccc1660174e8e6295de19639d7
|
||||
CollectorType: 0
|
||||
AddressRuleName: AddressByFileName
|
||||
PackRuleName: PackDirectory
|
||||
FilterRuleName: CollectScene
|
||||
FilterRuleName: CollectAll
|
||||
AssetTags:
|
||||
UserData:
|
||||
- PackageName: ConfigPackage
|
||||
PackageDesc: "\u914D\u7F6E\u8D44\u6E90"
|
||||
EnableAddressable: 0
|
||||
LocationToLower: 0
|
||||
IncludeAssetGUID: 0
|
||||
IgnoreDefaultType: 1
|
||||
AutoCollectShaders: 1
|
||||
Groups:
|
||||
- GroupName: Config
|
||||
GroupDesc:
|
||||
AssetTags:
|
||||
ActiveRuleName: EnableGroup
|
||||
Collectors:
|
||||
- CollectPath: Assets/Config
|
||||
CollectorGUID: d3e5101ac58a142ff98b2bad4a50f203
|
||||
CollectorType: 0
|
||||
AddressRuleName: AddressByFileName
|
||||
PackRuleName: PackDirectory
|
||||
FilterRuleName: CollectAll
|
||||
AssetTags:
|
||||
UserData:
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace Framework
|
|||
|
||||
public static string GetLocalizeText(string key)
|
||||
{
|
||||
var getValue = instance.tables.StringConfig.Get(key);
|
||||
var getValue = instance.tables.StringConfig.GetOrDefault(key);
|
||||
if (getValue == null)
|
||||
{
|
||||
return key;
|
||||
|
|
|
|||
|
|
@ -217,7 +217,9 @@ public class GameLauncher : MonoBehaviour
|
|||
|
||||
UpdateLocalInfo localInfo = PackDataInst.Inst.localInfo;
|
||||
string acquiring = LocalizeMono.Instance.GetLocalizeText("Acquiring"); // 获取中...
|
||||
versionUpdateUI.ShowVersion(Application.version, localInfo.workSpace, localInfo.localFullVersion, acquiring, acquiring);
|
||||
string displayLocalVersion = VersionDisplayFormatter.Format(localInfo.localFullVersion, "[LTRes]GameLauncher");
|
||||
Debug.Log("[LTRes]GameLauncher - ShowVersion关键日志 stage=LaunchInit, fullOldVersion=" + localInfo.localFullVersion + ", fullNewVersion=" + acquiring + ", displayOldVersion=" + displayLocalVersion + ", displayNewVersion=" + acquiring + ", serverName=" + acquiring);
|
||||
versionUpdateUI.ShowVersion(Application.version, localInfo.workSpace, displayLocalVersion, acquiring, acquiring);
|
||||
|
||||
BIToolinAOT.Instance.Init();//TalkingData初始化
|
||||
try
|
||||
|
|
@ -250,7 +252,9 @@ public class GameLauncher : MonoBehaviour
|
|||
downloadResult = await PreConfig.instance.DownloadConfig();
|
||||
|
||||
versionUpdateUI.UpdateProgressText(LocalizeMono.Instance.GetLocalizeText("RequestConfigurationComplete")); // 请求APPConfig结束
|
||||
versionUpdateUI.ShowVersion(Application.version, localInfo.workSpace, localInfo.localFullVersion, acquiring, PreConfig.instance.ServerName);
|
||||
string displayLocalVersionAfterConfig = VersionDisplayFormatter.Format(localInfo.localFullVersion, "[LTRes]GameLauncher");
|
||||
Debug.Log("[LTRes]GameLauncher - ShowVersion关键日志 stage=ConfigReady, fullOldVersion=" + localInfo.localFullVersion + ", fullNewVersion=" + acquiring + ", displayOldVersion=" + displayLocalVersionAfterConfig + ", displayNewVersion=" + acquiring + ", serverName=" + PreConfig.instance.ServerName);
|
||||
versionUpdateUI.ShowVersion(Application.version, localInfo.workSpace, displayLocalVersionAfterConfig, acquiring, PreConfig.instance.ServerName);
|
||||
BIToolinAOT.Instance.TrackEventInAOT("app_config_response", new System.Collections.Generic.Dictionary<string, object>(){
|
||||
{"result", downloadResult? 0 : 1 }
|
||||
});
|
||||
|
|
@ -299,7 +303,7 @@ public class GameLauncher : MonoBehaviour
|
|||
Debug.Log("需要热更新,开始加载程序集");
|
||||
_hybridCLRHelper = new HybridCLRHelper();
|
||||
_hybridCLRHelper.SetDllList(AOTGenericReferences.PatchedAOTAssemblyList);
|
||||
_hybridCLRHelper.RegistLoader(_simpleLoader);
|
||||
_hybridCLRHelper.RegisterLoader(_simpleLoader);
|
||||
|
||||
await _hybridCLRHelper.LoadAssemblies();
|
||||
Debug.Log("加载程序集结束!");
|
||||
|
|
@ -424,4 +428,4 @@ public class GameLauncher : MonoBehaviour
|
|||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,16 +24,6 @@ namespace HotUpdate.UI
|
|||
return TempUpdateUI.Instance.isClickOk;
|
||||
}
|
||||
|
||||
public void ShowVersion(string aotVersion, string curResVersion, string newResVersion)
|
||||
{
|
||||
TempUpdateUI.Instance.m_TextAotVersion.text = aotVersion;
|
||||
TempUpdateUI.Instance.m_TextCurResVersion.text = curResVersion;
|
||||
TempUpdateUI.Instance.m_TextNewResVersion.text = newResVersion;
|
||||
TempUpdateUI.Instance.m_TextAotVersion.gameObject.SetActive(true);
|
||||
TempUpdateUI.Instance.m_TextCurResVersion.gameObject.SetActive(true);
|
||||
TempUpdateUI.Instance.m_TextNewResVersion.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void ShowVersion(string curAotVersion, string workSpace, string curResVersion, string newResVersion, string serverName)
|
||||
{
|
||||
string aotVersion = string.Format(LocalizeMono.Instance.GetLocalizeText("AotVersionInfo"), curAotVersion, workSpace, serverName); // 游戏版本:{0},渠道:{1},服务器:{2}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ Shader "NLD_URP/NLD_Charactor_Dead"
|
|||
float3 normal : NORMAL;
|
||||
float4 tangent : TANGENT;
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
|
|
@ -38,7 +39,9 @@ Shader "NLD_URP/NLD_Charactor_Dead"
|
|||
float2 uv : TEXCOORD0;
|
||||
float4 positionHCS : SV_POSITION;
|
||||
float3 normalWS : TEXCOORD1;
|
||||
float3 positionWS : TEXCOORD02;
|
||||
float3 positionWS : TEXCOORD2;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
TEXTURE2D(_MainTex);
|
||||
|
|
@ -81,7 +84,7 @@ Shader "NLD_URP/NLD_Charactor_Dead"
|
|||
o.positionHCS = TransformObjectToHClip(v.positionOS.xyz);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.normalWS = TransformObjectToWorldNormal(v.normal);
|
||||
o.positionWS = TransformObjectToWorld(v.positionOS);
|
||||
o.positionWS = TransformObjectToWorld(v.positionOS.xyz);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +140,7 @@ Shader "NLD_URP/NLD_Charactor_Dead"
|
|||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
v2f o = (v2f)0;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
|
|
|||
|
|
@ -83,6 +83,12 @@
|
|||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
inline float UnityGet2DClipping(float2 position, float4 clipRect)
|
||||
{
|
||||
float2 inside = step(clipRect.xy, position) * step(position, clipRect.zw);
|
||||
return inside.x * inside.y;
|
||||
}
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
|
|
@ -106,7 +112,7 @@
|
|||
float4 worldPosition : TEXCOORD1;
|
||||
|
||||
#if _CUSTOMDATA_ON
|
||||
float4 customData: TEXCOORD1;
|
||||
float4 customData: TEXCOORD2;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
|
|
@ -137,6 +143,10 @@
|
|||
o.uv = v.uv;
|
||||
o.vColor = v.color * _BaseColor * _BaseColorScale;
|
||||
|
||||
#if _CUSTOMDATA_ON
|
||||
o.customData = v.customData;
|
||||
#endif
|
||||
|
||||
// #### required for RectMask2D ####
|
||||
o.worldPosition = v.positionOS;
|
||||
return o;
|
||||
|
|
@ -148,16 +158,6 @@
|
|||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
|
||||
const float time = _TimeParameters.x;
|
||||
|
||||
// #### required for RectMask2D ####
|
||||
#ifdef UNITY_UI_CLIP_RECT
|
||||
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
|
||||
#endif
|
||||
|
||||
// #### required for Mask ####
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
clip (color.a - 0.001);
|
||||
#endif
|
||||
|
||||
// 主贴图UV流动
|
||||
float2 uv = TRANSFORM_TEX(IN.uv, _BaseMap);
|
||||
|
||||
|
|
@ -173,6 +173,16 @@
|
|||
float4 col = _BaseMap.Sample(sampler_BaseMap, uv);
|
||||
col *= IN.vColor;
|
||||
|
||||
// #### required for RectMask2D ####
|
||||
#ifdef UNITY_UI_CLIP_RECT
|
||||
col.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
|
||||
#endif
|
||||
|
||||
// #### required for Mask ####
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
clip (col.a - 0.001);
|
||||
#endif
|
||||
|
||||
if (col.a < _AlphaClip)
|
||||
{
|
||||
discard;
|
||||
|
|
|
|||
|
|
@ -87,6 +87,12 @@
|
|||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
inline float UnityGet2DClipping(float2 position, float4 clipRect)
|
||||
{
|
||||
float2 inside = step(clipRect.xy, position) * step(position, clipRect.zw);
|
||||
return inside.x * inside.y;
|
||||
}
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
|
|
@ -110,7 +116,7 @@
|
|||
float4 worldPosition : TEXCOORD1;
|
||||
|
||||
#if _CUSTOMDATA_ON
|
||||
float4 customData: TEXCOORD1;
|
||||
float4 customData: TEXCOORD2;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
|
|
@ -145,6 +151,10 @@
|
|||
o.uv = v.uv;
|
||||
o.vColor = v.color * _BaseColor * _BaseColorScale;
|
||||
|
||||
#if _CUSTOMDATA_ON
|
||||
o.customData = v.customData;
|
||||
#endif
|
||||
|
||||
// #### required for RectMask2D ####
|
||||
o.worldPosition = v.positionOS;
|
||||
return o;
|
||||
|
|
@ -156,16 +166,6 @@
|
|||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
|
||||
const float time = _TimeParameters.x;
|
||||
|
||||
// #### required for RectMask2D ####
|
||||
#ifdef UNITY_UI_CLIP_RECT
|
||||
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
|
||||
#endif
|
||||
|
||||
// #### required for Mask ####
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
clip (color.a - 0.001);
|
||||
#endif
|
||||
|
||||
// 主贴图UV流动
|
||||
float2 uv = TRANSFORM_TEX(IN.uv, _BaseMap);
|
||||
|
||||
|
|
@ -196,6 +196,16 @@
|
|||
float4 col = _BaseMap.Sample(sampler_BaseMap, uv);
|
||||
col *= IN.vColor;
|
||||
|
||||
// #### required for RectMask2D ####
|
||||
#ifdef UNITY_UI_CLIP_RECT
|
||||
col.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
|
||||
#endif
|
||||
|
||||
// #### required for Mask ####
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
clip (col.a - 0.001);
|
||||
#endif
|
||||
|
||||
if (col.a < _AlphaClip)
|
||||
{
|
||||
discard;
|
||||
|
|
|
|||
|
|
@ -94,6 +94,12 @@
|
|||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
inline float UnityGet2DClipping(float2 position, float4 clipRect)
|
||||
{
|
||||
float2 inside = step(clipRect.xy, position) * step(position, clipRect.zw);
|
||||
return inside.x * inside.y;
|
||||
}
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
|
|
@ -179,16 +185,6 @@
|
|||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
|
||||
const float time = _TimeParameters.x;
|
||||
|
||||
// #### required for RectMask2D ####
|
||||
#ifdef UNITY_UI_CLIP_RECT
|
||||
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
|
||||
#endif
|
||||
|
||||
// #### required for Mask ####
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
clip (color.a - 0.001);
|
||||
#endif
|
||||
|
||||
// 主贴图UV流动
|
||||
float2 uv = TRANSFORM_TEX(IN.uv, _BaseMap);
|
||||
|
||||
|
|
@ -231,6 +227,16 @@
|
|||
|
||||
#endif
|
||||
|
||||
// #### required for RectMask2D ####
|
||||
#ifdef UNITY_UI_CLIP_RECT
|
||||
col.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
|
||||
#endif
|
||||
|
||||
// #### required for Mask ####
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
clip (col.a - 0.001);
|
||||
#endif
|
||||
|
||||
if (col.a < _AlphaClip)
|
||||
{
|
||||
discard;
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@ internal class BatchBuild
|
|||
thinkingDataAppId = YooAssetBuildBase.thinkingDataAppId,
|
||||
thinkingDataServerUrl = YooAssetBuildBase.thinkingDataServerUrl,
|
||||
};
|
||||
PackDataInst.CreateResourceJson(info);
|
||||
|
||||
BuildTargetGroup currentTargetGroup =
|
||||
BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget);
|
||||
|
|
@ -139,12 +138,30 @@ internal class BatchBuild
|
|||
#if DEVELOPMENT_BUILD || DEBUG
|
||||
isDebugBuild = true;
|
||||
#endif
|
||||
ExtBuildInfoHelper.CreateFirstExtBuildInfo(info.buildTicks, info.workSpace, info.version, info.buildCode,
|
||||
isDebugBuild, defines);
|
||||
var extBuildInfo = ExtBuildInfoHelper.PrepareFullBuildInfo(
|
||||
info.buildTicks,
|
||||
info.workSpace,
|
||||
info.version,
|
||||
info.buildCode,
|
||||
isDebugBuild,
|
||||
defines,
|
||||
YooAssetBuildBase.ShouldPackDefaultRes(),
|
||||
YooAssetBuildBase.ShouldPackDllRes(),
|
||||
YooAssetBuildBase.ShouldPackConfigRes());
|
||||
string serverComposeVersion = extBuildInfo.ComposeResVersion();
|
||||
string clientLocalDeclaredVersion = extBuildInfo.ComposeClientLocalResVersion(
|
||||
YooAssetBuildBase.ShouldPackDefaultRes(),
|
||||
YooAssetBuildBase.ShouldPackDllRes(),
|
||||
YooAssetBuildBase.ShouldPackConfigRes());
|
||||
Debug.Log($"[Build]AOT本地资源版本声明 packDefaultRes={YooAssetBuildBase.ShouldPackDefaultRes()}, packDllRes={YooAssetBuildBase.ShouldPackDllRes()}, packConfigRes={YooAssetBuildBase.ShouldPackConfigRes()}, serverComposeVersion={serverComposeVersion}, clientLocalDeclaredVersion={clientLocalDeclaredVersion}");
|
||||
info.localFullVersion = clientLocalDeclaredVersion;
|
||||
PackDataInst.CreateResourceJson(info);
|
||||
|
||||
BuildLauncher.SetEnableHotUpdate(enableHotUpdate);
|
||||
if (enableHotUpdate)
|
||||
if (YooAssetBuildBase.ShouldBuildHotUpdateDll())
|
||||
BuildLauncher.BuildHotUpdateDlls();
|
||||
else if (enableHotUpdate)
|
||||
Debug.Log("检测到 packDllRes=false,已跳过热更新 DLL 重编步骤,将沿用上次已生成的 DLL 资源。");
|
||||
|
||||
YooAssetBuildBase.BuildContentAndPlayer();
|
||||
|
||||
|
|
@ -228,9 +245,25 @@ internal class BatchBuild
|
|||
ExtBuildInfoHelper.VertifyExitBuildInfo(YooAssetBuildBase.workSpace, YooAssetBuildBase.appVersion);
|
||||
DebugUtil.Log($"验证ExBuildInfo完成:{DateTime.Now}");
|
||||
|
||||
BuildTargetGroup currentTargetGroup = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget);
|
||||
string defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(currentTargetGroup);
|
||||
|
||||
ExtBuildInfoHelper.PrepareHotUpdateBuildInfo(
|
||||
YooAssetBuildBase.workSpace,
|
||||
YooAssetBuildBase.appVersion,
|
||||
#if DEVELOPMENT_BUILD || DEBUG
|
||||
true,
|
||||
#else
|
||||
false,
|
||||
#endif
|
||||
defines,
|
||||
YooAssetBuildBase.ShouldPackDefaultRes(),
|
||||
YooAssetBuildBase.ShouldPackDllRes(),
|
||||
YooAssetBuildBase.ShouldPackConfigRes());
|
||||
|
||||
var skipCheck = true;
|
||||
|
||||
if (enableHotUpdate)
|
||||
if (YooAssetBuildBase.ShouldBuildHotUpdateDll())
|
||||
{
|
||||
if (skipCheck)
|
||||
{
|
||||
|
|
@ -255,22 +288,15 @@ internal class BatchBuild
|
|||
}
|
||||
|
||||
}
|
||||
else if (enableHotUpdate)
|
||||
{
|
||||
Debug.Log("检测到 packDllRes=false,已跳过热更新 DLL 重编步骤,将沿用上次已生成的 DLL 资源。");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("未开启热更");
|
||||
}
|
||||
|
||||
BuildTargetGroup currentTargetGroup = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget);
|
||||
string defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(currentTargetGroup);
|
||||
|
||||
// 写入打包信息到Yoo_Build_Cache
|
||||
#if DEVELOPMENT_BUILD || DEBUG
|
||||
ExtBuildInfoHelper.UpdateExtBuildInfo(YooAssetBuildBase.workSpace, YooAssetBuildBase.appVersion, true,
|
||||
defines);
|
||||
#else
|
||||
ExtBuildInfoHelper.UpdateExtBuildInfo(YooAssetBuildBase.workSpace, YooAssetBuildBase.appVersion, false, defines);
|
||||
#endif
|
||||
|
||||
DebugUtil.Log($"开始打包热更资源:{DateTime.Now}");
|
||||
bool result = YooAssetBuildBase.BuildOnlyResUpdate();
|
||||
DebugUtil.Log($"打包热更资源完成:{DateTime.Now}");
|
||||
|
|
@ -397,9 +423,9 @@ internal class BatchBuild
|
|||
/// <summary>
|
||||
/// 自动发布debug loginKey
|
||||
/// </summary>
|
||||
public static void PostDebugSendKey()
|
||||
public static void PostDebugSendKey(string sendVersion = null)
|
||||
{
|
||||
string version = PackDataInst.Inst.localInfo.version;
|
||||
string version = string.IsNullOrEmpty(sendVersion) ? PackDataInst.Inst.localInfo.version : sendVersion;
|
||||
string tag = HashUtils.MD5(version);
|
||||
|
||||
// 服务端签名原文包含 platform="0",按字母升序排列
|
||||
|
|
@ -423,53 +449,29 @@ internal class BatchBuild
|
|||
HttpHelper.PostAsync(url, body, dicHeadData).Forget();
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[UnityEditor.MenuItem("Test/Build/测试 Version (version=1.0.0)")]
|
||||
public static void TestPostDebugSendKey()
|
||||
/// <summary>
|
||||
/// batchmode 下等待 sendVersion 请求完成,并显式退出 Unity,避免 Jenkins 长时间挂起。
|
||||
/// </summary>
|
||||
public static void PostDebugSendKeyBatch()
|
||||
{
|
||||
const string testVersion = "1.0.0";
|
||||
string loginKey = HashUtils.MD5(testVersion);
|
||||
string timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
|
||||
|
||||
// 服务端签名算法:MD5(排序参数字符串) + httpKey 再做 SHA256(64位)
|
||||
// 即 PostHeader.PostHeaderInfo 内部已实现的流程,参数需包含 platform=""
|
||||
Dictionary<string, string> signParams = new Dictionary<string, string>
|
||||
{
|
||||
{ "plaintext", testVersion },
|
||||
{ "platform", "" },
|
||||
{ "tag", loginKey },
|
||||
{ "timestamp", timestamp }
|
||||
};
|
||||
|
||||
var sortedKeys = signParams.Keys.OrderBy(k => k).ToList();
|
||||
string sortParamsStr = string.Join("&", sortedKeys.Select(k => $"{k}={signParams[k]}"));
|
||||
Debug.Log($"[TestPostLoginKey] 签名原文: {sortParamsStr}");
|
||||
|
||||
// 使用 PostHeaderInfo 生成 64 位 signature(MD5 + httpKey + SHA256)
|
||||
Dictionary<string, string> headData = PostHeader.PostHeaderInfo(signParams);
|
||||
Debug.Log($"[TestPostLoginKey] signature: {headData["signature"]}");
|
||||
|
||||
LoginKeyData loginKeyData = new()
|
||||
{
|
||||
plaintext = testVersion,
|
||||
tag = loginKey,
|
||||
};
|
||||
string bodyJson = JsonUtility.ToJson(loginKeyData);
|
||||
Debug.Log($"[TestPostLoginKey] 请求 Body: {bodyJson}");
|
||||
|
||||
string testUrl = $"{Dev_PostUrl}version";
|
||||
try
|
||||
{
|
||||
Debug.Log($"[TestPostLoginKey] URL: {testUrl}");
|
||||
HttpHelper.PostAsync(testUrl, loginKeyData, headData).Forget();
|
||||
PostDebugSendKey();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"[TestPostLoginKey Exception]:{e.Message} \r\n {e.StackTrace}");
|
||||
throw;
|
||||
Debug.LogError($"[PostDebugSendKeyBatch Exception]:{e.Message} \r\n {e.StackTrace}");
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[UnityEditor.MenuItem("Test/Build/手动发布LoginKey")]
|
||||
public static void TestPostDebugSendKey()
|
||||
{
|
||||
const string testVersion = "0.9.0";
|
||||
PostDebugSendKey(testVersion);
|
||||
}
|
||||
|
||||
[UnityEditor.MenuItem("Test/Build/测试 SendVersion (version=1.0.0)")]
|
||||
public static void TestPostSendVersion()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit a6b6cc998fb582d2bf4af0958c02d9ad8fcd2f73
|
||||
Subproject commit efe2e69b0b56c70f633216ab0fca75ffed8a529e
|
||||
|
|
@ -906,7 +906,7 @@ RectTransform:
|
|||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 950, y: -531}
|
||||
m_SizeDelta: {x: 1000, y: 35.3}
|
||||
m_SizeDelta: {x: 1500, y: 35.3}
|
||||
m_Pivot: {x: 1, y: 0}
|
||||
--- !u!114 &1084087109
|
||||
MonoBehaviour:
|
||||
|
|
@ -972,7 +972,7 @@ MonoBehaviour:
|
|||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 1
|
||||
m_enableWordWrapping: 0
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
|
|
@ -1269,7 +1269,7 @@ RectTransform:
|
|||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 950, y: -501.0017}
|
||||
m_SizeDelta: {x: 1000, y: 35.3}
|
||||
m_SizeDelta: {x: 1500, y: 35.3}
|
||||
m_Pivot: {x: 1, y: 0}
|
||||
--- !u!114 &1202956216
|
||||
MonoBehaviour:
|
||||
|
|
@ -1335,7 +1335,7 @@ MonoBehaviour:
|
|||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 1
|
||||
m_enableWordWrapping: 0
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,552 @@
|
|||
// 对应管线任务参数
|
||||
def PLATFORM_PARAM = "Android"
|
||||
def PROFILE_PARAM = "Debug"
|
||||
def APK_NAME = "NLDBuild.apk"
|
||||
|
||||
// 构建时候的参数
|
||||
def CHANNEL_PARAM = params.Channel
|
||||
def DEBUGBUILD_PARAM = params.DebugBuild
|
||||
def HOTUPDATE_PARAM = true
|
||||
def AAB_PARAM = params.AAB
|
||||
def OBFUZ = params.Obfuz
|
||||
def DEV_PARAM = true
|
||||
def ANDROIDKEYSTORE = "/Users/mayuanzheng/key/phxh_android.keystore"
|
||||
def ANDROIDKEYALIAS = "avery"
|
||||
def UPLOAD_SYMBOL = params.UploadSymbol
|
||||
def PACKAGE_HARDENING = params.PackageHardening
|
||||
def PackDefaultRes = params.PackDefaultRes
|
||||
def PackDllRes = params.PackDllRes
|
||||
def PackConfigRes = params.PackConfigRes
|
||||
|
||||
// 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(){
|
||||
if('Dev' == params.Channel)
|
||||
return 'feature/split_build';
|
||||
else
|
||||
return params.Channel;
|
||||
}
|
||||
|
||||
def CheckRemoteBranchExists(repoUrl, branchName) {
|
||||
def result = sh(
|
||||
script: "git ls-remote --heads ${repoUrl} refs/heads/${branchName}",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
if (result == '') {
|
||||
echo "警告: 远程分支 ${branchName} 不存在于 ${repoUrl}, 可以在GetRemote函数中添加映射, 或者检查分支名称是否正确"
|
||||
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}】NLDClient 远程分支 ${remote} 不存在"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '拉最新工程' stage")
|
||||
}
|
||||
|
||||
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}】GamePlay 远程分支 ${branch} 不存在"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '拉最新工程' stage")
|
||||
}
|
||||
|
||||
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.sh $WORKSPACE/Tool/build_tools/"
|
||||
} 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} ${OBFUZ}", 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 {
|
||||
script {
|
||||
try {
|
||||
def channelYamlPath = "${WORKSPACE}/Tool/Channels/${CHANNEL_PARAM}/ChannelSetting.yaml"
|
||||
def versionCodeScript = "${WORKSPACE}/Tool/py_tools/version_code_manager.py"
|
||||
|
||||
// 使用 python3 执行脚本,读取输出的 export 语句
|
||||
def exportLines = sh(
|
||||
script: "python3 '${versionCodeScript}' '${CHANNEL_PARAM}' '${channelYamlPath}'",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
echo "[BuildCode] 脚本输出: ${exportLines}"
|
||||
|
||||
// 解析 NLD_CURRENT_VERSION_CODE=xxx 行
|
||||
def versionCodeLine = exportLines.split('\n').find { it.contains('NLD_CURRENT_VERSION_CODE') }
|
||||
if (versionCodeLine) {
|
||||
def versionCode = versionCodeLine.replaceAll('export NLD_CURRENT_VERSION_CODE=', '').trim()
|
||||
echo "[BuildCode] 当前渠道=${CHANNEL_PARAM},versionCode=${versionCode}"
|
||||
// 设置环境变量,供后续 stage 中的 shell 使用
|
||||
def safeChannel = CHANNEL_PARAM.replace('-', '_').replace(' ', '_')
|
||||
env."NLD_CLIENT_${safeChannel}_VERSION_CODE" = versionCode
|
||||
env.NLD_CURRENT_VERSION_CODE = versionCode
|
||||
} else {
|
||||
echo "[BuildCode] 警告: 未能解析 NLD_CURRENT_VERSION_CODE,将使用 YAML 中的 BuildCode"
|
||||
}
|
||||
} catch (err) {
|
||||
echo "[BuildCode] 警告: 获取构建版本号失败: ${err},将使用 YAML 中的 BuildCode"
|
||||
// 不中断流程,降级为使用 YAML 默认值
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('打包') {
|
||||
steps {
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/build_unity.sh"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/hot_update.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.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_unity.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 {
|
||||
if (PACKAGE_HARDENING == true) {
|
||||
// 只在构建完整应用时进行加密
|
||||
echo "params.Build_InitApp: ${params.Build_InitApp}"
|
||||
echo "WORKSPACE: ${WORKSPACE}"
|
||||
if (params.Build_InitApp == true) {
|
||||
try {
|
||||
// 确保CHANNEL_PARAM是正确的渠道名称
|
||||
def actualChannel = CHANNEL_PARAM ?: "Dev"
|
||||
echo "Actual channel: ${actualChannel}"
|
||||
|
||||
// 构建YAML文件路径,添加备选路径
|
||||
def playersettings = "${WORKSPACE}/Tool/Channels/${actualChannel}/ChannelSetting.yaml"
|
||||
def fallbackPlayersettings = "d:/UnityProjects/NLDClient/Tool/Channels/${actualChannel}/ChannelSetting.yaml"
|
||||
|
||||
// 选择存在的YAML文件路径
|
||||
def finalPlayersettings
|
||||
if (fileExists(playersettings)) {
|
||||
finalPlayersettings = playersettings
|
||||
} else if (fileExists(fallbackPlayersettings)) {
|
||||
finalPlayersettings = fallbackPlayersettings
|
||||
} else {
|
||||
echo "Warning: Both YAML paths not found. Using default: ${playersettings}"
|
||||
finalPlayersettings = playersettings
|
||||
}
|
||||
|
||||
// 添加调试信息
|
||||
echo "playersettings path: ${finalPlayersettings}"
|
||||
echo "File exists: ${fileExists(finalPlayersettings)}"
|
||||
|
||||
// 读取YAML文件,添加错误处理
|
||||
def cfg
|
||||
try {
|
||||
cfg = readYaml(file: finalPlayersettings)
|
||||
echo "YAML content: ${cfg}"
|
||||
} catch (yamlErr) {
|
||||
echo "Error reading YAML: ${yamlErr.getMessage()}"
|
||||
// 尝试使用另一种方式读取YAML
|
||||
def yamlContent = readFile(finalPlayersettings)
|
||||
echo "Raw YAML content: ${yamlContent}"
|
||||
error "Failed to parse YAML file"
|
||||
}
|
||||
|
||||
// 读取加密相关配置
|
||||
def encryptConfig = cfg?.Encryption
|
||||
echo "encryptConfig: ${encryptConfig}"
|
||||
if (encryptConfig) {
|
||||
def apiUrl = (encryptConfig?.ApiUrl ?: '').trim()
|
||||
def strategyName = (encryptConfig?.StrategyName ?: '').trim()
|
||||
def username = (encryptConfig?.Username ?: '').trim()
|
||||
def password = (encryptConfig?.Password ?: '').trim()
|
||||
def toolPath = (encryptConfig?.ToolPath ?: '').trim()
|
||||
def needSign = (encryptConfig?.NeedSign ?: true)
|
||||
def signName = (encryptConfig?.SignName ?: '').trim()
|
||||
def signVersion = (encryptConfig?.SignVersion ?: 4)
|
||||
def retryCount = (encryptConfig?.RetryCount ?: 3)
|
||||
|
||||
// 构建APK路径
|
||||
def apkPath = "$WORKSPACE/Builds/$CHANNEL_PARAM/$PLATFORM_PARAM/$VERSION_PARAM/$APK_NAME"
|
||||
def outputDir = "$WORKSPACE/Builds/$CHANNEL_PARAM/$PLATFORM_PARAM/$VERSION_PARAM"
|
||||
|
||||
// 替换WORKSPACE变量
|
||||
toolPath = toolPath.replace('${WORKSPACE}', WORKSPACE)
|
||||
|
||||
// 构建加密命令
|
||||
def encryptCmd = "java -jar '${toolPath}' -t apk -u '${apiUrl}' -r '${username}' -w '${password}' -k '${apkPath}' -s '${strategyName}' -d '${outputDir}' -n '${APK_NAME}' -y ${retryCount}"
|
||||
|
||||
// 添加签名参数
|
||||
if (needSign) {
|
||||
encryptCmd += " -i true -g '${signName}' -v ${signVersion}"
|
||||
}
|
||||
|
||||
echo "开始加密应用..."
|
||||
echo "APK路径: ${apkPath}"
|
||||
echo "加密策略: ${strategyName}"
|
||||
echo "执行命令: ${encryptCmd}"
|
||||
|
||||
// 执行加密命令
|
||||
def encryptResult = sh(script: encryptCmd, returnStatus: true, returnStdout: false)
|
||||
|
||||
if (encryptResult != 0) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】应用加密失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '加密应用' stage")
|
||||
} else {
|
||||
echo "应用加密成功!加密后的APK已覆盖原APK。"
|
||||
}
|
||||
} else {
|
||||
echo "警告:未在渠道配置中找到加密相关配置,跳过加密步骤。"
|
||||
}
|
||||
} catch (err) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】应用加密过程中发生异常: ${err.getMessage()}"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '加密应用' stage")
|
||||
}
|
||||
} else {
|
||||
echo "增量更新模式,跳过加密步骤。"
|
||||
}
|
||||
} else {
|
||||
echo "PackageHardening 未启用,跳过加密步骤。"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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.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)
|
||||
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.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)
|
||||
if(upload_result != 0)
|
||||
{
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】上传资源失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '上传资源' stage")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/*stage('上传apk') {
|
||||
steps {
|
||||
script {
|
||||
// 增量更新不需要上传包体
|
||||
if (params.Build_InitApp == true){
|
||||
def apk_path="$WORKSPACE/Builds/$CHANNEL_PARAM/$PLATFORM_PARAM/$VERSION_PARAM/$APK_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 ${apk_path} ${upload_path} ${ASSETS_END_POINT_PARAM}", returnStatus: true, returnStdout: false)
|
||||
upload_result_with_version=sh(script: "$WORKSPACE/Tool/build_tools/upload_oss.sh ${apk_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}】上传APK失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '上传apk' 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.sh"
|
||||
def result=0
|
||||
result = sh(script: "$WORKSPACE/Tool/build_tools/debug_send_version.sh")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('归档') {
|
||||
steps {
|
||||
script {
|
||||
try{
|
||||
archiveArtifacts artifacts: "$log_path" , followSymlinks: false
|
||||
if (params.Build_InitApp == true)
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/*.apk" , followSymlinks: false
|
||||
}
|
||||
catch(Exception e){
|
||||
SendMessageToWechat(e.message + "\r\n" + e.stackTrace)
|
||||
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 dba595d9c6e380b32afb9b6032380616d6df7e87
|
||||
Subproject commit 30d4c15d29e64de4184053eed464170ef75d292b
|
||||
Loading…
Reference in New Issue