update: 针对 2021.3.41 优化打包管线和配置

Signed-off-by: huyufei <yufei.hu@castbox.fm>
dev
胡宇飞 2024-07-30 15:54:22 +08:00
parent a67185679b
commit 7e499aa26c
1 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,5 @@
namespace Guru.Editor
{
using System.Linq;
@ -21,6 +23,10 @@ namespace Guru.Editor
private const string GuruKeystorePass = "guru0622";
private const string GuruAliasName = "guru";
private const string GuruAliasPass = "guru0622";
private const string UnityGradlePath_2021_3_41 =
"/Applications/Unity/Hub/Editor/2021.3.41f1/PlaybackEngines/AndroidPlayer/Tools/gradle";
private static string GuruKeystorePath => Application.dataPath + $"/Plugins/Android/{GuruKeystoreName}";
private static string ProguardName => "proguard-user.txt";
private static string ProguardPath => Application.dataPath + $"/Plugins/Android/{ProguardName}";
@ -70,6 +76,8 @@ namespace Guru.Editor
SwitchBuildPlatform(BuildTarget.Android);
// 打包通用设置
ChangeBuildPlayerCommonSetting(buildParam, BuildTargetGroup.Android);
// Set GradlePath
SetGradlePath();
var isDebug = !buildParam.IsBuildRelease;
var useMinify = buildParam.AndroidUseMinify;
@ -141,7 +149,18 @@ namespace Guru.Editor
return apkPath;
}
/// <summary>
private static void SetGradlePath()
{
#if UNITY_ANDROID && UNITY_2021_3_41
if (Directory.Exists(UnityGradlePath_2021_3_41))
{
UnityEditor.Android.AndroidExternalToolsSettings.gradlePath = UnityGradlePath_2021_3_41;
}
#endif
}
/// <summary>
/// 部署 Guru 专用的 Keystore
/// </summary>
private static bool DeployAndroidKeystore()