Skip to content

Commit

Permalink
(cake-buildGH-4346) Remove Unsupported TFMS net6.0 & net7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
devlead committed Oct 26, 2024
1 parent 5dc6ed3 commit c6b15f7
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 63 deletions.
4 changes: 1 addition & 3 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -368,8 +368,6 @@ Task("Run-Integration-Tests")
.DeferOnError()
.DoesForEach<BuildParameters, FilePath>(
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) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ 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;

// When
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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 0 additions & 2 deletions src/Cake/Cake.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,5 @@
<PackageReference Include="System.Reflection.Metadata" />
<PackageReference Include="Autofac" />
<PackageReference Include="Basic.Reference.Assemblies.Net80" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="Basic.Reference.Assemblies.Net70" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageReference Include="Basic.Reference.Assemblies.Net60" Condition="'$(TargetFramework)' == 'net6.0'" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ public Assembly[] GetReferenceAssemblies()
IEnumerable<Assembly> 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
{
Expand Down
2 changes: 0 additions & 2 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageVersion Include="Autofac" Version="8.1.1" />
<PackageVersion Include="Basic.Reference.Assemblies.Net60" Version="1.7.9" />
<PackageVersion Include="Basic.Reference.Assemblies.Net70" Version="1.7.9" />
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.7.9" />
<PackageVersion Include="Cake.Frosting" Version="3.1.0.0" />
<PackageVersion Include="Castle.Core" Version="5.1.1" />
Expand Down
6 changes: 1 addition & 5 deletions src/Shared.msbuild
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<!-- General package metadata -->
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<PackageId>$(AssemblyName)</PackageId>
<Copyright>Copyright (c) .NET Foundation and contributors</Copyright>
<Authors>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</Authors>
Expand All @@ -14,10 +14,6 @@
<PackageProjectUrl>https://cakebuild.net</PackageProjectUrl>
<LangVersion>9.0</LangVersion>
<PackageReadmeFile>NuGet.org.md</PackageReadmeFile>
</PropertyGroup>

<!-- Define .NET Core constants -->
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'net8.0'">
<NetStandardImplicitPackageVersion>2.0.0</NetStandardImplicitPackageVersion>
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
<DebugType>portable</DebugType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ Setup(
Task("ValidateEnvironment")
.DoesForEach<BuildData, string>(
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))
Expand All @@ -31,17 +29,13 @@ Task("ValidatePath")
.DoesForEach<BuildData, string>(
new [] {
"Cake\\WTool\\Wtools\\Wnet8\\W0",
"Cake\\WTool\\Wtools\\Wnet7\\W0",
"Cake\\WTool\\Wtools\\Wnet6\\W0"
},
(data, path) => Assert.Matches(path, data.Path)
);

Task("ValidateVariable")
.DoesForEach<BuildData, string>(
() => 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<string>(varKey))
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/Cake.Core/Scripting/AddinDirective.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
);
Expand Down
24 changes: 3 additions & 21 deletions tests/integration/Cake.Core/Scripting/DefineDirective.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -114,9 +109,6 @@ public record CSharpNine(bool IsNine);
""";
});

#endif

#if NET8_0
Task("Cake.Core.Scripting.DefineDirective.C#12")
.Does(() =>
{
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/Cake.Frosting/build/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<PackAsTool>true</PackAsTool>

<!-- Make sure start same folder .NET Core CLI and Visual Studio -->
Expand Down

0 comments on commit c6b15f7

Please sign in to comment.