update: 更新 JenkinsHelper
parent
f0a64b1e2c
commit
ba059e9995
|
|
@ -15,8 +15,8 @@ namespace Guru.Editor
|
|||
public const string TargetNameIOS = "iOS";
|
||||
|
||||
//------------ Basic ----------------
|
||||
public bool IsBuildRelease; // 是否构建发布包体
|
||||
public bool IsBuildShowLog; // 是否显示日志
|
||||
public bool IsBuildRelease = false; // 是否构建发布包体
|
||||
public bool IsBuildShowLog = false; // 是否显示日志
|
||||
public AppBuilderType BuilderType; // 构建类型
|
||||
public string BuildVersion = ""; // 构建版本号, 填写后会依据此版本设置应用的 Version
|
||||
public bool AutoSetBuildNumber = true; // 自动设置构建号, 可参考 Guru的SDK 接入说明文档
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
|
||||
|
||||
namespace Guru.Editor
|
||||
{
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
public class JenkinsAgent
|
||||
{
|
||||
|
||||
|
||||
public static AppBuildParam ParseJenkinsBuildParam(string[] commandlineArgs)
|
||||
{
|
||||
int len = commandlineArgs.Length;
|
||||
|
||||
Debug.Log($"------------ Jenkins set commands: {len} ------------");
|
||||
|
||||
|
||||
string p = "";
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
p = commandlineArgs[i];
|
||||
Debug.Log($"--- [{i}]: {p}");
|
||||
|
||||
if (p.StartsWith("+args"))
|
||||
{
|
||||
Debug.Log($"--- find param: {p}");
|
||||
var args = p.Split('-');
|
||||
if (args.Length > 1)
|
||||
{
|
||||
Debug.Log($"--- ENV: {args[1]}");
|
||||
}
|
||||
if (args.Length > 2)
|
||||
{
|
||||
Debug.Log($"--- VERSION: {args[2]}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var buildParam = new AppBuildParam();
|
||||
return buildParam;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void BuildAndroid()
|
||||
{
|
||||
AppBuildParam buildParam = ParseJenkinsBuildParam(Environment.GetCommandLineArgs());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
namespace Guru.Editor
|
||||
{
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
|
||||
public class JenkinsHelper
|
||||
{
|
||||
public const string DefaultArgsTag = "+args";
|
||||
|
||||
public static AppBuildParam ParseJenkinsBuildParam(string[] commandlineArgs, string argsTag = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(argsTag)) argsTag = DefaultArgsTag;
|
||||
int len = commandlineArgs.Length;
|
||||
|
||||
Debug.Log($"------------ Jenkins set commands: {len} ------------");
|
||||
|
||||
var buildParam = new AppBuildParam()
|
||||
{
|
||||
BuilderType = AppBuilderType.Jenkins,
|
||||
TargetName = "Android",
|
||||
IsBuildAAB = false,
|
||||
IsBuildSymbols = false,
|
||||
AutoPublish = false,
|
||||
};
|
||||
|
||||
string p = "";
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
p = commandlineArgs[i];
|
||||
// Debug.Log($"--- [{i}]: {p}");
|
||||
|
||||
if (p.StartsWith(argsTag))
|
||||
{
|
||||
// Debug.Log($"--- find param: {p}");
|
||||
var args = p.Split('-').ToList();
|
||||
if (args.Count > 1)
|
||||
{
|
||||
// Debug.Log($"--- ENV: {args[1]}");
|
||||
if (args[1].ToUpper() == "RELEASE")
|
||||
{
|
||||
buildParam.IsBuildRelease = true;
|
||||
buildParam.IsBuildShowLog = false;
|
||||
buildParam.IsBuildSymbols = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
buildParam.IsBuildRelease = false;
|
||||
buildParam.IsBuildShowLog = true;
|
||||
buildParam.IsBuildSymbols = false;
|
||||
}
|
||||
}
|
||||
if (args.Count > 2)
|
||||
{
|
||||
// Debug.Log($"--- VERSION: {args[2]}");
|
||||
buildParam.BuildVersion = args[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return buildParam;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取构建参数
|
||||
/// </summary>
|
||||
/// <param name="argsTag"></param>
|
||||
/// <returns></returns>
|
||||
public static AppBuildParam GetBuildParams(string argsTag = "")
|
||||
{
|
||||
return ParseJenkinsBuildParam(Environment.GetCommandLineArgs(), argsTag);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue