diff --git a/.gitignore b/.gitignore index dd1dcf38b3..3d079f86f4 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,7 @@ /BizHawk.Client.EmuHawk/tools/TAStudio/HistoryBox.resx -/src/BizHawk.Common/SubWCRev.cs +/src/BizHawk.Common/VersionInfo.gen.cs diff --git a/Build/standin.sh b/Build/standin.sh index 8c3b222c11..cddd9bce46 100755 --- a/Build/standin.sh +++ b/Build/standin.sh @@ -1,2 +1,2 @@ #!/bin/sh -cd "$(dirname "$0")/.." && printf "internal static class SubWCRev\n{\n\tpublic const string SVN_REV = \"%s\";\n\tpublic const string GIT_BRANCH = \"%s\";\n\tpublic const string GIT_SHORTHASH = \"%s\";\n}" "$(git rev-list HEAD --count)" "$(git rev-parse --abbrev-ref HEAD)" "$(git log -1 --format="%h")" >"$1" +sed -e "s;\\\$WCREV\\\$;$(git rev-list HEAD --count);" -e "s;\\\$WCBRANCH\\\$;$(git rev-parse --abbrev-ref HEAD);" -e "s;\\\$WCSHORTHASH\\\$;$(git log -1 --format="%h");" "$1" >"$2" diff --git a/src/BizHawk.Client.EmuHawk/BizBox.cs b/src/BizHawk.Client.EmuHawk/BizBox.cs index 1b039f2609..e8e9852942 100644 --- a/src/BizHawk.Client.EmuHawk/BizBox.cs +++ b/src/BizHawk.Client.EmuHawk/BizBox.cs @@ -41,8 +41,8 @@ namespace BizHawk.Client.EmuHawk DeveloperBuildLabel.Visible = VersionInfo.DeveloperBuild; Text = VersionInfo.DeveloperBuild - ? $" BizHawk (GIT {SubWCRev.GIT_BRANCH}#{SubWCRev.GIT_SHORTHASH})" - : $"Version {mainVersion} (GIT {SubWCRev.GIT_BRANCH}#{SubWCRev.GIT_SHORTHASH})"; + ? $" BizHawk (GIT {VersionInfo.GIT_BRANCH}#{VersionInfo.GIT_SHORTHASH})" + : $"Version {mainVersion} (GIT {VersionInfo.GIT_BRANCH}#{VersionInfo.GIT_SHORTHASH})"; VersionLabel.Text = $"Version {mainVersion}"; DateLabel.Text = VersionInfo.ReleaseDate; @@ -64,17 +64,17 @@ namespace BizHawk.Client.EmuHawk }); } - linkLabel2.Text = $"Commit # {SubWCRev.GIT_SHORTHASH}"; + linkLabel2.Text = $"Commit # {VersionInfo.GIT_SHORTHASH}"; } private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - Process.Start($"https://github.com/TASVideos/BizHawk/commit/{SubWCRev.GIT_SHORTHASH}"); + Process.Start($"https://github.com/TASVideos/BizHawk/commit/{VersionInfo.GIT_SHORTHASH}"); } private void btnCopyHash_Click(object sender, EventArgs e) { - Clipboard.SetText(SubWCRev.GIT_SHORTHASH); + Clipboard.SetText(VersionInfo.GIT_SHORTHASH); } private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) diff --git a/src/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/src/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index e95bc455e6..491f41b59b 100755 --- a/src/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/src/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -100,7 +100,6 @@ - diff --git a/src/BizHawk.Common/BizHawk.Common.csproj b/src/BizHawk.Common/BizHawk.Common.csproj index f139f6743f..5916b503c2 100644 --- a/src/BizHawk.Common/BizHawk.Common.csproj +++ b/src/BizHawk.Common/BizHawk.Common.csproj @@ -12,6 +12,9 @@ - + + + + diff --git a/src/BizHawk.Common/VersionInfo.cs b/src/BizHawk.Common/VersionInfo.cs index 65dbb1f813..fb92771ed4 100644 --- a/src/BizHawk.Common/VersionInfo.cs +++ b/src/BizHawk.Common/VersionInfo.cs @@ -3,7 +3,7 @@ using System.Reflection; namespace BizHawk.Common { - public static class VersionInfo + public static partial class VersionInfo { // keep this updated at every major release public const string MainVersion = "2.4.0"; // Use numbers only or the new version notification won't work @@ -16,7 +16,7 @@ namespace BizHawk.Common public static string GetEmuVersion() { return DeveloperBuild - ? "GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH + ? "GIT " + GIT_BRANCH + "#" + GIT_SHORTHASH : "Version " + MainVersion; } diff --git a/src/BizHawk.Version/BizHawk.Version.csproj b/src/BizHawk.Version/BizHawk.Version.csproj index 8823f9a4fa..df4f9262b6 100644 --- a/src/BizHawk.Version/BizHawk.Version.csproj +++ b/src/BizHawk.Version/BizHawk.Version.csproj @@ -6,10 +6,10 @@ netstandard2.0 - - + + - + diff --git a/src/BizHawk.Version/VersionInfo.gen_template.cs b/src/BizHawk.Version/VersionInfo.gen_template.cs new file mode 100644 index 0000000000..ea66cb93a7 --- /dev/null +++ b/src/BizHawk.Version/VersionInfo.gen_template.cs @@ -0,0 +1,11 @@ +// This file (VersionInfo.gen.cs) is auto-generated. Any edits will be overwritten before compilation. + +namespace BizHawk.Common +{ + public static partial class VersionInfo + { + public const string SVN_REV = "$WCREV$"; + public const string GIT_BRANCH = "$WCBRANCH$"; + public const string GIT_SHORTHASH = "$WCSHORTHASH$"; + } +} diff --git a/src/BizHawk.Version/dummy.cs b/src/BizHawk.Version/dummy.cs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/BizHawk.Version/svnrev_template b/src/BizHawk.Version/svnrev_template deleted file mode 100644 index 81b5b7f67c..0000000000 --- a/src/BizHawk.Version/svnrev_template +++ /dev/null @@ -1,6 +0,0 @@ -static class SubWCRev -{ - public const string SVN_REV = "$WCREV$"; - public const string GIT_BRANCH = "$WCBRANCH$"; - public const string GIT_SHORTHASH = "$WCSHORTHASH$"; -}