Add git hash/scm version properties to DalamudVersionInfo

This commit is contained in:
Critical Impact 2025-12-18 22:01:49 +10:00
parent 77b6d71855
commit bd87a3d251
3 changed files with 29 additions and 2 deletions

View file

@ -220,7 +220,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa
/// <inheritdoc/>
public IDalamudVersionInfo GetDalamudVersion()
{
return new DalamudVersionInfo(Versioning.GetAssemblyVersionParsed(), Versioning.GetActiveTrack());
return new DalamudVersionInfo(Versioning.GetAssemblyVersionParsed(), Versioning.GetActiveTrack(), Versioning.GetGitHash(), Versioning.GetGitHashClientStructs(), Versioning.GetScmVersion());
}
#region IPC

View file

@ -1,11 +1,20 @@
namespace Dalamud.Plugin.VersionInfo;
/// <inheritdoc />
internal class DalamudVersionInfo(Version version, string? track) : IDalamudVersionInfo
internal class DalamudVersionInfo(Version version, string? track, string? gitHash, string? gitHashClientStructs, string? scmVersion) : IDalamudVersionInfo
{
/// <inheritdoc/>
public Version Version { get; } = version;
/// <inheritdoc/>
public string? BetaTrack { get; } = track;
/// <inheritdoc/>
public string? GitHash { get; } = gitHash;
/// <inheritdoc/>
public string? GitHashClientStructs { get; } = gitHashClientStructs;
/// <inheritdoc/>
public string? ScmVersion { get; } = scmVersion;
}

View file

@ -16,4 +16,22 @@ public interface IDalamudVersionInfo
/// Null if this build wasn't launched from XIVLauncher.
/// </summary>
string? BetaTrack { get; }
/// <summary>
/// Gets the git commit hash value from the assembly or null if it cannot be found. Will be null for Debug builds,
/// and will be suffixed with `-dirty` if in release with pending changes.
/// </summary>
string? GitHash { get; }
/// <summary>
/// Gets the git hash value from the assembly or null if it cannot be found.
/// </summary>
string? GitHashClientStructs { get; }
/// <summary>
/// Gets the SCM Version from the assembly, or null if it cannot be found. The value returned will generally be
/// the <c>git describe</c> output for this build, which will be a raw version if this is a stable build or an
/// appropriately-annotated version if this is *not* stable. Local builds will return a `Local Build` text string.
/// </summary>
string? ScmVersion { get; }
}