Skip to content

Commit

Permalink
(GH-4252) Update .NET SDK to 8.0.100
Browse files Browse the repository at this point in the history
 * fixes #4252
  • Loading branch information
devlead committed Nov 15, 2023
1 parent 8f6e170 commit f33a3f5
Show file tree
Hide file tree
Showing 19 changed files with 106 additions and 41 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ jobs:
with:
dotnet-version: '6.0.x'

- name: Install .NET SDK 7.0.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'

- name: Install .NET Core SDK (global.json)
uses: actions/setup-dotnet@v3
with:
Expand All @@ -46,4 +51,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
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
next-version: 3.0.0
next-version: 4.0.0
branches:
master:
regex: main
Expand Down
5 changes: 3 additions & 2 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" })
foreach(var framework in new[] { "net6.0", "net7.0", "net8.0" })
{
FilePath testResultsPath = MakeAbsolute(parameters.Paths.Directories.TestResults
.CombineWithFilePath($"{project.GetFilenameWithoutExtension()}_{framework}_TestResults.xml"));
Expand Down Expand Up @@ -368,7 +368,8 @@ Task("Run-Integration-Tests")
.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}/**/net7.0/**/Cake.dll").Single(),
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net8.0/**/Cake.dll").Single()
},
(parameters, cakeAssembly, context) =>
{
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"src"
],
"sdk": {
"version": "7.0.403",
"version": "8.0.100",
"rollForward": "latestFeature"
}
}
4 changes: 3 additions & 1 deletion src/Cake.Core.Tests/Unit/CakeRuntimeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
3 changes: 3 additions & 0 deletions src/Cake.Core/Scripting/ScriptConventions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Frosting.Template/Cake.Frosting.Template.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>Cake.Frosting.Template</AssemblyName>
<Title>Cake.Frosting templates for the .NET SDK.</Title>
<Description>Cake.Frosting templates for the .NET SDK.</Description>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IncludeContentInPack>true</IncludeContentInPack>
<IncludeBuildOutput>false</IncludeBuildOutput>
<ContentTargetFolders>content</ContentTargetFolders>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"type": "parameter",
"description": "The target framework for the project.",
"datatype": "choice",
"defaultValue": "net7.0",
"defaultValue": "net8.0",
"replaces": "TargetFrameworkValue",
"choices": [
{
Expand All @@ -27,6 +27,10 @@
{
"choice": "net7.0",
"description": "Target .NET 7"
},
{
"choice": "net8.0",
"description": "Target .NET 7"
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion src/Cake/Cake.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@

<!-- Global packages -->
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.7.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.8.0-3.final" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
<PackageReference Include="System.Reflection.Metadata" Version="8.0.0" />
<PackageReference Include="Autofac" Version="7.1.0" />
<PackageReference Include="Basic.Reference.Assemblies.Net80" Version="1.4.5" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="Basic.Reference.Assemblies.Net70" Version="1.4.5" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageReference Include="Basic.Reference.Assemblies.Net60" Version="1.4.5" Condition="'$(TargetFramework)' == 'net6.0'" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ IEnumerable<Assembly> 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;
Expand Down
4 changes: 2 additions & 2 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</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;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 @@ -17,7 +17,7 @@
</PropertyGroup>

<!-- Define .NET Core constants -->
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0' ">
<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 @@ -21,14 +21,16 @@ 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_7_0_VERSION",
$"CAKE_{data.OS}_NETCOREAPP_8_0_VERSION"
},
(data, envKey) => Assert.Equal(data.GitVersion, EnvironmentVariable(envKey))
(data, envKey) => Assert.Equal(data.GitVersion, EnvironmentVariable(envKey), envKey)
);

Task("ValidatePath")
.DoesForEach<BuildData, string>(
new [] {
"Cake\\WTool\\Wtools\\Wnet8\\W0",
"Cake\\WTool\\Wtools\\Wnet7\\W0",
"Cake\\WTool\\Wtools\\Wnet6\\W0"
},
Expand All @@ -38,8 +40,9 @@ Task("ValidatePath")
Task("ValidateVariable")
.DoesForEach<BuildData, string>(
() => 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<string>(varKey))
);
Expand Down
33 changes: 27 additions & 6 deletions tests/integration/Cake.Common/Tools/Command/CommandAliases.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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 [<packageId>] [options]
Options:";
Arguments:
<PACKAGE_ID> 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 <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");
Expand All @@ -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 [<packageId>] [options]
Arguments:
<PACKAGE_ID> 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 <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");
Expand All @@ -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 [<packageId>] [options]
Arguments:
<PACKAGE_ID> 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 <PATH> The directory containing the tools to list.
-?, -h, --help Show command line help.";
// When
var exitCode = ctx.Command(
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/Cake.Common/Tools/DotNet/DotNetAliases.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/Cake.Core/Scripting/AddinDirective.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
);
Expand Down
30 changes: 24 additions & 6 deletions tests/integration/Cake.Core/Scripting/DefineDirective.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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(() =>
{
Expand All @@ -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(() =>
{
Expand All @@ -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(() =>
{
Expand All @@ -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")
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</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<PackAsTool>true</PackAsTool>

<!-- Make sure start same folder .NET Core CLI and Visual Studio -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit f33a3f5

Please sign in to comment.