Skip to content

Commit

Permalink
Merge pull request #390 from nils-a/feature/GH-388
Browse files Browse the repository at this point in the history
(#388) Update Cake reference to Cake 5
  • Loading branch information
nils-a authored Nov 24, 2024
2 parents 431cfc9 + 52668b1 commit d544138
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 20 deletions.
4 changes: 2 additions & 2 deletions demo/cake/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "4.0.0",
"version": "5.0.0",
"commands": [
"dotnet-cake"
]
}
}
}
}
4 changes: 2 additions & 2 deletions demo/cake/build.cake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#tool "nuget:?package=7-Zip.CommandLine&version=18.1.0"
#r "..\..\src\Cake.7zip\bin\Release\net6.0\Cake.7zip.dll"
#r "..\..\src\Cake.7zip\bin\Release\net8.0\Cake.7zip.dll"

///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
Expand Down Expand Up @@ -195,4 +195,4 @@ Task("Default")
.IsDependentOn("RenameFile")
.IsDependentOn("GH78");

RunTarget(target);
RunTarget(target);
12 changes: 6 additions & 6 deletions demo/frosting/build/Build.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RunWorkingDirectory>$(MSBuildProjectDirectory)..</RunWorkingDirectory>
<TargetFramework>net8.0</TargetFramework>
<RunWorkingDirectory>$(MSBuildProjectDirectory)\</RunWorkingDirectory>
</PropertyGroup>
<ItemGroup>
<Reference Include="Cake.7zip, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\src\Cake.7zip\bin\Release\net6.0\Cake.7zip.dll</HintPath>
<Reference Include="Cake.7zip">
<HintPath>$(MSBuildProjectDirectory)\..\..\..\src\Cake.7zip\bin\Release\net8.0\Cake.7zip.dll</HintPath>
</Reference>
<PackageReference Include="Cake.Frosting" Version="4.0.0" />
<PackageReference Include="Cake.Frosting" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<Compile Remove="output\**" />
<EmbeddedResource Remove="output\**" />
<None Remove="output\**" />
</ItemGroup>
</Project>
</Project>
18 changes: 17 additions & 1 deletion demo/frosting/build/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Runtime.InteropServices;
using Cake.Frosting;

namespace Build
Expand All @@ -8,10 +9,25 @@ public static class Program
public static int Main(string[] args)
{
return new CakeHost()
.InstallTool(new Uri("nuget:?package=7-Zip.CommandLine&version=18.1.0"))
.InstallSevenZip()
.UseContext<BuildContext>()
.UseSetup<BuildSetup>()
.Run(args);
}

private static CakeHost InstallSevenZip(this CakeHost host)
{
// 7-Zip.CommandLine is a windows-only package
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
host.InstallTool(new Uri("nuget:?package=7-Zip.CommandLine&version=18.1.0"));
}
else
{
Console.WriteLine("7-Zip.CommandLine tool not installed. Make sure you hava a version of 7zip installed!");
}

return host;
}
}
}
2 changes: 1 addition & 1 deletion demo/frosting/build/Tasks/ZipItTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public override void Run(BuildContext context)
context.SevenZip(m => m
.InAddMode()
.WithArchive(context.Output.CombineWithFilePath("archive.zip"))
.WithFiles(context.Root.CombineWithFilePath("README.MD"))
.WithFiles(context.Root.CombineWithFilePath("README.md"))
.WithFiles(context.Root.CombineWithFilePath("CODE_OF_CONDUCT.md")));
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Cake.7zip.Tests/Cake.7zip.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
This is done to make Cake.Recipe avoid using OpenCover. Remove this hack if Cake.Recipe bumps the usage of Cake.Incubator to version 7.0.0
-->
<TargetFrameworks Condition="false">netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<CodeAnalysisRuleSet>..\cake.7zip.ruleset</CodeAnalysisRuleSet>

<IsPackable>false</IsPackable>
Expand All @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cake.Testing" Version="4.0.0" />
<PackageReference Include="Cake.Testing" Version="5.0.0" />
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
6 changes: 3 additions & 3 deletions src/Cake.7zip.Tests/SevenZipRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void Should_Access_registry()

var sevenZipKey = new Mock<IRegistryKey>();
sevenZipKey.Setup(k => k.GetValue("Path")).Returns(installLocation.Path.FullPath);
sevenZipKey.Setup(k => k.GetValue("Path64")).Returns(null);
sevenZipKey.Setup(k => k.GetValue("Path64")).Returns(null!);
var softwareKey = new Mock<IRegistryKey>();
softwareKey.Setup(k => k.OpenKey("7-Zip")).Returns(sevenZipKey.Object);
var hklm = new Mock<IRegistryKey>();
Expand Down Expand Up @@ -124,7 +124,7 @@ public void Should_Access_64bit_tool_from_registry()
var file = fixture.FileSystem.CreateFile(installLocation.Path.CombineWithFilePath("7z.exe"));

var sevenZipKey = new Mock<IRegistryKey>();
sevenZipKey.Setup(k => k.GetValue("Path")).Returns(null);
sevenZipKey.Setup(k => k.GetValue("Path")).Returns(null!);
sevenZipKey.Setup(k => k.GetValue("Path64")).Returns(installLocation.Path.FullPath);
var softwareKey = new Mock<IRegistryKey>();
softwareKey.Setup(k => k.OpenKey("7-Zip")).Returns(sevenZipKey.Object);
Expand Down Expand Up @@ -313,4 +313,4 @@ public void BuildArguments(ref ProcessArgumentBuilder builder)
{
// no-op
}
}
}
6 changes: 3 additions & 3 deletions src/Cake.7zip/Cake.7zip.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
Expand Down Expand Up @@ -39,8 +39,8 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Cake.Core" Version="4.0.0" PrivateAssets="All" />
<PackageReference Include="CakeContrib.Guidelines" Version="1.5.1" PrivateAssets="All" />
<PackageReference Include="Cake.Core" Version="5.0.0" PrivateAssets="All" />
<PackageReference Include="CakeContrib.Guidelines" Version="1.6.1" PrivateAssets="All" />
<PackageReference Include="IDisposableAnalyzers" Version="4.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down

0 comments on commit d544138

Please sign in to comment.