JD2022-TU1/main/tools/apps/TeaBox/Script/Build/Version/GetVersionIdFromSQLMacros.cs

43 lines
1.6 KiB
C#

using System.ComponentModel;
using System.IO;
using JD.Core.ProjectManaging;
using TeaBox.Macros;
namespace TeaBox.BuildVersion
{
[Module(Icon = "versioning")]
[DisplayName("Build (Version from SQL)")]
public static class GetVersionIdFromSQLMacros
{
[DisplayName("Get version Id from SQL")]
[Macro(ThreadAffinity.ExecuteAsync, Icon = "versioning.png")]
[Browsable(true)]
public static string GetVersionIdFromSQL(
IExecutionContext context,
[DefaultValue(Platform.NX)] Platform platform,
[DefaultValue("")] string codeChangelist,
[DefaultValue("")] string dataChangelist,
string tag,
[DefaultValue("JD2022")] string jdVersion)
{
// Override codeChangelist value with the one given instead of using the one of the engine found in the data/engine folder
if (string.IsNullOrEmpty(codeChangelist))
{
codeChangelist = PackageUtilities.GetChangelistCode(Path.Combine(EnginePath.Value, "engine.dat"));
context.LogMessage($"Code changelist found is : {codeChangelist}");
}
VersionUtilities.JdVersion = string.IsNullOrEmpty(jdVersion) ? UAFConstants.GameName : jdVersion;
VersionUtilities.Context = context;
VersionUtilities.Platform = platform;
VersionUtilities.CodeChangelist = codeChangelist;
VersionUtilities.DataChangelist = dataChangelist;
VersionUtilities.Tag = tag;
var value = VersionUtilities.GetVersionIdFromSQL();
return value;
}
}
}