diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 73fe25562..d3d225293 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -137,6 +137,7 @@ jobs:
$newVersion = [System.IO.File]::ReadAllText("$(Get-Location)\scratch\TEMP_gitver.txt")
$revision = [System.IO.File]::ReadAllText("$(Get-Location)\scratch\revision.txt")
+ $commitHash = [System.IO.File]::ReadAllText("$(Get-Location)\scratch\commit_hash.txt")
Remove-Item -Force -Recurse .\scratch
if (Test-Path -Path $branchName) {
@@ -147,7 +148,7 @@ jobs:
} else {
Move-Item -Force ".\canary.zip" ".\${branchName}\latest.zip"
$versionData.AssemblyVersion = $newVersion
- $versionData | add-member -Force -Name "GitSha" $newVersion -MemberType NoteProperty
+ $versionData | add-member -Force -Name "GitSha" $commitHash -MemberType NoteProperty
$versionData | add-member -Force -Name "Revision" $revision -MemberType NoteProperty
$versionData | ConvertTo-Json -Compress | Out-File ".\${branchName}\version"
}
diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj
index dfaab870c..a89ba992e 100644
--- a/Dalamud/Dalamud.csproj
+++ b/Dalamud/Dalamud.csproj
@@ -124,57 +124,45 @@
$(OutputPath)TEMP_gitver.txt
+ $(OutputPath)commit_hash.txt
$(OutputPath)revision.txt
-
+
-
-
-
- $([System.Text.RegularExpressions.Regex]::Replace($(DalamudGitCommitCount), @"\t|\n|\r", ""))
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
+
- $([System.Text.RegularExpressions.Regex]::Replace($(DalamudGitDescribeOutput), @"\t|\n|\r", ""))
- $([System.Text.RegularExpressions.Regex]::Replace($(ClientStructsGitDescribeOutput), @"\t|\n|\r", ""))
+ $([System.Text.RegularExpressions.Regex]::Replace($(DalamudGitCommitCount), @"\t|\n|\r", ""))
+ $([System.Text.RegularExpressions.Regex]::Replace($(DalamudGitCommitHash), @"\t|\n|\r", ""))
+ $([System.Text.RegularExpressions.Regex]::Replace($(DalamudGitDescribeOutput), @"\t|\n|\r", ""))
+ $([System.Text.RegularExpressions.Regex]::Replace($(ClientStructsGitDescribeOutput), @"\t|\n|\r", ""))
-
-
-
-
-
-
-
- Local build at $([System.DateTime]::Now.ToString(yyyy-MM-dd HH:mm:ss))
- $(LocalBuildText)
- ???
-
-
-
-
+
+
+
-
+
+
+
+ Local build at $([System.DateTime]::Now.ToString(yyyy-MM-dd HH:mm:ss))
+ ???
+
+
+
+
$(IntermediateOutputPath)CustomAssemblyInfo.cs
@@ -185,21 +173,21 @@
-
- <_Parameter1>GitHash
- <_Parameter2>$(BuildHash)
+
+ <_Parameter1>SCMVersion
+ <_Parameter2>$(SCMVersion)
-
+
<_Parameter1>GitCommitCount
<_Parameter2>$(CommitCount)
-
+
<_Parameter1>GitHashClientStructs
- <_Parameter2>$(BuildHashClientStructs)
+ <_Parameter2>$(CommitHashClientStructs)
-
- <_Parameter1>FullGitHash
- <_Parameter2>$(DalamudFullGitCommitHash)
+
+ <_Parameter1>GitHash
+ <_Parameter2>$(CommitHash)
diff --git a/Dalamud/EntryPoint.cs b/Dalamud/EntryPoint.cs
index fcf33fe28..512acd4cc 100644
--- a/Dalamud/EntryPoint.cs
+++ b/Dalamud/EntryPoint.cs
@@ -187,7 +187,7 @@ public sealed class EntryPoint
var dalamud = new Dalamud(info, fs, configuration, mainThreadContinueEvent);
Log.Information("This is Dalamud - Core: {GitHash}, CS: {CsGitHash} [{CsVersion}]",
- Util.GetGitHash(),
+ Util.GetScmVersion(),
Util.GetGitHashClientStructs(),
FFXIVClientStructs.ThisAssembly.Git.Commits);
diff --git a/Dalamud/Interface/Internal/DalamudCommands.cs b/Dalamud/Interface/Internal/DalamudCommands.cs
index cc63d887f..fb64ad979 100644
--- a/Dalamud/Interface/Internal/DalamudCommands.cs
+++ b/Dalamud/Interface/Internal/DalamudCommands.cs
@@ -329,7 +329,7 @@ internal class DalamudCommands : IServiceType
chatGui.Print(new SeStringBuilder()
.AddItalics("Dalamud:")
- .AddText($" D{Util.AssemblyVersion}({Util.GetGitHash()}")
+ .AddText($" {Util.GetScmVersion()}")
.Build());
chatGui.Print(new SeStringBuilder()
diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs
index c88246f51..793dfddd9 100644
--- a/Dalamud/Interface/Internal/DalamudInterface.cs
+++ b/Dalamud/Interface/Internal/DalamudInterface.cs
@@ -841,10 +841,9 @@ internal class DalamudInterface : IInternalDisposableService
{
this.OpenBranchSwitcher();
}
-
- ImGui.MenuItem(Util.AssemblyVersion, false);
+
ImGui.MenuItem(this.dalamud.StartInfo.GameVersion?.ToString() ?? "Unknown version", false);
- ImGui.MenuItem($"D: {Util.GetGitHash()}[{Util.GetGitCommitCount()}] CS: {Util.GetGitHashClientStructs()}[{FFXIVClientStructs.ThisAssembly.Git.Commits}]", false);
+ ImGui.MenuItem($"D: {Util.GetScmVersion()} CS: {Util.GetGitHashClientStructs()}[{FFXIVClientStructs.ThisAssembly.Git.Commits}]", false);
ImGui.MenuItem($"CLR: {Environment.Version}", false);
ImGui.EndMenu();
@@ -1043,7 +1042,7 @@ internal class DalamudInterface : IInternalDisposableService
{
ImGui.PushFont(InterfaceManager.MonoFont);
- ImGui.BeginMenu($"{Util.GetGitHash()}({Util.GetGitCommitCount()})", false);
+ ImGui.BeginMenu(Util.GetScmVersion(), false);
ImGui.BeginMenu(this.FrameCount.ToString("000000"), false);
ImGui.BeginMenu(ImGui.GetIO().Framerate.ToString("000"), false);
ImGui.BeginMenu($"W:{Util.FormatBytes(GC.GetTotalMemory(false))}", false);
diff --git a/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs b/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs
index 67685f38a..d42dc3669 100644
--- a/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs
@@ -360,7 +360,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
{
case State.WindowFadeIn:
case State.ExplainerIntro:
- ImGui.TextWrapped($"Welcome to Dalamud v{Util.AssemblyVersion}!");
+ ImGui.TextWrapped($"Welcome to Dalamud v{Util.GetScmVersion()}!");
ImGuiHelpers.ScaledDummy(5);
ImGui.TextWrapped(ChangeLog);
ImGuiHelpers.ScaledDummy(5);
diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs
index 4a936a795..40753a20d 100644
--- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs
@@ -305,7 +305,7 @@ internal class PluginInstallerWindow : Window, IDisposable
return;
var versionInfo = t.Result;
- if (versionInfo.AssemblyVersion != Util.GetGitHash() &&
+ if (versionInfo.AssemblyVersion != Util.GetScmVersion() &&
versionInfo.Track != "release" &&
string.Equals(versionInfo.Key, config.DalamudBetaKey, StringComparison.OrdinalIgnoreCase))
this.staleDalamudNewVersion = versionInfo.AssemblyVersion;
@@ -1564,7 +1564,7 @@ internal class PluginInstallerWindow : Window, IDisposable
DrawWarningIcon();
DrawLinesCentered("A new version of Dalamud is available.\n" +
"Please restart the game to ensure compatibility with updated plugins.\n" +
- $"old: {Util.GetGitHash()} new: {this.staleDalamudNewVersion}");
+ $"old: {Util.GetScmVersion()} new: {this.staleDalamudNewVersion}");
ImGuiHelpers.ScaledDummy(10);
}
diff --git a/Dalamud/Networking/Http/HappyHttpClient.cs b/Dalamud/Networking/Http/HappyHttpClient.cs
index aeed98695..4db44f1cf 100644
--- a/Dalamud/Networking/Http/HappyHttpClient.cs
+++ b/Dalamud/Networking/Http/HappyHttpClient.cs
@@ -36,7 +36,7 @@ internal class HappyHttpClient : IInternalDisposableService
{
UserAgent =
{
- new ProductInfoHeaderValue("Dalamud", Util.AssemblyVersion),
+ new ProductInfoHeaderValue("Dalamud", Util.GetScmVersion()),
},
},
};
diff --git a/Dalamud/Plugin/Internal/Types/PluginRepository.cs b/Dalamud/Plugin/Internal/Types/PluginRepository.cs
index 2f63070c3..9caa40f2e 100644
--- a/Dalamud/Plugin/Internal/Types/PluginRepository.cs
+++ b/Dalamud/Plugin/Internal/Types/PluginRepository.cs
@@ -59,7 +59,7 @@ internal class PluginRepository
},
UserAgent =
{
- new ProductInfoHeaderValue("Dalamud", Util.AssemblyVersion),
+ new ProductInfoHeaderValue("Dalamud", Util.GetScmVersion()),
},
},
};
diff --git a/Dalamud/Support/BugBait.cs b/Dalamud/Support/BugBait.cs
index 22628303e..c82e5e652 100644
--- a/Dalamud/Support/BugBait.cs
+++ b/Dalamud/Support/BugBait.cs
@@ -36,7 +36,7 @@ internal static class BugBait
Reporter = reporter,
Name = plugin.InternalName,
Version = isTesting ? plugin.TestingAssemblyVersion?.ToString() : plugin.AssemblyVersion.ToString(),
- DalamudHash = Util.GetGitHash(),
+ DalamudHash = Util.GetScmVersion(),
};
if (includeException)
diff --git a/Dalamud/Support/Troubleshooting.cs b/Dalamud/Support/Troubleshooting.cs
index 3ba088c66..4af8d5ffc 100644
--- a/Dalamud/Support/Troubleshooting.cs
+++ b/Dalamud/Support/Troubleshooting.cs
@@ -69,8 +69,8 @@ public static class Troubleshooting
LoadedPlugins = pluginManager?.InstalledPlugins?.Select(x => x.Manifest as LocalPluginManifest)?.OrderByDescending(x => x.InternalName).ToArray(),
PluginStates = pluginManager?.InstalledPlugins?.Where(x => !x.IsDev).ToDictionary(x => x.Manifest.InternalName, x => x.IsBanned ? "Banned" : x.State.ToString()),
EverStartedLoadingPlugins = pluginManager?.InstalledPlugins.Where(x => x.HasEverStartedLoad).Select(x => x.InternalName).ToList(),
- DalamudVersion = Util.AssemblyVersion,
- DalamudGitHash = Util.GetGitHash(),
+ DalamudVersion = Util.GetScmVersion(),
+ DalamudGitHash = Util.GetGitHash() ?? "Unknown",
GameVersion = startInfo.GameVersion?.ToString() ?? "Unknown",
Language = startInfo.Language.ToString(),
BetaKey = configuration.DalamudBetaKey,
diff --git a/Dalamud/Utility/Util.cs b/Dalamud/Utility/Util.cs
index 7d4de1a02..7d7bb1380 100644
--- a/Dalamud/Utility/Util.cs
+++ b/Dalamud/Utility/Util.cs
@@ -62,6 +62,7 @@ public static class Util
];
private static readonly Type GenericSpanType = typeof(Span<>);
+ private static string? scmVersionInternal;
private static string? gitHashInternal;
private static int? gitCommitCountInternal;
private static string? gitHashClientStructsInternal;
@@ -128,11 +129,28 @@ public static class Util
}
///
- /// Gets the git hash value from the assembly
- /// or null if it cannot be found.
+ /// Gets the SCM Version from the assembly, or null if it cannot be found. This method will generally return
+ /// the git describe 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.
+ ///
+ /// The SCM version of the assembly.
+ public static string GetScmVersion()
+ {
+ if (scmVersionInternal != null) return scmVersionInternal;
+
+ var asm = typeof(Util).Assembly;
+ var attrs = asm.GetCustomAttributes();
+
+ return scmVersionInternal = attrs.First(a => a.Key == "SCMVersion").Value
+ ?? asm.GetName().Version!.ToString();
+ }
+
+ ///
+ /// 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.
///
/// The git hash of the assembly.
- public static string GetGitHash()
+ public static string? GetGitHash()
{
if (gitHashInternal != null)
return gitHashInternal;
@@ -140,15 +158,14 @@ public static class Util
var asm = typeof(Util).Assembly;
var attrs = asm.GetCustomAttributes();
- gitHashInternal = attrs.First(a => a.Key == "GitHash").Value;
-
- return gitHashInternal;
+ return gitHashInternal = attrs.First(a => a.Key == "GitHash").Value;
}
///
/// Gets the amount of commits in the current branch, or null if undetermined.
///
/// The amount of commits in the current branch.
+ [Obsolete($"Planned for removal in API 11. Use {nameof(GetScmVersion)} for version tracking.")]
public static int? GetGitCommitCount()
{
if (gitCommitCountInternal != null)
@@ -170,7 +187,7 @@ public static class Util
/// or null if it cannot be found.
///
/// The git hash of the assembly.
- public static string GetGitHashClientStructs()
+ public static string? GetGitHashClientStructs()
{
if (gitHashClientStructsInternal != null)
return gitHashClientStructsInternal;