Skip to content

Commit

Permalink
Provide commit hash in AboutPage to make finding the correct version …
Browse files Browse the repository at this point in the history
…easier.
  • Loading branch information
siegfriedpammer committed Sep 20, 2024
1 parent 5e7e677 commit 4ff0c26
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 17 deletions.
14 changes: 13 additions & 1 deletion BuildTools/update-assemblyinfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ function gitCommitHash() {
}
}

function gitShortCommitHash() {
if (No-Git) {
return "00000000";
}
try {
return (git rev-parse --short=8 (git rev-list --max-count 1 HEAD));
} catch {
return "00000000";
}
}

function gitBranch() {
if (No-Git) {
return "no-branch";
Expand Down Expand Up @@ -117,6 +128,7 @@ try {
$revision = gitVersion;
$branchName = gitBranch;
$gitCommitHash = gitCommitHash;
$gitShortCommitHash = gitShortCommitHash;

if ($branchName -match $masterBranches) {
$postfixBranchName = "";
Expand Down Expand Up @@ -150,7 +162,7 @@ try {
$out = $out.Replace('$INSERTMAJORVERSION$', $major);
$out = $out.Replace('$INSERTREVISION$', $revision);
$out = $out.Replace('$INSERTCOMMITHASH$', $gitCommitHash);
$out = $out.Replace('$INSERTSHORTCOMMITHASH$', $gitCommitHash.Substring(0, 8));
$out = $out.Replace('$INSERTSHORTCOMMITHASH$', $gitShortCommitHash);
$out = $out.Replace('$INSERTDATE$', [System.DateTime]::Now.ToString("MM/dd/yyyy"));
$out = $out.Replace('$INSERTYEAR$', [System.DateTime]::Now.Year.ToString());
$out = $out.Replace('$INSERTBRANCHNAME$', $branchName);
Expand Down
2 changes: 1 addition & 1 deletion ICSharpCode.Decompiler/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[assembly: ComVisible(false)]

[assembly: AssemblyVersion(DecompilerVersionInfo.Major + "." + DecompilerVersionInfo.Minor + "." + DecompilerVersionInfo.Build + "." + DecompilerVersionInfo.Revision)]
[assembly: AssemblyInformationalVersion(DecompilerVersionInfo.FullVersionWithShortCommitHash)]
[assembly: AssemblyInformationalVersion(DecompilerVersionInfo.FullVersionWithCommitHash)]

[assembly: InternalsVisibleTo("ICSharpCode.Decompiler.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001004dcf3979c4e902efa4dd2163a039701ed5822e6f1134d77737296abbb97bf0803083cfb2117b4f5446a217782f5c7c634f9fe1fc60b4c11d62c5b3d33545036706296d31903ddcf750875db38a8ac379512f51620bb948c94d0831125fbc5fe63707cbb93f48c1459c4d1749eb7ac5e681a2f0d6d7c60fa527a3c0b8f92b02bf")]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
public const string Revision = "$INSERTREVISION$";
public const string VersionName = "preview2";

public const string FullVersion = Major + "." + Minor + "." + Build + ".$INSERTREVISION$$INSERTBRANCHPOSTFIX$$INSERTVERSIONNAMEPOSTFIX$";
public const string FullVersionWithShortCommitHash = FullVersion + "-$INSERTSHORTCOMMITHASH$";
public const string FullVersion = Major + "." + Minor + "." + Build + ".$INSERTREVISION$$INSERTBRANCHPOSTFIX$$INSERTVERSIONNAMEPOSTFIX
public const string FullVersionWithShortCommitHash = FullVersion + "+$INSERTSHORTCOMMITHASH$";
public const string FullVersionWithCommitHash = FullVersion + "+$INSERTCOMMITHASH$";
}
6 changes: 1 addition & 5 deletions ICSharpCode.ILSpyCmd/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#region Using directives

using System;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;

#endregion

Expand All @@ -15,7 +11,7 @@
[assembly: ComVisible(false)]

[assembly: AssemblyVersion(DecompilerVersionInfo.Major + "." + DecompilerVersionInfo.Minor + "." + DecompilerVersionInfo.Build + "." + DecompilerVersionInfo.Revision)]
[assembly: AssemblyInformationalVersion(DecompilerVersionInfo.FullVersionWithShortCommitHash)]
[assembly: AssemblyInformationalVersion(DecompilerVersionInfo.FullVersionWithCommitHash)]

[assembly: SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly",
Justification = "AssemblyInformationalVersion does not need to be a parsable version")]
Expand Down
6 changes: 1 addition & 5 deletions ICSharpCode.ILSpyX/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#region Using directives

using System;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;

#endregion

Expand All @@ -15,7 +11,7 @@
[assembly: ComVisible(false)]

[assembly: AssemblyVersion(DecompilerVersionInfo.Major + "." + DecompilerVersionInfo.Minor + "." + DecompilerVersionInfo.Build + "." + DecompilerVersionInfo.Revision)]
[assembly: AssemblyInformationalVersion(DecompilerVersionInfo.FullVersionWithShortCommitHash)]
[assembly: AssemblyInformationalVersion(DecompilerVersionInfo.FullVersionWithCommitHash)]

[assembly: SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly",
Justification = "AssemblyInformationalVersion does not need to be a parsable version")]
2 changes: 1 addition & 1 deletion ILSpy/AboutPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static void Display(DecompilerTextView textView)
Title = Resources.About,
EnableHyperlinks = true
};
output.WriteLine(Resources.ILSpyVersion + DecompilerVersionInfo.FullVersion);
output.WriteLine(Resources.ILSpyVersion + DecompilerVersionInfo.FullVersionWithCommitHash);

string prodVersion = GetDotnetProductVersion();
output.WriteLine(Resources.NETFrameworkVersion + prodVersion);
Expand Down
3 changes: 1 addition & 2 deletions ILSpy/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#region Using directives

using System;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Resources;
Expand All @@ -26,7 +25,7 @@
[assembly: ComVisible(false)]

[assembly: AssemblyVersion(DecompilerVersionInfo.Major + "." + DecompilerVersionInfo.Minor + "." + DecompilerVersionInfo.Build + "." + DecompilerVersionInfo.Revision)]
[assembly: AssemblyInformationalVersion(DecompilerVersionInfo.FullVersionWithShortCommitHash)]
[assembly: AssemblyInformationalVersion(DecompilerVersionInfo.FullVersionWithCommitHash)]
[assembly: NeutralResourcesLanguage("en-US")]

[assembly: SupportedOSPlatform("Windows7.0")]
Expand Down

0 comments on commit 4ff0c26

Please sign in to comment.