More cleanup of VersionInfo code gen
This commit is contained in:
parent
460613fba4
commit
f6edd02195
|
@ -25,7 +25,7 @@
|
|||
/BizHawk.Client.EmuHawk/tools/TAStudio/HistoryBox.resx
|
||||
|
||||
|
||||
/src/BizHawk.Common/SubWCRev.cs
|
||||
/src/BizHawk.Common/VersionInfo.gen.cs
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -100,7 +100,6 @@
|
|||
<ProjectReference Include="$(ProjectDir)../BizHawk.Client.Common/BizHawk.Client.Common.csproj" />
|
||||
<ProjectReference Include="$(ProjectDir)../BizHawk.WinForms.Controls/BizHawk.WinForms.Controls.csproj" />
|
||||
<Compile Include="$(ProjectDir)../BizHawk.Common/OSTailoredCode.cs" />
|
||||
<Compile Include="$(ProjectDir)../BizHawk.Common/SubWCRev.cs" /><!-- bit of a hack - should this be public? -->
|
||||
<Compile Remove="Properties/Settings.Designer.cs" />
|
||||
<Content Include="images/logo.ico" />
|
||||
<EmbeddedResource Include="images/**/*" />
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
<PackageReference Include="Menees.Analyzers" Version="2.0.4" Condition=" '$(MachineRunAnalyzersDuringBuild)' != '' " />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0" Condition=" '$(MachineRunAnalyzersDuringBuild)' != '' " />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164" Condition=" '$(MachineRunAnalyzersDuringBuild)' != '' " />
|
||||
<ProjectReference Include="$(ProjectDir)../BizHawk.Version/BizHawk.Version.csproj" /><!-- generates SubWCRev.cs -->
|
||||
<ProjectReference Include="$(ProjectDir)../BizHawk.Version/BizHawk.Version.csproj" /><!-- generates VersionInfo.gen.cs -->
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="VersionInfo.gen.cs" DependentUpon="VersionInfo.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<Target Name="PreBuild" AfterTargets="PreBuildEvent">
|
||||
<Exec Condition=" '$(OS)' == 'Windows_NT' " Command='"$(ProjectDir)..\..\Build\BizHawk.Build.Tool.exe" GIT_REV --wc "$(ProjectDir).." --template "$(ProjectDir)svnrev_template" --out "$(ProjectDir)..\BizHawk.Common\SubWCRev.cs"' />
|
||||
<Exec Condition=" '$(OS)' != 'Windows_NT' " Command='"$(ProjectDir)../../Build/standin.sh" "$(ProjectDir)..\BizHawk.Common\SubWCRev.cs"' />
|
||||
<Exec Condition=" '$(OS)' == 'Windows_NT' " Command='"$(ProjectDir)..\..\Build\BizHawk.Build.Tool.exe" GIT_REV --wc "$(ProjectDir).." --template "$(ProjectDir)VersionInfo.gen_template.cs" --out "$(ProjectDir)..\BizHawk.Common\VersionInfo.gen.cs"' />
|
||||
<Exec Condition=" '$(OS)' != 'Windows_NT' " Command='"$(ProjectDir)../../Build/standin.sh" "$(ProjectDir)VersionInfo.gen_template.cs" "$(ProjectDir)..\BizHawk.Common\VersionInfo.gen.cs"' />
|
||||
</Target>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Delete Files="$(OutputPath)BizHawk.Version.csproj" /><!-- no source files, generated svnrev.cs is included in BizHawk.Common -->
|
||||
<Delete Files="$(OutputPath)BizHawk.Version.csproj" /><!-- no source files; VersionInfo.gen.cs is generated in BizHawk.Common -->
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -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$";
|
||||
}
|
||||
}
|
|
@ -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$";
|
||||
}
|
Loading…
Reference in New Issue