From 87f16e38699160d9245db56a6ee0bc20aa444701 Mon Sep 17 00:00:00 2001 From: jvyden Date: Tue, 23 Nov 2021 00:24:37 -0500 Subject: [PATCH] Add build to FullVersion --- .../{GitVersionHelper.cs => VersionHelper.cs} | 15 ++++++++++++--- ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml | 4 ++-- ProjectLighthouse/Program.cs | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) rename ProjectLighthouse/Helpers/{GitVersionHelper.cs => VersionHelper.cs} (87%) diff --git a/ProjectLighthouse/Helpers/GitVersionHelper.cs b/ProjectLighthouse/Helpers/VersionHelper.cs similarity index 87% rename from ProjectLighthouse/Helpers/GitVersionHelper.cs rename to ProjectLighthouse/Helpers/VersionHelper.cs index bc4e8cad..13bae320 100644 --- a/ProjectLighthouse/Helpers/GitVersionHelper.cs +++ b/ProjectLighthouse/Helpers/VersionHelper.cs @@ -6,9 +6,9 @@ using LBPUnion.ProjectLighthouse.Types.Settings; namespace LBPUnion.ProjectLighthouse.Helpers { - public static class GitVersionHelper + public static class VersionHelper { - static GitVersionHelper() + static VersionHelper() { try { @@ -51,8 +51,17 @@ namespace LBPUnion.ProjectLighthouse.Helpers public static string CommitHash { get; set; } public static string Branch { get; set; } - public static string FullVersion => $"{ServerStatics.ServerName} {Branch}@{CommitHash}"; + public static string FullVersion => $"{ServerStatics.ServerName} {Branch}@{CommitHash} {Build}"; public static bool IsDirty => CommitHash.EndsWith("-dirty"); public static bool CanCheckForUpdates { get; set; } + + public const string Build = + #if DEBUG + "Debug"; + #elif RELEASE + "Release"; + #else + "Unknown"; + #endif } } \ No newline at end of file diff --git a/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml b/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml index 4c764cc8..a03632a3 100644 --- a/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml +++ b/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml @@ -69,8 +69,8 @@
-

Page generated by @GitVersionHelper.FullVersion.

- @if (GitVersionHelper.IsDirty) +

Page generated by @VersionHelper.FullVersion.

+ @if (VersionHelper.IsDirty) {

This page was generated using a modified version of Project Lighthouse. Please make sure you are properly disclosing the source code to any users who may be using this instance.

} diff --git a/ProjectLighthouse/Program.cs b/ProjectLighthouse/Program.cs index 65c6ffac..eadae3b8 100644 --- a/ProjectLighthouse/Program.cs +++ b/ProjectLighthouse/Program.cs @@ -29,7 +29,7 @@ namespace LBPUnion.ProjectLighthouse Logger.AddLogger(new LighthouseFileLogger()); Logger.Log("Welcome to Project Lighthouse!", LoggerLevelStartup.Instance); - Logger.Log($"Running {GitVersionHelper.FullVersion}", LoggerLevelStartup.Instance); + Logger.Log($"Running {VersionHelper.FullVersion}", LoggerLevelStartup.Instance); // This loads the config, see ServerSettings.cs for more information Logger.Log("Loaded config file version " + ServerSettings.Instance.ConfigVersion, LoggerLevelStartup.Instance);