From c6b15f7ba6cdcaa27832db9593b12b0f09d92edb Mon Sep 17 00:00:00 2001 From: Mattias Karlsson Date: Sat, 26 Oct 2024 16:36:44 +0200 Subject: [PATCH] (GH-4346) Remove Unsupported TFMS net6.0 & net7.0 * fixes #4346 --- build.cake | 4 +--- .../Package/Add/DotNetPackageAdderTests.cs | 4 ++-- .../Package/List/DotNetPackageListerTests.cs | 4 ++-- .../Add/DotNetReferenceAdderTests.cs | 4 ++-- .../Remove/DotNetReferenceRemoverTests.cs | 4 ++-- .../.template.config/template.json | 8 ------- src/Cake/Cake.csproj | 2 -- .../Scripting/ReferenceAssemblyResolver.cs | 6 +---- src/Directory.Packages.props | 2 -- src/Shared.msbuild | 6 +---- .../ValidateGitHubActionsProvider.cake | 6 ----- .../Cake.Core/Scripting/AddinDirective.cake | 2 -- .../Cake.Core/Scripting/DefineDirective.cake | 24 +++---------------- .../Cake.Frosting/build/Build.csproj | 2 +- 14 files changed, 15 insertions(+), 63 deletions(-) diff --git a/build.cake b/build.cake index d8132b7a55..8ab21e4d2f 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", "net8.0" }) + foreach(var framework in new[] { "net8.0" }) { FilePath testResultsPath = MakeAbsolute(parameters.Paths.Directories.TestResults .CombineWithFilePath($"{project.GetFilenameWithoutExtension()}_{framework}_TestResults.xml")); @@ -368,8 +368,6 @@ Task("Run-Integration-Tests") .DeferOnError() .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}/**/net8.0/**/Cake.dll").Single() }, (parameters, cakeAssembly, context) => diff --git a/src/Cake.Common.Tests/Unit/Tools/DotNet/Package/Add/DotNetPackageAdderTests.cs b/src/Cake.Common.Tests/Unit/Tools/DotNet/Package/Add/DotNetPackageAdderTests.cs index f447412a7f..ac19bb0f41 100644 --- a/src/Cake.Common.Tests/Unit/Tools/DotNet/Package/Add/DotNetPackageAdderTests.cs +++ b/src/Cake.Common.Tests/Unit/Tools/DotNet/Package/Add/DotNetPackageAdderTests.cs @@ -95,7 +95,7 @@ public void Should_Add_Additional_Arguments() // Given var fixture = new DotNetPackageAdderFixture(); fixture.PackageName = "Microsoft.AspNetCore.StaticFiles"; - fixture.Settings.Framework = "net7.0"; + fixture.Settings.Framework = "net8.0"; fixture.Settings.Interactive = true; fixture.Settings.NoRestore = true; fixture.Settings.PackageDirectory = "./src/project"; @@ -108,7 +108,7 @@ public void Should_Add_Additional_Arguments() var result = fixture.Run(); // Then - var expected = "add package Microsoft.AspNetCore.StaticFiles --framework net7.0 --interactive --no-restore --package-directory \"/Working/src/project\" --prerelease --source \"http://www.nuget.org/api/v2/package\" --version \"1.0.0\" --verbosity diagnostic"; + var expected = "add package Microsoft.AspNetCore.StaticFiles --framework net8.0 --interactive --no-restore --package-directory \"/Working/src/project\" --prerelease --source \"http://www.nuget.org/api/v2/package\" --version \"1.0.0\" --verbosity diagnostic"; Assert.Equal(expected, result.Args); } } diff --git a/src/Cake.Common.Tests/Unit/Tools/DotNet/Package/List/DotNetPackageListerTests.cs b/src/Cake.Common.Tests/Unit/Tools/DotNet/Package/List/DotNetPackageListerTests.cs index 55e2c03fa6..3444eab001 100644 --- a/src/Cake.Common.Tests/Unit/Tools/DotNet/Package/List/DotNetPackageListerTests.cs +++ b/src/Cake.Common.Tests/Unit/Tools/DotNet/Package/List/DotNetPackageListerTests.cs @@ -78,7 +78,7 @@ public void Should_Add_Additional_Arguments() var fixture = new DotNetPackageListerFixture(); fixture.Settings.ConfigFile = "./nuget.config"; fixture.Settings.Deprecated = true; - fixture.Settings.Framework = "net7.0"; + fixture.Settings.Framework = "net8.0"; fixture.Settings.HighestMinor = true; fixture.Settings.HighestPatch = true; fixture.Settings.Prerelease = true; @@ -94,7 +94,7 @@ public void Should_Add_Additional_Arguments() var result = fixture.Run(); // Then - var expected = "list package --config \"/Working/nuget.config\" --deprecated --framework net7.0 --highest-minor --highest-patch --include-prerelease --include-transitive --interactive --outdated "; + var expected = "list package --config \"/Working/nuget.config\" --deprecated --framework net8.0 --highest-minor --highest-patch --include-prerelease --include-transitive --interactive --outdated "; expected += "--source \"http://www.nuget.org/api/v2/package\" --source \"http://www.symbolserver.org/\" --vulnerable --format json --output-version 1"; Assert.Equal(expected, result.Args); } diff --git a/src/Cake.Common.Tests/Unit/Tools/DotNet/Reference/Add/DotNetReferenceAdderTests.cs b/src/Cake.Common.Tests/Unit/Tools/DotNet/Reference/Add/DotNetReferenceAdderTests.cs index 7fcbb0a737..89efc4345d 100644 --- a/src/Cake.Common.Tests/Unit/Tools/DotNet/Reference/Add/DotNetReferenceAdderTests.cs +++ b/src/Cake.Common.Tests/Unit/Tools/DotNet/Reference/Add/DotNetReferenceAdderTests.cs @@ -143,7 +143,7 @@ public void Should_Add_Additional_Arguments() var fixture = new DotNetReferenceAdderFixture(); fixture.ProjectReferences = new[] { (FilePath)"./lib1.csproj" }; fixture.Project = "ToDo.csproj"; - fixture.Settings.Framework = "net7.0"; + fixture.Settings.Framework = "net8.0"; fixture.Settings.Interactive = true; fixture.Settings.Verbosity = DotNetVerbosity.Diagnostic; @@ -151,7 +151,7 @@ public void Should_Add_Additional_Arguments() var result = fixture.Run(); // Then - var expected = "add \"ToDo.csproj\" reference \"/Working/lib1.csproj\" --framework net7.0 --interactive --verbosity diagnostic"; + var expected = "add \"ToDo.csproj\" reference \"/Working/lib1.csproj\" --framework net8.0 --interactive --verbosity diagnostic"; Assert.Equal(expected, result.Args); } } diff --git a/src/Cake.Common.Tests/Unit/Tools/DotNet/Reference/Remove/DotNetReferenceRemoverTests.cs b/src/Cake.Common.Tests/Unit/Tools/DotNet/Reference/Remove/DotNetReferenceRemoverTests.cs index 083362daac..d8e0ddda51 100644 --- a/src/Cake.Common.Tests/Unit/Tools/DotNet/Reference/Remove/DotNetReferenceRemoverTests.cs +++ b/src/Cake.Common.Tests/Unit/Tools/DotNet/Reference/Remove/DotNetReferenceRemoverTests.cs @@ -143,14 +143,14 @@ public void Should_Add_Additional_Arguments() var fixture = new DotNetReferenceRemoverFixture(); fixture.ProjectReferences = new[] { (FilePath)"./lib1.csproj" }; fixture.Project = "ToDo.csproj"; - fixture.Settings.Framework = "net7.0"; + fixture.Settings.Framework = "net8.0"; fixture.Settings.Verbosity = DotNetVerbosity.Diagnostic; // When var result = fixture.Run(); // Then - var expected = "remove \"ToDo.csproj\" reference \"/Working/lib1.csproj\" --framework net7.0 --verbosity diagnostic"; + var expected = "remove \"ToDo.csproj\" reference \"/Working/lib1.csproj\" --framework net8.0 --verbosity diagnostic"; Assert.Equal(expected, result.Args); } } 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 e146824c5a..932042d6cc 100644 --- a/src/Cake.Frosting.Template/templates/cakefrosting/.template.config/template.json +++ b/src/Cake.Frosting.Template/templates/cakefrosting/.template.config/template.json @@ -20,14 +20,6 @@ "defaultValue": "net8.0", "replaces": "TargetFrameworkValue", "choices": [ - { - "choice": "net6.0", - "description": "Target .NET 6" - }, - { - "choice": "net7.0", - "description": "Target .NET 7" - }, { "choice": "net8.0", "description": "Target .NET 8" diff --git a/src/Cake/Cake.csproj b/src/Cake/Cake.csproj index 9a0c6c7247..1e7b560745 100644 --- a/src/Cake/Cake.csproj +++ b/src/Cake/Cake.csproj @@ -31,7 +31,5 @@ - - \ No newline at end of file diff --git a/src/Cake/Infrastructure/Scripting/ReferenceAssemblyResolver.cs b/src/Cake/Infrastructure/Scripting/ReferenceAssemblyResolver.cs index aa84dd8655..9e41891147 100644 --- a/src/Cake/Infrastructure/Scripting/ReferenceAssemblyResolver.cs +++ b/src/Cake/Infrastructure/Scripting/ReferenceAssemblyResolver.cs @@ -22,11 +22,7 @@ public Assembly[] GetReferenceAssemblies() IEnumerable TryGetReferenceAssemblies() { foreach (var reference in -#if NET6_0 - Basic.Reference.Assemblies.Net60.References.All) -#elif NET7_0 - Basic.Reference.Assemblies.Net70.References.All) -#else +#if NET8_0 Basic.Reference.Assemblies.Net80.References.All) #endif { diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 9164175f83..ad7b587913 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -7,8 +7,6 @@ - - diff --git a/src/Shared.msbuild b/src/Shared.msbuild index 13bbb99e00..115ee18532 100644 --- a/src/Shared.msbuild +++ b/src/Shared.msbuild @@ -1,7 +1,7 @@ - net6.0;net7.0;net8.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 @@ -14,10 +14,6 @@ https://cakebuild.net 9.0 NuGet.org.md - - - - 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 66075a10ad..08dbf6c4ff 100644 --- a/tests/integration/Cake.Common/Build/GitHubActions/ValidateGitHubActionsProvider.cake +++ b/tests/integration/Cake.Common/Build/GitHubActions/ValidateGitHubActionsProvider.cake @@ -20,8 +20,6 @@ Setup( Task("ValidateEnvironment") .DoesForEach( data => new [] { - $"CAKE_{data.OS}_NETCOREAPP_6_0_VERSION", - $"CAKE_{data.OS}_NETCOREAPP_7_0_VERSION", $"CAKE_{data.OS}_NETCOREAPP_8_0_VERSION" }, (data, envKey) => Assert.Equal(data.GitVersion, EnvironmentVariable(envKey)) @@ -31,8 +29,6 @@ Task("ValidatePath") .DoesForEach( new [] { "Cake\\WTool\\Wtools\\Wnet8\\W0", - "Cake\\WTool\\Wtools\\Wnet7\\W0", - "Cake\\WTool\\Wtools\\Wnet6\\W0" }, (data, path) => Assert.Matches(path, data.Path) ); @@ -40,8 +36,6 @@ Task("ValidatePath") Task("ValidateVariable") .DoesForEach( () => new [] { - "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.Core/Scripting/AddinDirective.cake b/tests/integration/Cake.Core/Scripting/AddinDirective.cake index 678504e28d..95a2276370 100644 --- a/tests/integration/Cake.Core/Scripting/AddinDirective.cake +++ b/tests/integration/Cake.Core/Scripting/AddinDirective.cake @@ -23,8 +23,6 @@ Task("Cake.Core.Scripting.AddinDirective.LoadTargetedAddin") .SetTargetFramework( cake switch { - FilePath net6_0Path when net6_0Path.FullPath.Contains("net6.0") => "net6.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 9e55338918..338eb41218 100644 --- a/tests/integration/Cake.Core/Scripting/DefineDirective.cake +++ b/tests/integration/Cake.Core/Scripting/DefineDirective.cake @@ -70,8 +70,7 @@ Task("Cake.Core.Scripting.DefineDirective.Cake") Assert.True(cake); }); -#if NET6_0 || NET7_0 || NET8_0 - Task("Cake.Core.Scripting.DefineDirective.C#9") +Task("Cake.Core.Scripting.DefineDirective.C#9") .Does(() => { // given @@ -80,10 +79,8 @@ Task("Cake.Core.Scripting.DefineDirective.Cake") }); public record CSharpNine(bool IsNine); -#endif -#if NET6_0 || NET7_0 || NET8_0 - Task("Cake.Core.Scripting.DefineDirective.C#10") +Task("Cake.Core.Scripting.DefineDirective.C#10") .Does(() => { // Given @@ -97,10 +94,8 @@ public record CSharpNine(bool IsNine); Assert.Equal("Hello world!", helloWorld); }); -#endif -#if NET7_0 || NET8_0 - Task("Cake.Core.Scripting.DefineDirective.C#11") +Task("Cake.Core.Scripting.DefineDirective.C#11") .Does(() => { // Given / When / Then @@ -114,9 +109,6 @@ public record CSharpNine(bool IsNine); """; }); -#endif - -#if NET8_0 Task("Cake.Core.Scripting.DefineDirective.C#12") .Does(() => { @@ -127,23 +119,13 @@ public record CSharpNine(bool IsNine); int[] single = [..row0, ..row1, ..row2]; }); -#endif - ////////////////////////////////////////////////////////////////////////////// Task("Cake.Core.Scripting.DefineDirective") -#if NET6_0 || NET7_0 || NET8_0 .IsDependentOn("Cake.Core.Scripting.DefineDirective.C#9") -#endif -#if NET6_0 || NET7_0 || NET8_0 .IsDependentOn("Cake.Core.Scripting.DefineDirective.C#10") -#endif -#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") .IsDependentOn("Cake.Core.Scripting.DefineDirective.Runtime") diff --git a/tests/integration/Cake.Frosting/build/Build.csproj b/tests/integration/Cake.Frosting/build/Build.csproj index cfa2e4c11c..a639aac6e2 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;net8.0 + net8.0 true