Skip to content

Commit

Permalink
(GH-8, GH-9) Updates to Cake 4.0.0, .net 6+
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaMarkic committed Feb 8, 2024
1 parent 4619a2b commit c867bc0
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 43 deletions.
31 changes: 23 additions & 8 deletions src/Cake.ResourceHacker.Tests/Cake.ResourceHacker.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,28 +1,43 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<None Include="ResourceHackerTest.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Cake.Core" Version="1.0.0" />
<PackageReference Include="Cake.Testing" Version="1.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="NSubstitute" Version="4.0.0" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="Cake.Core" Version="4.0.0" />
<PackageReference Include="Cake.Testing" Version="4.0.0" />
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Cake.ResourceHacker\Cake.ResourceHacker.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Apps\" />
<Using Include="Cake.Core" />
<Using Include="Cake.Core.Configuration" />
<Using Include="Cake.Core.Diagnostics" />
<Using Include="Cake.Core.IO" />
<Using Include="Cake.Testing.Fixtures" />
<Using Include="NUnit.Framework" />
</ItemGroup>

</Project>
9 changes: 4 additions & 5 deletions src/Cake.ResourceHacker/ArgumentsBuilderExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ namespace Cake.ResourceHacker
public static class ArgumentsBuilderExtension
{
/// <summary>
/// Appends all arguments from <paramref name="settings"/> and <paramref name="arguments"/>.
/// Appends all arguments from <paramref name="settings"/>.
/// </summary>
/// <param name="builder"></param>
/// <param name="cakeEnvironment"></param>
/// <param name="command"></param>
/// <param name="settings">The settings.</param>
/// <param name="arguments"></param>
public static void AppendAll(this ProcessArgumentBuilder builder, ICakeEnvironment cakeEnvironment, string command, ResourceHackerSettings settings)
{
if (builder == null)
Expand All @@ -36,10 +36,9 @@ public static void AppendAll(this ProcessArgumentBuilder builder, ICakeEnvironme
/// <summary>
/// Appends pre or post command arguments.
/// </summary>
/// <typeparam name="TSettings"></typeparam>
/// <param name="builder"></param>
/// <param name="cakeEnvironment"></param>
/// <param name="settings"></param>
/// <param name="preCommand"></param>
public static void AppendArguments(ProcessArgumentBuilder builder, ICakeEnvironment cakeEnvironment, ResourceHackerSettings settings)
{
AppendFilePathIfNotNull(builder, cakeEnvironment, "open", settings.Open);
Expand All @@ -54,7 +53,7 @@ public static void AppendArguments(ProcessArgumentBuilder builder, ICakeEnvironm
}
}

static void AppendFilePathIfNotNull(ProcessArgumentBuilder builder, ICakeEnvironment cakeEnvironment, string name, FilePath path)
static void AppendFilePathIfNotNull(ProcessArgumentBuilder builder, ICakeEnvironment cakeEnvironment, string name, FilePath? path)
{
if (path != null)
{
Expand Down
36 changes: 14 additions & 22 deletions src/Cake.ResourceHacker/Cake.ResourceHacker.csproj
Original file line number Diff line number Diff line change
@@ -1,50 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net50;netstandard2.0;net46</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<CodeAnalysisRuleSet></CodeAnalysisRuleSet>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup>
<PackageId>Cake.ResourceHacker</PackageId>
<Title>Cake.ResourceHacker</Title>
<Description>ResourceHacker Addin for Cake Build.</Description>
<PackageTags>Cake Script ResourceHacker cake-addin</PackageTags>
<PackageTags>Cake Script Build ResourceHacker Deployment cake-addin addin cake-build</PackageTags>
<Authors>Miha Markic</Authors>
<Owners>Miha Markic, cake-contrib</Owners>
<Description>ResourceHacker Addin for Cake Build, Test and Deployment Automation System.</Description>
<RepositoryUrl>https://github.com/cake-contrib/Cake.ResourceHacker.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<IncludeSymbols>true</IncludeSymbols>
<PackageProjectUrl>https://github.com/cake-contrib/Cake.ResourceHacker</PackageProjectUrl>
<PackageIcon>icon.png</PackageIcon>
<!-- for compatibility only -->
<PackageIconUrl>https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png</PackageIconUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|AnyCPU'">
<DocumentationFile>bin\Release\netstandard2.0\Cake.ResourceHacker.xml</DocumentationFile>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DocumentationFile>bin\Release\net6.0\Cake.ResourceHacker.xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cake.Addin.Analyzer" Version="0.1.3">
<PackageReference Include="Cake.Core" Version="4.0.0" PrivateAssets="All" />
<PackageReference Include="CakeContrib.Guidelines" Version="1.5.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Cake.Core" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="CakeContrib.Guidelines" Version="0.5.0">
<PrivateAssets>all</PrivateAssets>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<None Include="icon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

</Project>
12 changes: 12 additions & 0 deletions src/Cake.ResourceHacker/Mask.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
namespace Cake.ResourceHacker
{
/// <summary>
/// Resource mask
/// </summary>
public struct Mask
{
/// <summary>
/// Type
/// </summary>
public string Type { get; set; }
/// <summary>
/// Name
/// </summary>
public string Name { get; set; }
/// <summary>
/// Language
/// </summary>
public string Language { get; set; }
}
}
12 changes: 6 additions & 6 deletions src/Cake.ResourceHacker/ResourceHackerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ public class ResourceHackerSettings : ToolSettings
/// <summary>
/// filename - the name of the file that is to be modified. It should be a Windows PE file (*.exe, *.dll etc) or a compiled or uncompiled resouce file (*.res or *.rc)
/// </summary>
public FilePath Open { get; set; }
public FilePath? Open { get; set; }
/// <summary>
/// usually a filename for the new or modified file, but can also be a folder when extracting multiple resources
/// </summary>
public FilePath Save { get; set; }
public FilePath? Save { get; set; }
/// <summary>
/// Filename or CONSOLE or NUL
/// CONSOLE can be abbreviated to CON
/// Logs the details of the operation performed
/// If this switch is omitted, the log will be written to resourcehacker.log
/// </summary>
public FilePath Log { get; set; }
public FilePath? Log { get; set; }
/// <summary>
/// filename - contains a resource being added to the opened file.
/// </summary>
public FilePath Resource { get; set; }
public FilePath? Resource { get; set; }
/// <summary>
/// filename - contains a multi-command script, NOT a resource script for more info: -help script
/// </summary>
public FilePath Script { get; set; }
public FilePath? Script { get; set; }
/// <summary>
/// resource mask - Type,Name,Language
/// commas are mandatory but each of Type, Name & Language are optional
/// commas are mandatory but each of Type, Name &amp; Language are optional
/// </summary>
public Mask? Mask { get; set; }
}
Expand Down
2 changes: 0 additions & 2 deletions src/Cake.ResourceHacker/ResourceHackerTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Cake.ResourceHacker
/// <summary>
/// Resource Hacker tool.
/// </summary>
/// <typeparam name="TSettings">The settings type.</typeparam>
public class ResourceHackerTool : Tool<ResourceHackerSettings>
{
readonly ICakeEnvironment environment;
Expand Down Expand Up @@ -38,7 +37,6 @@ public ResourceHackerTool(
/// </summary>
/// <param name="command">The command.</param>
/// <param name="settings">The settings.</param>
/// <param name="additional">Additional arguments.</param>
public void Run(string command, ResourceHackerSettings settings)
{
if (string.IsNullOrEmpty(command))
Expand Down
Binary file removed src/Cake.ResourceHacker/icon.png
Binary file not shown.

0 comments on commit c867bc0

Please sign in to comment.