From 68f66030e0dd55c4fac754b4adf19dfa402d93ca Mon Sep 17 00:00:00 2001 From: Mattias Karlsson Date: Wed, 15 Nov 2023 08:21:31 +0100 Subject: [PATCH] (GH-4252) Update .NET SDK to 8.0.100 * fixes #4252 --- .github/workflows/build.yml | 10 ++++-- GitVersion.yml | 2 +- build.cake | 5 +-- global.json | 2 +- src/Cake.Core.Tests/Unit/CakeRuntimeTests.cs | 4 ++- src/Cake.Core/Scripting/ScriptConventions.cs | 3 ++ .../Cake.Frosting.Template.csproj | 2 +- .../.template.config/template.json | 6 +++- src/Cake/Cake.csproj | 3 +- .../Scripting/ReferenceAssemblyResolver.cs | 4 ++- src/Shared.msbuild | 4 +-- .../ValidateGitHubActionsProvider.cake | 9 +++-- .../Tools/Command/CommandAliases.cake | 33 +++++++++++++++---- .../Tools/DotNet/DotNetAliases.cake | 10 +++--- .../Cake.Core/Scripting/AddinDirective.cake | 3 +- .../Cake.Core/Scripting/DefineDirective.cake | 30 +++++++++++++---- .../Cake.Frosting/build/Build.csproj | 2 +- .../DotNet/hwapp.tests/hwapp.tests.csproj | 13 +++++--- .../Tools/DotNet/hwapp/hwapp.csproj | 2 +- 19 files changed, 105 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d5111f6d32..b3fd7400d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,10 +20,13 @@ jobs: with: fetch-depth: 0 - - name: Install .NET SDK 6.0.x + - name: Install .NET SDK 6.0.x - 8.0.x uses: actions/setup-dotnet@v3 with: - dotnet-version: '6.0.x' + dotnet-version: | + '6.0.x' + '7.0.x' + '8.0.x' - name: Install .NET Core SDK (global.json) uses: actions/setup-dotnet@v3 @@ -46,4 +49,5 @@ jobs: arguments: | CAKE_NETCOREAPP_6_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_6_0_VERSION_OS }} CAKE_NETCOREAPP_7_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_7_0_VERSION_OS }} - + CAKE_NETCOREAPP_8_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_8_0_VERSION_OS }} + ValidateGitHubActionsProvider: true diff --git a/GitVersion.yml b/GitVersion.yml index e34c9bf3b0..08f41c59b1 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,4 +1,4 @@ -next-version: 3.0.0 +next-version: 4.0.0 branches: master: regex: main diff --git a/build.cake b/build.cake index 41a4007690..a74183d668 100644 --- a/build.cake +++ b/build.cake @@ -108,7 +108,7 @@ Task("Run-Unit-Tests") () => GetFiles("./src/**/*.Tests.csproj"), (parameters, project, context) => { - foreach(var framework in new[] { "net6.0", "net7.0" }) + foreach(var framework in new[] { "net6.0", "net7.0", "net8.0" }) { FilePath testResultsPath = MakeAbsolute(parameters.Paths.Directories.TestResults .CombineWithFilePath($"{project.GetFilenameWithoutExtension()}_{framework}_TestResults.xml")); @@ -368,7 +368,8 @@ Task("Run-Integration-Tests") .DoesForEach( parameters => new[] { GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net6.0/**/Cake.dll").Single(), - GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net7.0/**/Cake.dll").Single() + GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net7.0/**/Cake.dll").Single(), + GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net8.0/**/Cake.dll").Single() }, (parameters, cakeAssembly, context) => { diff --git a/global.json b/global.json index 52954cc8d6..05239f3b96 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "src" ], "sdk": { - "version": "7.0.403", + "version": "8.0.100", "rollForward": "latestFeature" } } \ No newline at end of file diff --git a/src/Cake.Core.Tests/Unit/CakeRuntimeTests.cs b/src/Cake.Core.Tests/Unit/CakeRuntimeTests.cs index 65cb681b09..54a72754a1 100644 --- a/src/Cake.Core.Tests/Unit/CakeRuntimeTests.cs +++ b/src/Cake.Core.Tests/Unit/CakeRuntimeTests.cs @@ -39,7 +39,9 @@ public void Should_Return_Correct_Result_For_CoreClr() Assert.Equal(".NETStandard,Version=v2.0", framework.FullName); #else var expect = string.Concat(".NETCoreApp,Version=v", -#if NET7_0 +#if NET8_0 + "8.0"); +#elif NET7_0 "7.0"); #elif NET6_0 "6.0"); diff --git a/src/Cake.Core/Scripting/ScriptConventions.cs b/src/Cake.Core/Scripting/ScriptConventions.cs index 91d6115467..10d76814dc 100644 --- a/src/Cake.Core/Scripting/ScriptConventions.cs +++ b/src/Cake.Core/Scripting/ScriptConventions.cs @@ -125,6 +125,9 @@ private string GetFrameworkDefine() case ".NETCoreApp,Version=v7.0": return "NET7_0"; + case ".NETCoreApp,Version=v8.0": + return "NET8_0"; + default: Console.Error.WriteLine(_runtime.BuiltFramework.FullName); Console.Error.Flush(); diff --git a/src/Cake.Frosting.Template/Cake.Frosting.Template.csproj b/src/Cake.Frosting.Template/Cake.Frosting.Template.csproj index b2d7b86f2e..36aec71de6 100644 --- a/src/Cake.Frosting.Template/Cake.Frosting.Template.csproj +++ b/src/Cake.Frosting.Template/Cake.Frosting.Template.csproj @@ -5,7 +5,7 @@ Cake.Frosting.Template Cake.Frosting templates for the .NET SDK. Cake.Frosting templates for the .NET SDK. - net7.0 + net8.0 true false content diff --git a/src/Cake.Frosting.Template/templates/cakefrosting/.template.config/template.json b/src/Cake.Frosting.Template/templates/cakefrosting/.template.config/template.json index 46901ce9f3..46c25f425a 100644 --- a/src/Cake.Frosting.Template/templates/cakefrosting/.template.config/template.json +++ b/src/Cake.Frosting.Template/templates/cakefrosting/.template.config/template.json @@ -17,7 +17,7 @@ "type": "parameter", "description": "The target framework for the project.", "datatype": "choice", - "defaultValue": "net7.0", + "defaultValue": "net8.0", "replaces": "TargetFrameworkValue", "choices": [ { @@ -27,6 +27,10 @@ { "choice": "net7.0", "description": "Target .NET 7" + }, + { + "choice": "net8.0", + "description": "Target .NET 7" } ] } diff --git a/src/Cake/Cake.csproj b/src/Cake/Cake.csproj index f3f9ca5719..2e101eb3cc 100644 --- a/src/Cake/Cake.csproj +++ b/src/Cake/Cake.csproj @@ -26,10 +26,11 @@ - + + diff --git a/src/Cake/Infrastructure/Scripting/ReferenceAssemblyResolver.cs b/src/Cake/Infrastructure/Scripting/ReferenceAssemblyResolver.cs index 3c20c2b706..aa84dd8655 100644 --- a/src/Cake/Infrastructure/Scripting/ReferenceAssemblyResolver.cs +++ b/src/Cake/Infrastructure/Scripting/ReferenceAssemblyResolver.cs @@ -24,8 +24,10 @@ IEnumerable TryGetReferenceAssemblies() foreach (var reference in #if NET6_0 Basic.Reference.Assemblies.Net60.References.All) -#else +#elif NET7_0 Basic.Reference.Assemblies.Net70.References.All) +#else + Basic.Reference.Assemblies.Net80.References.All) #endif { Assembly assembly; diff --git a/src/Shared.msbuild b/src/Shared.msbuild index c394ab929a..5de0cd2088 100644 --- a/src/Shared.msbuild +++ b/src/Shared.msbuild @@ -1,7 +1,7 @@ - net6.0;net7.0 + net6.0;net7.0;net8.0 $(AssemblyName) Copyright (c) .NET Foundation and contributors Patrik Svensson, Mattias Karlsson, Gary Ewan Park, Alistair Chapman, Martin Björkström, Dave Glick, Pascal Berger, Jérémie Desautels, Enrico Campidoglio, C. Augusto Proiete, Nils Andresen, and contributors @@ -17,7 +17,7 @@ - + 2.0.0 $(DefineConstants);NETCORE portable diff --git a/tests/integration/Cake.Common/Build/GitHubActions/ValidateGitHubActionsProvider.cake b/tests/integration/Cake.Common/Build/GitHubActions/ValidateGitHubActionsProvider.cake index 85afae1e8c..66075a10ad 100644 --- a/tests/integration/Cake.Common/Build/GitHubActions/ValidateGitHubActionsProvider.cake +++ b/tests/integration/Cake.Common/Build/GitHubActions/ValidateGitHubActionsProvider.cake @@ -21,7 +21,8 @@ Task("ValidateEnvironment") .DoesForEach( data => new [] { $"CAKE_{data.OS}_NETCOREAPP_6_0_VERSION", - $"CAKE_{data.OS}_NETCOREAPP_7_0_VERSION" + $"CAKE_{data.OS}_NETCOREAPP_7_0_VERSION", + $"CAKE_{data.OS}_NETCOREAPP_8_0_VERSION" }, (data, envKey) => Assert.Equal(data.GitVersion, EnvironmentVariable(envKey)) ); @@ -29,6 +30,7 @@ Task("ValidateEnvironment") Task("ValidatePath") .DoesForEach( new [] { + "Cake\\WTool\\Wtools\\Wnet8\\W0", "Cake\\WTool\\Wtools\\Wnet7\\W0", "Cake\\WTool\\Wtools\\Wnet6\\W0" }, @@ -38,8 +40,9 @@ Task("ValidatePath") Task("ValidateVariable") .DoesForEach( () => new [] { - $"CAKE_NETCOREAPP_6_0_VERSION_OS", - $"CAKE_NETCOREAPP_7_0_VERSION_OS" + "CAKE_NETCOREAPP_6_0_VERSION_OS", + "CAKE_NETCOREAPP_7_0_VERSION_OS", + "CAKE_NETCOREAPP_8_0_VERSION_OS" }, (data, varKey) => Assert.Equal(data.GitVersionAndOS, Argument(varKey)) ); diff --git a/tests/integration/Cake.Common/Tools/Command/CommandAliases.cake b/tests/integration/Cake.Common/Tools/Command/CommandAliases.cake index 835911d09d..34ecc2f4f4 100644 --- a/tests/integration/Cake.Common/Tools/Command/CommandAliases.cake +++ b/tests/integration/Cake.Common/Tools/Command/CommandAliases.cake @@ -31,9 +31,16 @@ Task("Cake.Common.Tools.Command.CommandAliases.CommandStandardOutput") List tools installed globally or locally. Usage: - dotnet tool list [options] + dotnet tool list [] [options] -Options:"; +Arguments: + The NuGet Package Id of the tool to list + +Options: + -g, --global List tools installed for the current user. + --local List the tools installed in the local tool manifest. + --tool-path The directory containing the tools to list. + -?, -h, --help Show command line help."; // When var exitCode = ctx.Command(settings.ToolExecutableNames, out var standardOutput, "tool list -h"); @@ -53,9 +60,16 @@ Task("Cake.Common.Tools.Command.CommandAliases.CommandStandardOutput.Settings") List tools installed globally or locally. Usage: - dotnet tool list [options] + dotnet tool list [] [options] + +Arguments: + The NuGet Package Id of the tool to list -Options:"; +Options: + -g, --global List tools installed for the current user. + --local List the tools installed in the local tool manifest. + --tool-path The directory containing the tools to list. + -?, -h, --help Show command line help."; // When var exitCode = ctx.Command(settings, out var standardOutput, "tool list -h"); @@ -75,9 +89,16 @@ Task("Cake.Common.Tools.Command.CommandAliases.CommandStandardOutput.SettingsCus List tools installed globally or locally. Usage: - dotnet tool list [options] + dotnet tool list [] [options] + +Arguments: + The NuGet Package Id of the tool to list -Options:"; +Options: + -g, --global List tools installed for the current user. + --local List the tools installed in the local tool manifest. + --tool-path The directory containing the tools to list. + -?, -h, --help Show command line help."; // When var exitCode = ctx.Command( diff --git a/tests/integration/Cake.Common/Tools/DotNet/DotNetAliases.cake b/tests/integration/Cake.Common/Tools/DotNet/DotNetAliases.cake index 66e835d469..63f9ef61f2 100644 --- a/tests/integration/Cake.Common/Tools/DotNet/DotNetAliases.cake +++ b/tests/integration/Cake.Common/Tools/DotNet/DotNetAliases.cake @@ -34,7 +34,7 @@ Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetBuild") // Given var path = Paths.Temp.Combine("./Cake.Common/Tools/DotNet"); var project = path.CombineWithFilePath("hwapp/hwapp.csproj"); - var assembly = path.CombineWithFilePath("hwapp/bin/Debug/net7.0/hwapp.dll"); + var assembly = path.CombineWithFilePath("hwapp/bin/Debug/net8.0/hwapp.dll"); // When DotNetBuild(project.FullPath); @@ -61,7 +61,7 @@ Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetVSTest") { // Given var path = Paths.Temp.Combine("./Cake.Common/Tools/DotNet"); - var assembly = path.CombineWithFilePath("hwapp.tests/bin/Debug/net7.0/hwapp.tests.dll"); + var assembly = path.CombineWithFilePath("hwapp.tests/bin/Debug/net8.0/hwapp.tests.dll"); // When DotNetVSTest(assembly.FullPath); @@ -184,7 +184,7 @@ Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetExecute") { // Given var path = Paths.Temp.Combine("./Cake.Common/Tools/DotNet"); - var assembly = path.CombineWithFilePath("hwapp/bin/Debug/net7.0/hwapp.dll"); + var assembly = path.CombineWithFilePath("hwapp/bin/Debug/net8.0/hwapp.dll"); // When DotNetExecute(assembly); @@ -197,7 +197,7 @@ Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetClean") // Given var path = Paths.Temp.Combine("./Cake.Common/Tools/DotNet"); var project = path.CombineWithFilePath("hwapp/hwapp.csproj"); - var assembly = path.CombineWithFilePath("hwapp/bin/Debug/net7.0/hwapp.dll"); + var assembly = path.CombineWithFilePath("hwapp/bin/Debug/net8.0/hwapp.dll"); Assert.True(System.IO.File.Exists(assembly.FullPath)); // When @@ -214,7 +214,7 @@ Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetMSBuild") // Given var path = Paths.Temp.Combine("./Cake.Common/Tools/DotNet"); var project = path.CombineWithFilePath("hwapp/hwapp.csproj"); - var assembly = path.CombineWithFilePath("hwapp/bin/Debug/net7.0/hwapp.dll"); + var assembly = path.CombineWithFilePath("hwapp/bin/Debug/net8.0/hwapp.dll"); // When DotNetMSBuild(project.FullPath); diff --git a/tests/integration/Cake.Core/Scripting/AddinDirective.cake b/tests/integration/Cake.Core/Scripting/AddinDirective.cake index 7ed5a21702..f9ee839f33 100644 --- a/tests/integration/Cake.Core/Scripting/AddinDirective.cake +++ b/tests/integration/Cake.Core/Scripting/AddinDirective.cake @@ -24,7 +24,8 @@ Task("Cake.Core.Scripting.AddinDirective.LoadTargetedAddin") cake switch { FilePath net6_0Path when net6_0Path.FullPath.Contains("net6.0") => "net6.0", - _ => "net7.0" + FilePath net7_0Path when net7_0Path.FullPath.Contains("net7.0") => "net7.0", + _ => "net8.0" } ); diff --git a/tests/integration/Cake.Core/Scripting/DefineDirective.cake b/tests/integration/Cake.Core/Scripting/DefineDirective.cake index 201d8dc6a2..9e55338918 100644 --- a/tests/integration/Cake.Core/Scripting/DefineDirective.cake +++ b/tests/integration/Cake.Core/Scripting/DefineDirective.cake @@ -52,6 +52,8 @@ Task("Cake.Core.Scripting.DefineDirective.Runtime") "6.0", #elif NET7_0 "7.0", +#elif NET8_0 + "8.0", #endif context.Environment.Runtime.BuiltFramework.FullName); }); @@ -68,7 +70,7 @@ Task("Cake.Core.Scripting.DefineDirective.Cake") Assert.True(cake); }); -#if NET6_0 || NET7_0 +#if NET6_0 || NET7_0 || NET8_0 Task("Cake.Core.Scripting.DefineDirective.C#9") .Does(() => { @@ -80,7 +82,7 @@ Task("Cake.Core.Scripting.DefineDirective.Cake") public record CSharpNine(bool IsNine); #endif -#if NET6_0 || NET7_0 +#if NET6_0 || NET7_0 || NET8_0 Task("Cake.Core.Scripting.DefineDirective.C#10") .Does(() => { @@ -97,7 +99,7 @@ public record CSharpNine(bool IsNine); #endif -#if NET7_0 +#if NET7_0 || NET8_0 Task("Cake.Core.Scripting.DefineDirective.C#11") .Does(() => { @@ -114,17 +116,33 @@ public record CSharpNine(bool IsNine); #endif +#if NET8_0 + Task("Cake.Core.Scripting.DefineDirective.C#12") + .Does(() => +{ + // Given / When / Then + int[] row0 = [1, 2, 3]; + int[] row1 = [4, 5, 6]; + int[] row2 = [7, 8, 9]; + int[] single = [..row0, ..row1, ..row2]; +}); + +#endif + ////////////////////////////////////////////////////////////////////////////// Task("Cake.Core.Scripting.DefineDirective") -#if NET6_0 || NET7_0 +#if NET6_0 || NET7_0 || NET8_0 .IsDependentOn("Cake.Core.Scripting.DefineDirective.C#9") #endif -#if NET6_0 || NET7_0 +#if NET6_0 || NET7_0 || NET8_0 .IsDependentOn("Cake.Core.Scripting.DefineDirective.C#10") #endif -#if NET7_0 +#if NET7_0 || NET8_0 .IsDependentOn("Cake.Core.Scripting.DefineDirective.C#11") +#endif +#if NET8_0 + .IsDependentOn("Cake.Core.Scripting.DefineDirective.C#12") #endif .IsDependentOn("Cake.Core.Scripting.DefineDirective.Defined") .IsDependentOn("Cake.Core.Scripting.DefineDirective.NotDefined") diff --git a/tests/integration/Cake.Frosting/build/Build.csproj b/tests/integration/Cake.Frosting/build/Build.csproj index 967a3cf7fc..cfa2e4c11c 100644 --- a/tests/integration/Cake.Frosting/build/Build.csproj +++ b/tests/integration/Cake.Frosting/build/Build.csproj @@ -2,7 +2,7 @@ Exe - net6.0;net7.0 + net6.0;net7.0;net8.0 true diff --git a/tests/integration/resources/Cake.Common/Tools/DotNet/hwapp.tests/hwapp.tests.csproj b/tests/integration/resources/Cake.Common/Tools/DotNet/hwapp.tests/hwapp.tests.csproj index 809b83300c..5ba87a6f84 100644 --- a/tests/integration/resources/Cake.Common/Tools/DotNet/hwapp.tests/hwapp.tests.csproj +++ b/tests/integration/resources/Cake.Common/Tools/DotNet/hwapp.tests/hwapp.tests.csproj @@ -1,15 +1,18 @@  - net7.0 + net8.0 false - - - - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + diff --git a/tests/integration/resources/Cake.Common/Tools/DotNet/hwapp/hwapp.csproj b/tests/integration/resources/Cake.Common/Tools/DotNet/hwapp/hwapp.csproj index c54cbbeb30..b2fa4dff47 100644 --- a/tests/integration/resources/Cake.Common/Tools/DotNet/hwapp/hwapp.csproj +++ b/tests/integration/resources/Cake.Common/Tools/DotNet/hwapp/hwapp.csproj @@ -1,7 +1,7 @@  Exe - net7.0 + net8.0