Skip to content

Commit

Permalink
Merge pull request #2 from ricaun-io/develop
Browse files Browse the repository at this point in the history
Version 1.0.1
  • Loading branch information
ricaun authored Feb 18, 2025
2 parents 143871b + a2eb492 commit 56e224e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 11 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.0.1] / 2025-02-03
### Features
- Update `ILRepack` version `2.0.38`.
### Experimental Features
- `ILRepackRenameEnabled` property to rename the output file to change the assembly name with revision.
### Updates
- Update `ILRepackVersion` with condition.
- Update to show `TargetFramework` in the console.
### Sample
- Only include `System.Text.Json` in net framework, issue with repack and net core.

## [1.0.0] / 2024-09-03 - 2025-01-30
### Features
- Support `ILRepack` version `2.0.36`.
Expand All @@ -18,4 +29,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Update `ILRepackIgnoreReferences` to ignore all files starts with include name.

[vNext]: ../../compare/1.0.0...HEAD
[1.0.1]: ../../compare/1.0.0...1.0.1
[1.0.0]: ../../compare/1.0.0
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Build](https://github.com/ricaun-io/ricaun.ILRepack/actions/workflows/Build.yml/badge.svg)](https://github.com/ricaun-io/ricaun.ILRepack/actions)
[![Release](https://img.shields.io/nuget/v/ricaun.ILRepack?logo=nuget&label=release&color=blue)](https://www.nuget.org/packages/ricaun.ILRepack)

`ricaun.ILRepack` is a basic repack for .NET assemblies. Uses the package [ILRepack](https://github.com/gluck/il-repack) version `2.0.36` to repack the assembly using `Target` to replace the original assembly to the repack assembly with all the dependencies included.
`ricaun.ILRepack` is a basic repack for .NET assemblies. Uses the package [ILRepack](https://github.com/gluck/il-repack) version `2.0.38` to repack the assembly using `Target` to replace the original assembly to the repack assembly with all the dependencies included.

## Installation

Expand Down
4 changes: 2 additions & 2 deletions ricaun.ILRepack.Sample.Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ public void TestJson()
Console.WriteLine(c.ToJson());
Assert.AreEqual(c.ToString(), c.ToJson());
}

#if NETFRAMEWORK
[Test]
public void TestReferenceName_AreEqual()
{
var name = typeof(Class).Assembly.GetName().Name;
Console.WriteLine(References.System_Text_Json);
Assert.AreEqual(name, References.System_Text_Json);
}

#endif
[Test]
public void TestReferenceName_AreNotEqual()
{
Expand Down
2 changes: 1 addition & 1 deletion ricaun.ILRepack.Sample/ricaun.ILRepack.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<ItemGroup>
<PackageReference Include="ricaun.ILRepack" Version="*-*" Condition="!$(Configuration.Contains('Debug'))" />
<PackageReference Include="System.Text.Json" Version="*" PrivateAssets="All" />
<PackageReference Include="System.Text.Json" Version="8.*" PrivateAssets="All" Condition="$(TargetFramework.StartsWith('net4'))" />
<PackageReference Include="Newtonsoft.Json" Version="*" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion ricaun.ILRepack/ricaun.ILRepack.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="ILRepack" Version="2.0.36" />
<PackageReference Include="ILRepack" Version="2.0.38" />
</ItemGroup>

<Target Name="CopyPackFiles" AfterTargets="Pack" Condition="!$(Configuration.Contains('Debug'))">
Expand Down
26 changes: 21 additions & 5 deletions ricaun.ILRepack/ricaun.ILRepack.targets
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<Project>

<PropertyGroup>
<ILRepackVersion>2.0.36</ILRepackVersion>
<ILRepackVersion Condition="'$(ILRepackVersion)' == ''">2.0.38</ILRepackVersion>
<ILRepack Condition="'$(ILRepack)' == ''">$(NuGetPackageRoot)ilrepack\$(ILRepackVersion)\tools\ILRepack.exe</ILRepack>
</PropertyGroup>

<PropertyGroup>
<ILRepackEnabled Condition="'$(ILRepackEnabled)' == ''">true</ILRepackEnabled>
<ILRepackDeleteEnabled Condition="'$(ILRepackDeleteEnabled)' == ''">true</ILRepackDeleteEnabled>
<ILRepackImportance Condition="'$(ILRepackImportance)' == ''">Low</ILRepackImportance>
<ILRepackRenameEnabled Condition="'$(ILRepackRenameEnabled)' == ''">false</ILRepackRenameEnabled>
</PropertyGroup>

<Target Name="ILRepackTarget" BeforeTargets="CopyFilesToOutputDirectory" Condition="$(ILRepackEnabled)">
Expand All @@ -17,6 +18,15 @@
<ILRepackFileName>$(TargetName)$(TargetExt)</ILRepackFileName>
<ILRepackProgramAssembly>@(IntermediateAssembly->'%(FullPath)')</ILRepackProgramAssembly>
<ILRepackOutputFile>$(ILRepackProgramAssembly)</ILRepackOutputFile>
<ILRepackOutputFileName>$(ILRepackFileName)</ILRepackOutputFileName>
<ILRepackOutputRenameFile>$(ILRepackOutputFile)</ILRepackOutputRenameFile>
</PropertyGroup>

<PropertyGroup Condition="$(ILRepackRenameEnabled)">
<ILRepackProgramFolder>@(IntermediateAssembly->'%(RelativeDir)')</ILRepackProgramFolder>
<ILRepackOutputFileRevision>$([MSBuild]::Divide($([System.DateTime]::Now.TimeOfDay.TotalSeconds), 4).ToString('F0'))</ILRepackOutputFileRevision>
<ILRepackOutputFileName>$(TargetName).$(ILRepackOutputFileRevision)$(TargetExt)</ILRepackOutputFileName>
<ILRepackOutputRenameFile>$(ILRepackProgramFolder)$(ILRepackOutputFileName)</ILRepackOutputRenameFile>
</PropertyGroup>

<ItemGroup>
Expand All @@ -36,6 +46,10 @@
<ILRepackIncludedEmbeddedAssemblies
Include="@(ILRepackIncludedAssemblyReferences)"
Exclude="@(ILRepackExcludedEmbeddedAssemblies)" />

<!-- Remove All Assemblies References -->
<ILRepackIncludedEmbeddedAssemblies Remove="@(ILRepackIncludedEmbeddedAssemblies)" Condition="$(ILRepackRenameEnabled)" />

<ILRepackInputAssemblies Include="$(ILRepackProgramAssembly)" />
<ILRepackInputAssemblies Include="@(ILRepackIncludedEmbeddedAssemblies)" />
</ItemGroup>
Expand All @@ -55,13 +69,13 @@
<PropertyGroup>
<ILRepackCommandExtra Condition="'$(ILRepackCommandExtra)' == ''"></ILRepackCommandExtra>
<ILRepackCommandImportance Condition="'$(ILRepackCommandImportance)' == ''">Low</ILRepackCommandImportance>
<ILRepackCommandOutput>/out:&quot;$(ILRepackOutputFile)&quot;</ILRepackCommandOutput>
<ILRepackCommandOutput>/out:&quot;$(ILRepackOutputRenameFile)&quot;</ILRepackCommandOutput>
<ILRepackCommandInputAssemblies>@(ILRepackInputAssemblies -> '&quot;%(identity)&quot;', ' ')</ILRepackCommandInputAssemblies>
<!-- Space in the end is used to mitigate slash with quot error.-->
<ILRepackCommandLibFolder>@(BuildReferenceFolderDistinctSlash -> '/lib:&quot;%(identity) &quot;', ' ')</ILRepackCommandLibFolder>
</PropertyGroup>

<Message Text="ILRepack: $(ILRepackFileName) [@(ILRepackInputAssemblies -> '%(Filename)%(Extension)', ', ')]" Importance="$(ILRepackImportance)" />
<Message Text="ILRepack: $(ILRepackOutputFileName) [@(ILRepackInputAssemblies -> '%(Filename)%(Extension)', ', ')] ($(TargetFramework))" Importance="$(ILRepackImportance)" />

<PropertyGroup>
<ILRepackFullCommand>&quot;$(ILRepack)&quot; $(ILRepackCommandExtra) $(ILRepackCommandLibFolder) $(ILRepackCommandOutput) $(ILRepackCommandInputAssemblies)</ILRepackFullCommand>
Expand All @@ -75,10 +89,12 @@
ConsoleToMSBuild="true"
StandardOutputImportance="$(ILRepackCommandImportance)"/>

<Move SourceFiles="$(ILRepackOutputRenameFile)" DestinationFiles="$(ILRepackOutputFile)" Condition="$(ILRepackRenameEnabled)"/>

</Target>

<Target Name="ILRepackDeleteTarget" AfterTargets="ILRepackTarget" Condition="$(ILRepackEnabled) and $(ILRepackDeleteEnabled)">
<Message Text="ILRepack Delete: [@(ILRepackIncludedEmbeddedAssemblies -> '%(Filename)%(Extension)', ', ')]" Importance="$(ILRepackImportance)" />
<Message Text="ILRepack Delete: [@(ILRepackIncludedEmbeddedAssemblies -> '%(Filename)%(Extension)', ', ')]" Importance="$(ILRepackImportance)" Condition="'@(ILRepackIncludedEmbeddedAssemblies->Count())' != '0'" />

<Delete Files="@(ILRepackIncludedEmbeddedAssemblies)" />
<ItemGroup>
Expand All @@ -87,7 +103,7 @@
<Files>$([System.IO.Directory]::GetFiles("%(Directories.Identity)", "*", System.IO.SearchOption.AllDirectories).get_Length())</Files>
</Directories>
</ItemGroup>
<RemoveDir Directories="@(Directories)" Condition="%(Files)=='0'"/>
<RemoveDir Directories="@(Directories)" Condition="%(Files)=='0'"/>
</Target>

</Project>

0 comments on commit 56e224e

Please sign in to comment.