Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Task("Run-Unit-Tests")
() => GetFiles("./src/**/*.Tests.csproj"),
(parameters, project, context) =>
{
foreach (var framework in new[] { "net8.0", "net9.0" })
foreach (var framework in new[] { "net8.0", "net9.0", "net10.0" })
{
FilePath testResultsPath = MakeAbsolute(parameters.Paths.Directories.TestResults
.CombineWithFilePath($"{project.GetFilenameWithoutExtension()}_{framework}_TestResults.xml"));
Expand Down Expand Up @@ -400,7 +400,8 @@ Task("Run-Integration-Tests")
.DoesForEach<BuildParameters, FilePath>(
parameters => new[] {
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net8.0/**/Cake.dll").Single(),
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net9.0/**/Cake.dll").Single()
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net9.0/**/Cake.dll").Single(),
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net10.0/**/Cake.dll").Single()
},
(parameters, cakeAssembly, context) =>
{
Expand Down Expand Up @@ -469,7 +470,7 @@ Task("GitHubActions-Release")
{
throw new Exception("An error occurred during the publishing of Cake. All publishing tasks have been attempted.");
}
});;
});

Task("Travis")
.IsDependentOn("Run-Unit-Tests");
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": "9.0.306",
"version": "10.0.100",
"rollForward": "latestFeature"
}
}
6 changes: 4 additions & 2 deletions src/Cake.Core.Tests/Unit/CakeRuntimeTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand Down Expand Up @@ -38,7 +38,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 NET9_0
#if NET10_0
"10.0");
#elif NET9_0
"9.0");
#elif NET8_0
"8.0");
Expand Down
5 changes: 0 additions & 5 deletions src/Cake.Core/Cake.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,4 @@
</PropertyGroup>
<!-- Import shared functionality -->
<Import Project="..\Shared.msbuild" />

<ItemGroup>
<PackageReference Include="Microsoft.Win32.Registry" />
<PackageReference Include="Microsoft.CSharp" />
</ItemGroup>
</Project>
5 changes: 4 additions & 1 deletion src/Cake.Core/Scripting/ScriptConventions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand Down Expand Up @@ -131,6 +131,9 @@ private string GetFrameworkDefine()
case ".NETCoreApp,Version=v9.0":
return "NET9_0";

case ".NETCoreApp,Version=v10.0":
return "NET10_0";

default:
Console.Error.WriteLine(_runtime.BuiltFramework.FullName);
Console.Error.Flush();
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": "net9.0",
"defaultValue": "net10.0",
"replaces": "TargetFrameworkValue",
"choices": [
{
Expand All @@ -27,6 +27,10 @@
{
"choice": "net9.0",
"description": "Target .NET 9"
},
{
"choice": "net10.0",
"description": "Target .NET 10"
}
]
}
Expand Down
5 changes: 2 additions & 3 deletions src/Cake/Cake.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>Cake</AssemblyName>
Expand Down Expand Up @@ -28,10 +28,9 @@
<!-- Global packages -->
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" />
<PackageReference Include="System.Collections.Immutable" />
<PackageReference Include="System.Reflection.Metadata" />
<PackageReference Include="Autofac" />
<PackageReference Include="Basic.Reference.Assemblies.Net80" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="Basic.Reference.Assemblies.Net90" Condition="'$(TargetFramework)' == 'net9.0'" />
<PackageReference Include="Basic.Reference.Assemblies.Net100" Condition="'$(TargetFramework)' == 'net10.0'" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
Expand Down Expand Up @@ -35,8 +35,10 @@ IEnumerable<Assembly> TryGetReferenceAssemblies()
foreach (var reference in
#if NET8_0
Basic.Reference.Assemblies.Net80.References.All)
#else
#elif NET9_0
Basic.Reference.Assemblies.Net90.References.All)
#else
Basic.Reference.Assemblies.Net100.References.All)
#endif
{
Assembly assembly;
Expand Down
26 changes: 18 additions & 8 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,19 @@
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
<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.4.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.8.3" />
<PackageVersion Include="Basic.Reference.Assemblies.Net90" Version="1.8.3" />
<PackageVersion Include="Basic.Reference.Assemblies.Net100" Version="1.8.3" />
<PackageVersion Include="Cake.Frosting" Version="3.1.0.0" />
<PackageVersion Include="Castle.Core" Version="5.2.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.14.0" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.11" />
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="9.10.0" />
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="10.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="5.0.0-2.final" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.14.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="Microsoft.NETCore.Platforms" Version="7.0.4" />
<PackageVersion Include="Microsoft.TestPlatform.ObjectModel" Version="18.0.1" />
<PackageVersion Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="NuGet.Common" Version="6.14.0" />
Expand All @@ -32,18 +29,31 @@
<PackageVersion Include="Spectre.Console.Cli" Version="0.53.0" />
<PackageVersion Include="Spectre.Console.Testing" Version="0.53.0" />
<PackageVersion Include="Spectre.Verify.Extensions" Version="28.16.0" />
<PackageVersion Include="System.Collections.Immutable" Version="9.0.11" />
<PackageVersion Include="System.Reflection.Metadata" Version="9.0.11" />
<PackageVersion Include="Verify.DiffPlex" Version="3.1.2" />
<PackageVersion Include="Verify.XunitV3" Version="31.5.3" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.v3" Version="3.2.0" />
<PackageVersion Include="xunit.v3.assert" Version="3.2.0" />
<PackageVersion Include="xunit.v3.extensibility.core" Version="3.2.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
<!-- Pin nuget transitive packages vulnerability issues NuGet.Packaging -->
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="10.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.11" />
<!-- Pin nuget transitive packages vulnerability issues NuGet.Packaging -->
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="9.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<!-- Pin nuget transitive packages vulnerability issues NuGet.Packaging -->
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="8.0.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Shared.msbuild
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<!-- General package metadata -->
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;net10.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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Task("ValidateEnvironment")
.DoesForEach<BuildData, string>(
data => new [] {
$"CAKE_{data.OS}_NETCOREAPP_8_0_VERSION",
$"CAKE_{data.OS}_NETCOREAPP_9_0_VERSION"
$"CAKE_{data.OS}_NETCOREAPP_9_0_VERSION",
$"CAKE_{data.OS}_NETCOREAPP_10_0_VERSION"
},
(data, envKey) => Assert.Equal(data.GitVersion, EnvironmentVariable(envKey))
);
Expand All @@ -32,7 +33,8 @@ Task("ValidatePath")
.DoesForEach<BuildData, string>(
new [] {
"Cake\\WTool\\Wtools\\Wnet8\\W0",
"Cake\\WTool\\Wtools\\Wnet9\\W0"
"Cake\\WTool\\Wtools\\Wnet9\\W0",
"Cake\\WTool\\Wtools\\Wnet10\\W0"
},
(data, path) => Assert.Matches(path, data.Path)
);
Expand All @@ -41,7 +43,8 @@ Task("ValidateVariable")
.DoesForEach<BuildData, string>(
() => new [] {
"CAKE_NETCOREAPP_8_0_VERSION_OS",
"CAKE_NETCOREAPP_9_0_VERSION_OS"
"CAKE_NETCOREAPP_9_0_VERSION_OS",
"CAKE_NETCOREAPP_10_0_VERSION_OS"
},
(data, varKey) => Assert.Equal(data.GitVersionAndOS, Argument<string>(varKey))
);
Expand Down
20 changes: 10 additions & 10 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/net9.0/hwapp.dll");
var assembly = path.CombineWithFilePath("hwapp/bin/Debug/net10.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/net9.0/hwapp.tests.dll");
var assembly = path.CombineWithFilePath("hwapp.tests/bin/Debug/net10.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/net9.0/hwapp.dll");
var assembly = path.CombineWithFilePath("hwapp/bin/Debug/net10.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/net9.0/hwapp.dll");
var assembly = path.CombineWithFilePath("hwapp/bin/Debug/net10.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/net9.0/hwapp.dll");
var assembly = path.CombineWithFilePath("hwapp/bin/Debug/net10.0/hwapp.dll");

// When
DotNetMSBuild(project.FullPath);
Expand Down Expand Up @@ -245,7 +245,7 @@ Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetMSBuild.Results")
// Then
Assert.NotNull(result);
Assert.Equal("1.0.0", result.RootElement.GetProperty("Properties").GetProperty("Version").GetString());
Assert.Equal("net9.0", result.RootElement.GetProperty("Properties").GetProperty("TargetFramework").GetString());
Assert.Equal("net10.0", result.RootElement.GetProperty("Properties").GetProperty("TargetFramework").GetString());
Assert.Equal(1, result.RootElement.GetProperty("Items").GetProperty("ProjectReference").GetArrayLength());
Assert.Equal("Success", result.RootElement.GetProperty("TargetResults").GetProperty("Build").GetProperty("Result").GetString());
Assert.Equal("Success", result.RootElement.GetProperty("TargetResults").GetProperty("Compile").GetProperty("Result").GetString());
Expand Down Expand Up @@ -344,7 +344,7 @@ Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetAddPackage")
// Given
var path = Paths.Temp.Combine("./Cake.Common/Tools/DotNet");
var project = path.CombineWithFilePath("hwapp/hwapp.csproj");
var package = "grok.net";
var package = "Cake.Core";

// When
DotNetAddPackage(package, project.FullPath);
Expand All @@ -365,7 +365,7 @@ Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetRemovePackage")
// Given
var path = Paths.Temp.Combine("./Cake.Common/Tools/DotNet");
var project = path.CombineWithFilePath("hwapp/hwapp.csproj");
var package = "grok.net";
var package = "Cake.Core";
var value = XmlPeek(
project.FullPath,
$"/Project/ItemGroup/PackageReference[@Include='{package}']/@Include"
Expand Down Expand Up @@ -410,11 +410,11 @@ Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetListReference")
// Given
var path = Paths.Temp.Combine("./Cake.Common/Tools/DotNet");
var project = path.CombineWithFilePath("hwapp/hwapp.csproj");
var projectReference = "..\\hwapp.common\\hwapp.common.csproj";
var projectReference = FilePath.FromString("../hwapp.common/hwapp.common.csproj");
// When
var result = DotNetListReference(project.FullPath);
// Then
Assert.Contains(result, item => item == projectReference);
Assert.Contains(result, item => FilePath.FromString(item) == projectReference);
});

Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetRemoveReference")
Expand Down
21 changes: 21 additions & 0 deletions tests/integration/Cake.Core/Scripting/DefineDirective.cake
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Task("Cake.Core.Scripting.DefineDirective.Runtime")
"8.0",
#elif NET9_0
"9.0",
#elif NET10_0
"10.0",
#endif
context.Environment.Runtime.BuiltFramework.FullName);
});
Expand Down Expand Up @@ -138,6 +140,22 @@ Task("Cake.Core.Scripting.DefineDirective.C#13")
});
#endif

#if NET10_0
Task("Cake.Core.Scripting.DefineDirective.C#14")
.Does(() =>
{
// Given - Test C# 14 unbound generic types with nameof
var listName = nameof(List<>);
var dictionaryName = nameof(Dictionary<,>);
var tupleName = nameof(Tuple<,,>);

// When & Then
Assert.Equal("List", listName);
Assert.Equal("Dictionary", dictionaryName);
Assert.Equal("Tuple", tupleName);
});
#endif

//////////////////////////////////////////////////////////////////////////////

Task("Cake.Core.Scripting.DefineDirective")
Expand All @@ -147,6 +165,9 @@ Task("Cake.Core.Scripting.DefineDirective")
.IsDependentOn("Cake.Core.Scripting.DefineDirective.C#12")
#if NET9_0
.IsDependentOn("Cake.Core.Scripting.DefineDirective.C#13")
#endif
#if NET10_0
.IsDependentOn("Cake.Core.Scripting.DefineDirective.C#14")
#endif
.IsDependentOn("Cake.Core.Scripting.DefineDirective.Defined")
.IsDependentOn("Cake.Core.Scripting.DefineDirective.NotDefined")
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/Cake.Frosting/build/Build.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;net10.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,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.1" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="4.0.0-preview.25480.4" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Loading
Loading