Browse Source

Simplify update-assemblyinfo.ps1 and introduce public DecompilerVersionInfo class.

pull/2656/head
Siegfried Pammer 3 years ago
parent
commit
b3f8e4fe3c
  1. 3
      .gitignore
  2. 7
      BuildTools/update-assemblyinfo.ps1
  3. 5
      ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
  4. 4
      ICSharpCode.Decompiler/Properties/AssemblyInfo.cs
  5. 11
      ICSharpCode.Decompiler/Properties/DecompilerVersionInfo.template.cs
  6. 4
      ILSpy/AboutPage.cs
  7. 1
      ILSpy/ILSpy.csproj
  8. 2
      ILSpy/ILSpySettings.cs
  9. 4
      ILSpy/MainWindow.xaml.cs
  10. 17
      ILSpy/Properties/AssemblyInfo.cs

3
.gitignore vendored

@ -2,8 +2,6 @@ bin/
obj/ obj/
AppPackages/ AppPackages/
BundleArtifacts/ BundleArtifacts/
/ICSharpCode.Decompiler/Properties/AssemblyInfo.cs
/ILSpy/Properties/AssemblyInfo.cs
/ILSpy/app.config /ILSpy/app.config
*.user *.user
/Resharper-ILSpy-Style.xml /Resharper-ILSpy-Style.xml
@ -22,3 +20,4 @@ multitargeting.props
ILSpy.Installer/wix/ ILSpy.Installer/wix/
ILSpy.Installer/AppPackage.cs ILSpy.Installer/AppPackage.cs
/VERSION /VERSION
/ICSharpCode.Decompiler/Properties/DecompilerVersionInfo.cs

7
BuildTools/update-assemblyinfo.ps1

@ -6,7 +6,7 @@ $baseCommitRev = 1;
# make sure this matches artifacts-only branches list in appveyor.yml! # make sure this matches artifacts-only branches list in appveyor.yml!
$masterBranches = '^(master|release/.+)$'; $masterBranches = '^(master|release/.+)$';
$globalAssemblyInfoTemplateFile = "ILSpy/Properties/AssemblyInfo.template.cs"; $decompilerVersionInfoTemplateFile = "ICSharpCode.Decompiler/Properties/DecompilerVersionInfo.template.cs";
function Test-File([string]$filename) { function Test-File([string]$filename) {
return [System.IO.File]::Exists((Join-Path (Get-Location) $filename)); return [System.IO.File]::Exists((Join-Path (Get-Location) $filename));
@ -79,8 +79,7 @@ function gitBranch() {
} }
$templateFiles = ( $templateFiles = (
@{Input=$globalAssemblyInfoTemplateFile; Output="ILSpy/Properties/AssemblyInfo.cs"}, @{Input=$decompilerVersionInfoTemplateFile; Output="ICSharpCode.Decompiler/Properties/DecompilerVersionInfo.cs"},
@{Input="ICSharpCode.Decompiler/Properties/AssemblyInfo.template.cs"; Output="ICSharpCode.Decompiler/Properties/AssemblyInfo.cs"},
@{Input="ILSpy/Properties/app.config.template"; Output = "ILSpy/app.config"}, @{Input="ILSpy/Properties/app.config.template"; Output = "ILSpy/app.config"},
@{Input="ILSpy.AddIn/source.extension.vsixmanifest.template"; Output = "ILSpy.AddIn/source.extension.vsixmanifest"}, @{Input="ILSpy.AddIn/source.extension.vsixmanifest.template"; Output = "ILSpy.AddIn/source.extension.vsixmanifest"},
@{Input="ILSpy.AddIn.VS2022/source.extension.vsixmanifest.template"; Output = "ILSpy.AddIn.VS2022/source.extension.vsixmanifest"}, @{Input="ILSpy.AddIn.VS2022/source.extension.vsixmanifest.template"; Output = "ILSpy.AddIn.VS2022/source.extension.vsixmanifest"},
@ -106,7 +105,7 @@ try {
} }
$versionParts = @{}; $versionParts = @{};
Get-Content $globalAssemblyInfoTemplateFile | where { $_ -match 'string (\w+) = "?(\w+)"?;' } | foreach { $versionParts.Add($Matches[1], $Matches[2]) } Get-Content $decompilerVersionInfoTemplateFile | where { $_ -match 'string (\w+) = "?(\w+)"?;' } | foreach { $versionParts.Add($Matches[1], $Matches[2]) }
$major = $versionParts.Major; $major = $versionParts.Major;
$minor = $versionParts.Minor; $minor = $versionParts.Minor;

5
ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj

@ -114,6 +114,8 @@
<Compile Include="Instrumentation\DecompilerEventSource.cs" /> <Compile Include="Instrumentation\DecompilerEventSource.cs" />
<Compile Include="Metadata\FindTypeDecoder.cs" /> <Compile Include="Metadata\FindTypeDecoder.cs" />
<Compile Include="Metadata\ReferenceLoadInfo.cs" /> <Compile Include="Metadata\ReferenceLoadInfo.cs" />
<Compile Include="Properties\DecompilerVersionInfo.cs" />
<None Include="Properties\DecompilerVersionInfo.template.cs" />
<Compile Include="Semantics\OutVarResolveResult.cs" /> <Compile Include="Semantics\OutVarResolveResult.cs" />
<Compile Include="SingleFileBundle.cs" /> <Compile Include="SingleFileBundle.cs" />
<Compile Include="Solution\ProjectId.cs" /> <Compile Include="Solution\ProjectId.cs" />
@ -651,7 +653,6 @@
<Generator>TextTemplatingFileGenerator</Generator> <Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>Instructions.cs</LastGenOutput> <LastGenOutput>Instructions.cs</LastGenOutput>
</None> </None>
<None Include="Properties\AssemblyInfo.template.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -692,7 +693,7 @@
</Target> </Target>
<Target Name="CleanUpdateAssemblyInfo" BeforeTargets="BeforeClean"> <Target Name="CleanUpdateAssemblyInfo" BeforeTargets="BeforeClean">
<Delete Files="@(UpdateAssemblyInfoStamp)" /> <Delete Files="@(UpdateAssemblyInfoStamp);..\VERSION" />
</Target> </Target>
</Project> </Project>

4
ICSharpCode.Decompiler/Properties/AssemblyInfo.template.cs → ICSharpCode.Decompiler/Properties/AssemblyInfo.cs

@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
// If you need to expose a type to COM, use [ComVisible(true)] on that type. // If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
[assembly: AssemblyVersion("$INSERTVERSION$")] [assembly: AssemblyVersion(DecompilerVersionInfo.Major + "." + DecompilerVersionInfo.Minor + "." + DecompilerVersionInfo.Build + "." + DecompilerVersionInfo.Revision)]
[assembly: AssemblyInformationalVersion("$INSERTVERSION$$INSERTBRANCHPOSTFIX$$INSERTVERSIONNAMEPOSTFIX$-$INSERTSHORTCOMMITHASH$")] [assembly: AssemblyInformationalVersion(DecompilerVersionInfo.FullVersionWithShortCommitHash)]
[assembly: InternalsVisibleTo("ICSharpCode.Decompiler.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001004dcf3979c4e902efa4dd2163a039701ed5822e6f1134d77737296abbb97bf0803083cfb2117b4f5446a217782f5c7c634f9fe1fc60b4c11d62c5b3d33545036706296d31903ddcf750875db38a8ac379512f51620bb948c94d0831125fbc5fe63707cbb93f48c1459c4d1749eb7ac5e681a2f0d6d7c60fa527a3c0b8f92b02bf")] [assembly: InternalsVisibleTo("ICSharpCode.Decompiler.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001004dcf3979c4e902efa4dd2163a039701ed5822e6f1134d77737296abbb97bf0803083cfb2117b4f5446a217782f5c7c634f9fe1fc60b4c11d62c5b3d33545036706296d31903ddcf750875db38a8ac379512f51620bb948c94d0831125fbc5fe63707cbb93f48c1459c4d1749eb7ac5e681a2f0d6d7c60fa527a3c0b8f92b02bf")]

11
ICSharpCode.Decompiler/Properties/DecompilerVersionInfo.template.cs

@ -0,0 +1,11 @@
public static class DecompilerVersionInfo
{
public const string Major = "8";
public const string Minor = "0";
public const string Build = "0";
public const string Revision = "$INSERTREVISION$";
public const string VersionName = "alpha1";
public const string FullVersion = Major + "." + Minor + "." + Build + ".$INSERTREVISION$$INSERTBRANCHPOSTFIX$$INSERTVERSIONNAMEPOSTFIX$";
public const string FullVersionWithShortCommitHash = FullVersion + "-$INSERTSHORTCOMMITHASH$";
}

4
ILSpy/AboutPage.cs

@ -60,7 +60,7 @@ namespace ICSharpCode.ILSpy
Title = Resources.About, Title = Resources.About,
EnableHyperlinks = true EnableHyperlinks = true
}; };
output.WriteLine(Resources.ILSpyVersion + RevisionClass.FullVersion); output.WriteLine(Resources.ILSpyVersion + DecompilerVersionInfo.FullVersion);
string prodVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(Uri).Assembly.Location).ProductVersion; string prodVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(Uri).Assembly.Location).ProductVersion;
output.WriteLine(Resources.NETFrameworkVersion + prodVersion); output.WriteLine(Resources.NETFrameworkVersion + prodVersion);
@ -154,7 +154,7 @@ namespace ICSharpCode.ILSpy
}; };
} }
static readonly Version currentVersion = new Version(RevisionClass.Major + "." + RevisionClass.Minor + "." + RevisionClass.Build + "." + RevisionClass.Revision); static readonly Version currentVersion = new Version(DecompilerVersionInfo.Major + "." + DecompilerVersionInfo.Minor + "." + DecompilerVersionInfo.Build + "." + DecompilerVersionInfo.Revision);
static void ShowAvailableVersion(AvailableVersionInfo availableVersion, StackPanel stackPanel) static void ShowAvailableVersion(AvailableVersionInfo availableVersion, StackPanel stackPanel)
{ {

1
ILSpy/ILSpy.csproj

@ -74,7 +74,6 @@
<EmbeddedResource Include="TextView\ILAsm-Mode-Dark.xshd" /> <EmbeddedResource Include="TextView\ILAsm-Mode-Dark.xshd" />
<EmbeddedResource Include="TextView\Asm-Mode-Dark.xshd" /> <EmbeddedResource Include="TextView\Asm-Mode-Dark.xshd" />
<EmbeddedResource Include="TextView\XML-Mode-Dark.xshd" /> <EmbeddedResource Include="TextView\XML-Mode-Dark.xshd" />
<Compile Remove="Properties\AssemblyInfo.template.cs" />
<None Remove="Properties\launchSettings.json" /> <None Remove="Properties\launchSettings.json" />
<None Remove="Properties\app.config.template" /> <None Remove="Properties\app.config.template" />
</ItemGroup> </ItemGroup>

2
ILSpy/ILSpySettings.cs

@ -118,7 +118,7 @@ namespace ICSharpCode.ILSpy
{ {
doc = new XDocument(new XElement("ILSpy")); doc = new XDocument(new XElement("ILSpy"));
} }
doc.Root.SetAttributeValue("version", RevisionClass.Major + "." + RevisionClass.Minor + "." + RevisionClass.Build + "." + RevisionClass.Revision); doc.Root.SetAttributeValue("version", DecompilerVersionInfo.Major + "." + DecompilerVersionInfo.Minor + "." + DecompilerVersionInfo.Build + "." + DecompilerVersionInfo.Revision);
action(doc.Root); action(doc.Root);
doc.Save(config, SaveOptions.None); doc.Save(config, SaveOptions.None);
} }

4
ILSpy/MainWindow.xaml.cs

@ -1010,13 +1010,13 @@ namespace ICSharpCode.ILSpy
if (assemblyList.ListName == AssemblyListManager.DefaultListName) if (assemblyList.ListName == AssemblyListManager.DefaultListName)
#if DEBUG #if DEBUG
this.Title = $"ILSpy {RevisionClass.FullVersion}"; this.Title = $"ILSpy {DecompilerVersionInfo.FullVersion}";
#else #else
this.Title = "ILSpy"; this.Title = "ILSpy";
#endif #endif
else else
#if DEBUG #if DEBUG
this.Title = $"ILSpy {RevisionClass.FullVersion} - " + assemblyList.ListName; this.Title = $"ILSpy {DecompilerVersionInfo.FullVersion} - " + assemblyList.ListName;
#else #else
this.Title = "ILSpy - " + assemblyList.ListName; this.Title = "ILSpy - " + assemblyList.ListName;
#endif #endif

17
ILSpy/Properties/AssemblyInfo.template.cs → ILSpy/Properties/AssemblyInfo.cs

@ -17,7 +17,7 @@ using System.Runtime.Versioning;
[assembly: AssemblyDescription(".NET assembly inspector and decompiler")] [assembly: AssemblyDescription(".NET assembly inspector and decompiler")]
[assembly: AssemblyCompany("ic#code")] [assembly: AssemblyCompany("ic#code")]
[assembly: AssemblyProduct("ILSpy")] [assembly: AssemblyProduct("ILSpy")]
[assembly: AssemblyCopyright("Copyright 2011-$INSERTYEAR$ AlphaSierraPapa for the SharpDevelop Team")] [assembly: AssemblyCopyright("Copyright 2011-2022 AlphaSierraPapa for the SharpDevelop Team")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -25,8 +25,8 @@ using System.Runtime.Versioning;
// If you need to expose a type to COM, use [ComVisible(true)] on that type. // If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
[assembly: AssemblyVersion(RevisionClass.Major + "." + RevisionClass.Minor + "." + RevisionClass.Build + "." + RevisionClass.Revision)] [assembly: AssemblyVersion(DecompilerVersionInfo.Major + "." + DecompilerVersionInfo.Minor + "." + DecompilerVersionInfo.Build + "." + DecompilerVersionInfo.Revision)]
[assembly: AssemblyInformationalVersion(RevisionClass.FullVersion + "-$INSERTSHORTCOMMITHASH$")] [assembly: AssemblyInformationalVersion(DecompilerVersionInfo.FullVersionWithShortCommitHash)]
[assembly: NeutralResourcesLanguage("en-US")] [assembly: NeutralResourcesLanguage("en-US")]
[assembly: SupportedOSPlatform("Windows7.0")] [assembly: SupportedOSPlatform("Windows7.0")]
@ -37,14 +37,3 @@ using System.Runtime.Versioning;
[assembly: SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly", [assembly: SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly",
Justification = "AssemblyInformationalVersion does not need to be a parsable version")] Justification = "AssemblyInformationalVersion does not need to be a parsable version")]
internal static class RevisionClass
{
public const string Major = "8";
public const string Minor = "0";
public const string Build = "0";
public const string Revision = "$INSERTREVISION$";
public const string VersionName = "alpha1";
public const string FullVersion = Major + "." + Minor + "." + Build + ".$INSERTREVISION$$INSERTBRANCHPOSTFIX$$INSERTVERSIONNAMEPOSTFIX$";
}
Loading…
Cancel
Save