From 0739eb9d3629b6fa108e12b3fa673ab9bdaed9ce Mon Sep 17 00:00:00 2001 From: Adeel <3840695+am11@users.noreply.github.com> Date: Sun, 22 Sep 2024 18:21:01 +0300 Subject: [PATCH 1/3] Add .NET 10 support --- NuGet.Config | 1 + .../Jobs/RuntimeMoniker.cs | 25 +++++++++++++++++++ .../DotMemoryDiagnoser.cs | 7 +++++- .../DotTraceDiagnoser.cs | 7 +++++- .../ConsoleArguments/ConfigParser.cs | 13 ++++++++++ .../Environments/Runtimes/CoreRuntime.cs | 4 ++- .../Environments/Runtimes/MonoRuntime.cs | 1 + .../Environments/Runtimes/NativeAotRuntime.cs | 5 ++++ .../Extensions/RuntimeMonikerExtensions.cs | 10 +++++--- .../Toolchains/CsProj/CsProjCoreToolchain.cs | 1 + .../DotNetCli/MsBuildErrorMapper.cs | 2 ++ .../DotNetCli/NetCoreAppSettings.cs | 1 + .../Toolchains/Mono/MonoToolchain.cs | 1 + .../NativeAot/NativeAotToolchain.cs | 8 ++++++ .../NativeAot/NativeAotToolchainBuilder.cs | 4 +-- .../Toolchains/ToolchainExtensions.cs | 10 ++++++++ .../Validators/DotNetSdkVersionValidator.cs | 5 ++++ .../.template.config/template.json | 8 ++++++ .../.template.config/template.json | 8 ++++++ .../.template.config/template.json | 8 ++++++ .../ConfigParserTests.cs | 3 ++- 21 files changed, 122 insertions(+), 10 deletions(-) diff --git a/NuGet.Config b/NuGet.Config index 855812b5a5..7507704b8b 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -13,5 +13,6 @@ + diff --git a/src/BenchmarkDotNet.Annotations/Jobs/RuntimeMoniker.cs b/src/BenchmarkDotNet.Annotations/Jobs/RuntimeMoniker.cs index 78541a763f..b24b2b6c67 100644 --- a/src/BenchmarkDotNet.Annotations/Jobs/RuntimeMoniker.cs +++ b/src/BenchmarkDotNet.Annotations/Jobs/RuntimeMoniker.cs @@ -115,6 +115,11 @@ public enum RuntimeMoniker /// Net90, + /// + /// .NET 10.0 + /// + Net100, + /// /// NativeAOT compiled as net6.0 /// @@ -135,6 +140,11 @@ public enum RuntimeMoniker /// NativeAot90, + /// + /// NativeAOT compiled as net10.0 + /// + NativeAot100, + /// /// WebAssembly with default .Net version /// @@ -165,6 +175,11 @@ public enum RuntimeMoniker /// WasmNet90, + /// + /// WebAssembly with net10.0 + /// + WasmNet100, + /// /// Mono with the Ahead of Time LLVM Compiler backend /// @@ -190,6 +205,11 @@ public enum RuntimeMoniker /// MonoAOTLLVMNet90, + /// + /// Mono with the Ahead of Time LLVM Compiler backend and net10.0 + /// + MonoAOTLLVMNet100, + /// /// .NET 6 using MonoVM (not CLR which is the default) /// @@ -209,5 +229,10 @@ public enum RuntimeMoniker /// .NET 9 using MonoVM (not CLR which is the default) /// Mono90, + + /// + /// .NET 10 using MonoVM (not CLR which is the default) + /// + Mono100, } } diff --git a/src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs b/src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs index c61f308fcc..797f2f0295 100644 --- a/src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs +++ b/src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs @@ -81,6 +81,7 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.Net70: case RuntimeMoniker.Net80: case RuntimeMoniker.Net90: + case RuntimeMoniker.Net100: return true; case RuntimeMoniker.NotRecognized: case RuntimeMoniker.Mono: @@ -88,20 +89,24 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.NativeAot70: case RuntimeMoniker.NativeAot80: case RuntimeMoniker.NativeAot90: + case RuntimeMoniker.NativeAot100: case RuntimeMoniker.Wasm: case RuntimeMoniker.WasmNet50: case RuntimeMoniker.WasmNet60: case RuntimeMoniker.WasmNet70: case RuntimeMoniker.WasmNet80: case RuntimeMoniker.WasmNet90: + case RuntimeMoniker.WasmNet100: case RuntimeMoniker.MonoAOTLLVM: case RuntimeMoniker.MonoAOTLLVMNet60: case RuntimeMoniker.MonoAOTLLVMNet70: case RuntimeMoniker.MonoAOTLLVMNet80: case RuntimeMoniker.MonoAOTLLVMNet90: + case RuntimeMoniker.MonoAOTLLVMNet100: case RuntimeMoniker.Mono60: case RuntimeMoniker.Mono70: case RuntimeMoniker.Mono80: + case RuntimeMoniker.Mono100: case RuntimeMoniker.Mono90: #pragma warning disable CS0618 // Type or member is obsolete case RuntimeMoniker.NetCoreApp50: @@ -113,4 +118,4 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker) throw new ArgumentOutOfRangeException(nameof(runtimeMoniker), runtimeMoniker, $"Runtime moniker {runtimeMoniker} is not supported"); } } -} \ No newline at end of file +} diff --git a/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs b/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs index b650ab84fa..b78823cacb 100644 --- a/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs +++ b/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs @@ -84,6 +84,7 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.Net70: case RuntimeMoniker.Net80: case RuntimeMoniker.Net90: + case RuntimeMoniker.Net100: return true; case RuntimeMoniker.NotRecognized: case RuntimeMoniker.Mono: @@ -91,21 +92,25 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.NativeAot70: case RuntimeMoniker.NativeAot80: case RuntimeMoniker.NativeAot90: + case RuntimeMoniker.NativeAot100: case RuntimeMoniker.Wasm: case RuntimeMoniker.WasmNet50: case RuntimeMoniker.WasmNet60: case RuntimeMoniker.WasmNet70: case RuntimeMoniker.WasmNet80: case RuntimeMoniker.WasmNet90: + case RuntimeMoniker.WasmNet100: case RuntimeMoniker.MonoAOTLLVM: case RuntimeMoniker.MonoAOTLLVMNet60: case RuntimeMoniker.MonoAOTLLVMNet70: case RuntimeMoniker.MonoAOTLLVMNet80: case RuntimeMoniker.MonoAOTLLVMNet90: + case RuntimeMoniker.MonoAOTLLVMNet100: case RuntimeMoniker.Mono60: case RuntimeMoniker.Mono70: case RuntimeMoniker.Mono80: case RuntimeMoniker.Mono90: + case RuntimeMoniker.Mono100: #pragma warning disable CS0618 // Type or member is obsolete case RuntimeMoniker.NetCoreApp50: #pragma warning restore CS0618 // Type or member is obsolete @@ -116,4 +121,4 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker) throw new ArgumentOutOfRangeException(nameof(runtimeMoniker), runtimeMoniker, $"Runtime moniker {runtimeMoniker} is not supported"); } } -} \ No newline at end of file +} diff --git a/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs b/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs index 9ec37c39eb..fcbb4f735a 100644 --- a/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs +++ b/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs @@ -528,6 +528,7 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma case RuntimeMoniker.Net70: case RuntimeMoniker.Net80: case RuntimeMoniker.Net90: + case RuntimeMoniker.Net100: return baseJob .WithRuntime(runtimeMoniker.GetRuntime()) .WithToolchain(CsProjCoreToolchain.From(new NetCoreAppSettings(runtimeId, null, runtimeId, options.CliPath?.FullName, options.RestorePath?.FullName))); @@ -547,6 +548,9 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma case RuntimeMoniker.NativeAot90: return CreateAotJob(baseJob, options, runtimeMoniker, "", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json"); + case RuntimeMoniker.NativeAot100: + return CreateAotJob(baseJob, options, runtimeMoniker, "", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json"); + case RuntimeMoniker.Wasm: return MakeWasmJob(baseJob, options, RuntimeInformation.IsNetCore ? CoreRuntime.GetCurrentVersion().MsBuildMoniker : "net5.0", runtimeMoniker); @@ -565,6 +569,9 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma case RuntimeMoniker.WasmNet90: return MakeWasmJob(baseJob, options, "net9.0", runtimeMoniker); + case RuntimeMoniker.WasmNet100: + return MakeWasmJob(baseJob, options, "net10.0", runtimeMoniker); + case RuntimeMoniker.MonoAOTLLVM: return MakeMonoAOTLLVMJob(baseJob, options, RuntimeInformation.IsNetCore ? CoreRuntime.GetCurrentVersion().MsBuildMoniker : "net6.0", runtimeMoniker); @@ -580,6 +587,9 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma case RuntimeMoniker.MonoAOTLLVMNet90: return MakeMonoAOTLLVMJob(baseJob, options, "net9.0", runtimeMoniker); + case RuntimeMoniker.MonoAOTLLVMNet100: + return MakeMonoAOTLLVMJob(baseJob, options, "net10.0", runtimeMoniker); + case RuntimeMoniker.Mono60: return MakeMonoJob(baseJob, options, MonoRuntime.Mono60); @@ -592,6 +602,9 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma case RuntimeMoniker.Mono90: return MakeMonoJob(baseJob, options, MonoRuntime.Mono90); + case RuntimeMoniker.Mono100: + return MakeMonoJob(baseJob, options, MonoRuntime.Mono100); + default: throw new NotSupportedException($"Runtime {runtimeId} is not supported"); } diff --git a/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs b/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs index 8e4c508285..2ba2fc77c5 100644 --- a/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs +++ b/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs @@ -25,8 +25,9 @@ public class CoreRuntime : Runtime public static readonly CoreRuntime Core70 = new (RuntimeMoniker.Net70, "net7.0", ".NET 7.0"); public static readonly CoreRuntime Core80 = new (RuntimeMoniker.Net80, "net8.0", ".NET 8.0"); public static readonly CoreRuntime Core90 = new (RuntimeMoniker.Net90, "net9.0", ".NET 9.0"); + public static readonly CoreRuntime Core100 = new (RuntimeMoniker.Net100, "net10.0", ".NET 10.0"); - public static CoreRuntime Latest => Core90; // when dotnet/runtime branches for 10.0, this will need to get updated + public static CoreRuntime Latest => Core100; // when dotnet/runtime branches for 11.0, this will need to get updated private CoreRuntime(RuntimeMoniker runtimeMoniker, string msBuildMoniker, string displayName) : base(runtimeMoniker, msBuildMoniker, displayName) @@ -74,6 +75,7 @@ internal static CoreRuntime FromVersion(Version version) case Version v when v.Major == 7 && v.Minor == 0: return GetPlatformSpecific(Core70); case Version v when v.Major == 8 && v.Minor == 0: return GetPlatformSpecific(Core80); case Version v when v.Major == 9 && v.Minor == 0: return GetPlatformSpecific(Core90); + case Version v when v.Major == 10 && v.Minor == 0: return GetPlatformSpecific(Core100); default: return version >= new Version(3, 1) ? CreateForNewVersion($"net{version.Major}.{version.Minor}", $".NET {version.Major}.{version.Minor}") diff --git a/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs b/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs index 5862d1390c..a3f568b777 100644 --- a/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs +++ b/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs @@ -10,6 +10,7 @@ public class MonoRuntime : Runtime, IEquatable public static readonly MonoRuntime Mono70 = new ("Mono with .NET 7.0", RuntimeMoniker.Mono70, "net7.0", isDotNetBuiltIn: true); public static readonly MonoRuntime Mono80 = new ("Mono with .NET 8.0", RuntimeMoniker.Mono80, "net8.0", isDotNetBuiltIn: true); public static readonly MonoRuntime Mono90 = new ("Mono with .NET 9.0", RuntimeMoniker.Mono90, "net9.0", isDotNetBuiltIn: true); + public static readonly MonoRuntime Mono100 = new ("Mono with .NET 10.0", RuntimeMoniker.Mono100, "net10.0", isDotNetBuiltIn: true); public string CustomPath { get; } diff --git a/src/BenchmarkDotNet/Environments/Runtimes/NativeAotRuntime.cs b/src/BenchmarkDotNet/Environments/Runtimes/NativeAotRuntime.cs index f1f49c5dca..c78c296b21 100644 --- a/src/BenchmarkDotNet/Environments/Runtimes/NativeAotRuntime.cs +++ b/src/BenchmarkDotNet/Environments/Runtimes/NativeAotRuntime.cs @@ -22,6 +22,10 @@ public class NativeAotRuntime : Runtime /// NativeAOT compiled as net9.0 /// public static readonly NativeAotRuntime Net90 = new NativeAotRuntime(RuntimeMoniker.NativeAot90, "net9.0", "NativeAOT 9.0"); + /// + /// NativeAOT compiled as net10.0 + /// + public static readonly NativeAotRuntime Net100 = new NativeAotRuntime(RuntimeMoniker.NativeAot100, "net10.0", "NativeAOT 10.0"); public override bool IsAOT => true; @@ -48,6 +52,7 @@ public static NativeAotRuntime GetCurrentVersion() case Version v when v.Major == 7 && v.Minor == 0: return Net70; case Version v when v.Major == 8 && v.Minor == 0: return Net80; case Version v when v.Major == 9 && v.Minor == 0: return Net90; + case Version v when v.Major == 10 && v.Minor == 0: return Net100; default: return new NativeAotRuntime(RuntimeMoniker.NotRecognized, $"net{version.Major}.{version.Minor}", $"NativeAOT {version.Major}.{version.Minor}"); } diff --git a/src/BenchmarkDotNet/Extensions/RuntimeMonikerExtensions.cs b/src/BenchmarkDotNet/Extensions/RuntimeMonikerExtensions.cs index 03d44c1ba7..8a1c874f00 100644 --- a/src/BenchmarkDotNet/Extensions/RuntimeMonikerExtensions.cs +++ b/src/BenchmarkDotNet/Extensions/RuntimeMonikerExtensions.cs @@ -39,6 +39,8 @@ internal static Runtime GetRuntime(this RuntimeMoniker runtimeMoniker) return CoreRuntime.Core80; case RuntimeMoniker.Net90: return CoreRuntime.Core90; + case RuntimeMoniker.Net100: + return CoreRuntime.Core100; case RuntimeMoniker.Mono: return MonoRuntime.Default; case RuntimeMoniker.NativeAot60: @@ -47,16 +49,16 @@ internal static Runtime GetRuntime(this RuntimeMoniker runtimeMoniker) return NativeAotRuntime.Net70; case RuntimeMoniker.NativeAot80: return NativeAotRuntime.Net80; - case RuntimeMoniker.NativeAot90: - return NativeAotRuntime.Net90; + case RuntimeMoniker.NativeAot100: + return NativeAotRuntime.Net100; case RuntimeMoniker.Mono60: return MonoRuntime.Mono60; case RuntimeMoniker.Mono70: return MonoRuntime.Mono70; case RuntimeMoniker.Mono80: return MonoRuntime.Mono80; - case RuntimeMoniker.Mono90: - return MonoRuntime.Mono90; + case RuntimeMoniker.Mono100: + return MonoRuntime.Mono100; default: throw new ArgumentOutOfRangeException(nameof(runtimeMoniker), runtimeMoniker, "Runtime Moniker not supported"); } diff --git a/src/BenchmarkDotNet/Toolchains/CsProj/CsProjCoreToolchain.cs b/src/BenchmarkDotNet/Toolchains/CsProj/CsProjCoreToolchain.cs index 65fa9239d2..27faadff28 100644 --- a/src/BenchmarkDotNet/Toolchains/CsProj/CsProjCoreToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/CsProj/CsProjCoreToolchain.cs @@ -29,6 +29,7 @@ public class CsProjCoreToolchain : Toolchain, IEquatable [PublicAPI] public static readonly IToolchain NetCoreApp70 = From(NetCoreAppSettings.NetCoreApp70); [PublicAPI] public static readonly IToolchain NetCoreApp80 = From(NetCoreAppSettings.NetCoreApp80); [PublicAPI] public static readonly IToolchain NetCoreApp90 = From(NetCoreAppSettings.NetCoreApp90); + [PublicAPI] public static readonly IToolchain NetCoreApp100 = From(NetCoreAppSettings.NetCoreApp100); internal CsProjCoreToolchain(string name, IGenerator generator, IBuilder builder, IExecutor executor, string customDotNetCliPath) : base(name, generator, builder, executor) diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/MsBuildErrorMapper.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/MsBuildErrorMapper.cs index f8f159ff96..9c95be192f 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/MsBuildErrorMapper.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/MsBuildErrorMapper.cs @@ -91,6 +91,8 @@ private static string Map(Capture capture) return "net8.0"; case ".NETCoreApp,Version=v9.0": return "net9.0"; + case ".NETCoreApp,Version=v10.0": + return "net10.0"; default: return capture.Value; // we don't want to throw for future versions of .NET } diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs index 9da421396f..cd47f4d6e6 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs @@ -24,6 +24,7 @@ public class NetCoreAppSettings [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp70 = new ("net7.0", null, ".NET 7.0"); [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp80 = new ("net8.0", null, ".NET 8.0"); [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp90 = new ("net9.0", null, ".NET 9.0"); + [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp100 = new ("net10.0", null, ".NET 10.0"); /// /// diff --git a/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs b/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs index 56f2ebaa56..13b17f528e 100644 --- a/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs @@ -12,6 +12,7 @@ public class MonoToolchain : CsProjCoreToolchain, IEquatable [PublicAPI] public static readonly IToolchain Mono70 = From(new NetCoreAppSettings("net7.0", null, "mono70")); [PublicAPI] public static readonly IToolchain Mono80 = From(new NetCoreAppSettings("net8.0", null, "mono80")); [PublicAPI] public static readonly IToolchain Mono90 = From(new NetCoreAppSettings("net9.0", null, "mono90")); + [PublicAPI] public static readonly IToolchain Mono100 = From(new NetCoreAppSettings("net10.0", null, "mono100")); private MonoToolchain(string name, IGenerator generator, IBuilder builder, IExecutor executor, string customDotNetCliPath) : base(name, generator, builder, executor, customDotNetCliPath) diff --git a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs index 2ef6dd8a23..41bce68595 100644 --- a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs @@ -40,6 +40,14 @@ public class NativeAotToolchain : Toolchain .TargetFrameworkMoniker("net9.0") .ToToolchain(); + /// + /// compiled as net10.0, targets latest NativeAOT build from the .NET 9 feed: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json + /// + public static readonly IToolchain Net100 = CreateBuilder() + .UseNuGet("", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json") + .TargetFrameworkMoniker("net10.0") + .ToToolchain(); + internal NativeAotToolchain(string displayName, string ilCompilerVersion, string runtimeFrameworkVersion, string targetFrameworkMoniker, string runtimeIdentifier, diff --git a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchainBuilder.cs b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchainBuilder.cs index fc352ea50d..1bd248e5eb 100644 --- a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchainBuilder.cs +++ b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchainBuilder.cs @@ -53,8 +53,8 @@ public NativeAotToolchainBuilder UseLocalBuild(DirectoryInfo ilcPackages) if (!ilcPackages.Exists) throw new DirectoryNotFoundException($"{ilcPackages} provided as {nameof(ilcPackages)} does NOT exist"); Feeds["local"] = ilcPackages.FullName; - ilCompilerVersion = "9.0.0-dev"; - Feeds["dotnet9"] = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json"; + ilCompilerVersion = "10.0.0-dev"; + Feeds["dotnet10"] = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json"; useTempFolderForRestore = true; DisplayName("local ILCompiler build"); diff --git a/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs b/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs index 75d2898d0a..c73f22cd5c 100644 --- a/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs +++ b/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs @@ -66,6 +66,7 @@ internal static IToolchain GetToolchain(this Runtime runtime, Descriptor? descri RuntimeMoniker.Mono70 => GetToolchain(RuntimeMoniker.Net70), RuntimeMoniker.Mono80 => GetToolchain(RuntimeMoniker.Net80), RuntimeMoniker.Mono90 => GetToolchain(RuntimeMoniker.Net90), + RuntimeMoniker.Mono100 => GetToolchain(RuntimeMoniker.Net100), _ => CsProjCoreToolchain.From(new NetCoreAppSettings(mono.MsBuildMoniker, null, mono.Name)) }; } @@ -143,6 +144,9 @@ private static IToolchain GetToolchain(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.Net90: return CsProjCoreToolchain.NetCoreApp90; + case RuntimeMoniker.Net100: + return CsProjCoreToolchain.NetCoreApp100; + case RuntimeMoniker.NativeAot60: return NativeAotToolchain.Net60; @@ -155,6 +159,9 @@ private static IToolchain GetToolchain(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.NativeAot90: return NativeAotToolchain.Net90; + case RuntimeMoniker.NativeAot100: + return NativeAotToolchain.Net100; + case RuntimeMoniker.Mono60: return MonoToolchain.Mono60; @@ -167,6 +174,9 @@ private static IToolchain GetToolchain(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.Mono90: return MonoToolchain.Mono90; + case RuntimeMoniker.Mono100: + return MonoToolchain.Mono100; + default: throw new ArgumentOutOfRangeException(nameof(runtimeMoniker), runtimeMoniker, "RuntimeMoniker not supported"); } diff --git a/src/BenchmarkDotNet/Validators/DotNetSdkVersionValidator.cs b/src/BenchmarkDotNet/Validators/DotNetSdkVersionValidator.cs index 93a3af80dd..d263c9ff68 100644 --- a/src/BenchmarkDotNet/Validators/DotNetSdkVersionValidator.cs +++ b/src/BenchmarkDotNet/Validators/DotNetSdkVersionValidator.cs @@ -210,25 +210,30 @@ private static string GetSdkVersionFromMoniker(RuntimeMoniker runtimeMoniker) RuntimeMoniker.Net70 => "7.0", RuntimeMoniker.Net80 => "8.0", RuntimeMoniker.Net90 => "9.0", + RuntimeMoniker.Net100 => "10.0", RuntimeMoniker.NativeAot60 => "6.0", RuntimeMoniker.NativeAot70 => "7.0", RuntimeMoniker.NativeAot80 => "8.0", RuntimeMoniker.NativeAot90 => "9.0", + RuntimeMoniker.NativeAot100 => "10.0", RuntimeMoniker.Mono60 => "6.0", RuntimeMoniker.Mono70 => "7.0", RuntimeMoniker.Mono80 => "8.0", RuntimeMoniker.Mono90 => "9.0", + RuntimeMoniker.Mono100 => "10.0", RuntimeMoniker.Wasm => Portability.RuntimeInformation.IsNetCore && CoreRuntime.TryGetVersion(out var version) ? $"{version.Major}.{version.Minor}" : "5.0", RuntimeMoniker.WasmNet50 => "5.0", RuntimeMoniker.WasmNet60 => "6.0", RuntimeMoniker.WasmNet70 => "7.0", RuntimeMoniker.WasmNet80 => "8.0", RuntimeMoniker.WasmNet90 => "9.0", + RuntimeMoniker.WasmNet100 => "10.0", RuntimeMoniker.MonoAOTLLVM => Portability.RuntimeInformation.IsNetCore && CoreRuntime.TryGetVersion(out var version) ? $"{version.Major}.{version.Minor}" : "6.0", RuntimeMoniker.MonoAOTLLVMNet60 => "6.0", RuntimeMoniker.MonoAOTLLVMNet70 => "7.0", RuntimeMoniker.MonoAOTLLVMNet80 => "8.0", RuntimeMoniker.MonoAOTLLVMNet90 => "9.0", + RuntimeMoniker.MonoAOTLLVMNet100 => "10.0", _ => throw new NotImplementedException($"SDK version check not implemented for {runtimeMoniker}") }; } diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json index 12a8c08785..108d1248cb 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json @@ -34,6 +34,14 @@ "description": "The target framework for the project.", "datatype": "choice", "choices": [ + { + "choice": "net10.0", + "description": ".NET 10" + }, + { + "choice": "net9.0", + "description": ".NET 9" + }, { "choice": "net8.0", "description": ".NET 8" diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json index ebaaaa1073..27270458e2 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json @@ -34,6 +34,14 @@ "description": "The target framework for the project.", "datatype": "choice", "choices": [ + { + "choice": "net10.0", + "description": ".NET 10" + }, + { + "choice": "net9.0", + "description": ".NET 9" + }, { "choice": "net8.0", "description": ".NET 8" diff --git a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json index bc3989e97d..07ac31147e 100644 --- a/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json +++ b/templates/templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json @@ -34,6 +34,14 @@ "description": "The target framework for the project.", "datatype": "choice", "choices": [ + { + "choice": "net10.0", + "description": ".NET 10" + }, + { + "choice": "net9.0", + "description": ".NET 9" + }, { "choice": "net8.0", "description": ".NET 8" diff --git a/tests/BenchmarkDotNet.Tests/ConfigParserTests.cs b/tests/BenchmarkDotNet.Tests/ConfigParserTests.cs index 73d29d3611..e4717c9ce2 100644 --- a/tests/BenchmarkDotNet.Tests/ConfigParserTests.cs +++ b/tests/BenchmarkDotNet.Tests/ConfigParserTests.cs @@ -162,7 +162,7 @@ public void SpecifyingCoreRunWithFullFrameworkTargetsMostRecentTfm() CoreRunToolchain coreRunToolchain = (CoreRunToolchain)coreRunJob.GetToolchain(); DotNetCliGenerator generator = (DotNetCliGenerator)coreRunToolchain.Generator; - Assert.Equal("net9.0", generator.TargetFrameworkMoniker); + Assert.Equal("net10.0", generator.TargetFrameworkMoniker); } [FactEnvSpecific("It's impossible to determine TFM for CoreRunToolchain if host process is not .NET (Core) process", EnvRequirement.DotNetCoreOnly)] @@ -388,6 +388,7 @@ public void NetFrameworkMonikerParsedCorrectly(string tfm) [InlineData("net70")] [InlineData("net80")] [InlineData("net90")] + [InlineData("net100")] public void NetMonikersAreRecognizedAsNetCoreMonikers(string tfm) { var config = ConfigParser.Parse(new[] { "-r", tfm }, new OutputLogger(Output)).config; From 33574181cfee033ee2e5a02dfd6e4af5d98936b8 Mon Sep 17 00:00:00 2001 From: Adeel <3840695+am11@users.noreply.github.com> Date: Mon, 23 Sep 2024 10:25:27 +0300 Subject: [PATCH 2/3] Use _ --- .../Jobs/RuntimeMoniker.cs | 10 +++++----- .../DotMemoryDiagnoser.cs | 10 +++++----- .../DotTraceDiagnoser.cs | 10 +++++----- .../ConsoleArguments/ConfigParser.cs | 12 ++++++------ .../Environments/Runtimes/CoreRuntime.cs | 6 +++--- .../Environments/Runtimes/MonoRuntime.cs | 2 +- .../Environments/Runtimes/NativeAotRuntime.cs | 4 ++-- .../Extensions/RuntimeMonikerExtensions.cs | 12 ++++++------ .../Toolchains/CsProj/CsProjCoreToolchain.cs | 2 +- .../Toolchains/DotNetCli/NetCoreAppSettings.cs | 2 +- .../Toolchains/Mono/MonoToolchain.cs | 2 +- .../Toolchains/NativeAot/NativeAotToolchain.cs | 2 +- .../Toolchains/ToolchainExtensions.cs | 14 +++++++------- .../Validators/DotNetSdkVersionValidator.cs | 10 +++++----- tests/BenchmarkDotNet.Tests/ConfigParserTests.cs | 2 +- 15 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/BenchmarkDotNet.Annotations/Jobs/RuntimeMoniker.cs b/src/BenchmarkDotNet.Annotations/Jobs/RuntimeMoniker.cs index b24b2b6c67..4ad24192e2 100644 --- a/src/BenchmarkDotNet.Annotations/Jobs/RuntimeMoniker.cs +++ b/src/BenchmarkDotNet.Annotations/Jobs/RuntimeMoniker.cs @@ -118,7 +118,7 @@ public enum RuntimeMoniker /// /// .NET 10.0 /// - Net100, + Net10_0, /// /// NativeAOT compiled as net6.0 @@ -143,7 +143,7 @@ public enum RuntimeMoniker /// /// NativeAOT compiled as net10.0 /// - NativeAot100, + NativeAot10_0, /// /// WebAssembly with default .Net version @@ -178,7 +178,7 @@ public enum RuntimeMoniker /// /// WebAssembly with net10.0 /// - WasmNet100, + WasmNet10_0, /// /// Mono with the Ahead of Time LLVM Compiler backend @@ -208,7 +208,7 @@ public enum RuntimeMoniker /// /// Mono with the Ahead of Time LLVM Compiler backend and net10.0 /// - MonoAOTLLVMNet100, + MonoAOTLLVMNet10_0, /// /// .NET 6 using MonoVM (not CLR which is the default) @@ -233,6 +233,6 @@ public enum RuntimeMoniker /// /// .NET 10 using MonoVM (not CLR which is the default) /// - Mono100, + Mono10_0, } } diff --git a/src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs b/src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs index 797f2f0295..9b64dd70f9 100644 --- a/src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs +++ b/src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs @@ -81,7 +81,7 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.Net70: case RuntimeMoniker.Net80: case RuntimeMoniker.Net90: - case RuntimeMoniker.Net100: + case RuntimeMoniker.Net10_0: return true; case RuntimeMoniker.NotRecognized: case RuntimeMoniker.Mono: @@ -89,24 +89,24 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.NativeAot70: case RuntimeMoniker.NativeAot80: case RuntimeMoniker.NativeAot90: - case RuntimeMoniker.NativeAot100: + case RuntimeMoniker.NativeAot10_0: case RuntimeMoniker.Wasm: case RuntimeMoniker.WasmNet50: case RuntimeMoniker.WasmNet60: case RuntimeMoniker.WasmNet70: case RuntimeMoniker.WasmNet80: case RuntimeMoniker.WasmNet90: - case RuntimeMoniker.WasmNet100: + case RuntimeMoniker.WasmNet10_0: case RuntimeMoniker.MonoAOTLLVM: case RuntimeMoniker.MonoAOTLLVMNet60: case RuntimeMoniker.MonoAOTLLVMNet70: case RuntimeMoniker.MonoAOTLLVMNet80: case RuntimeMoniker.MonoAOTLLVMNet90: - case RuntimeMoniker.MonoAOTLLVMNet100: + case RuntimeMoniker.MonoAOTLLVMNet10_0: case RuntimeMoniker.Mono60: case RuntimeMoniker.Mono70: case RuntimeMoniker.Mono80: - case RuntimeMoniker.Mono100: + case RuntimeMoniker.Mono10_0: case RuntimeMoniker.Mono90: #pragma warning disable CS0618 // Type or member is obsolete case RuntimeMoniker.NetCoreApp50: diff --git a/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs b/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs index b78823cacb..0dded47443 100644 --- a/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs +++ b/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs @@ -84,7 +84,7 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.Net70: case RuntimeMoniker.Net80: case RuntimeMoniker.Net90: - case RuntimeMoniker.Net100: + case RuntimeMoniker.Net10_0: return true; case RuntimeMoniker.NotRecognized: case RuntimeMoniker.Mono: @@ -92,25 +92,25 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.NativeAot70: case RuntimeMoniker.NativeAot80: case RuntimeMoniker.NativeAot90: - case RuntimeMoniker.NativeAot100: + case RuntimeMoniker.NativeAot10_0: case RuntimeMoniker.Wasm: case RuntimeMoniker.WasmNet50: case RuntimeMoniker.WasmNet60: case RuntimeMoniker.WasmNet70: case RuntimeMoniker.WasmNet80: case RuntimeMoniker.WasmNet90: - case RuntimeMoniker.WasmNet100: + case RuntimeMoniker.WasmNet10_0: case RuntimeMoniker.MonoAOTLLVM: case RuntimeMoniker.MonoAOTLLVMNet60: case RuntimeMoniker.MonoAOTLLVMNet70: case RuntimeMoniker.MonoAOTLLVMNet80: case RuntimeMoniker.MonoAOTLLVMNet90: - case RuntimeMoniker.MonoAOTLLVMNet100: + case RuntimeMoniker.MonoAOTLLVMNet10_0: case RuntimeMoniker.Mono60: case RuntimeMoniker.Mono70: case RuntimeMoniker.Mono80: case RuntimeMoniker.Mono90: - case RuntimeMoniker.Mono100: + case RuntimeMoniker.Mono10_0: #pragma warning disable CS0618 // Type or member is obsolete case RuntimeMoniker.NetCoreApp50: #pragma warning restore CS0618 // Type or member is obsolete diff --git a/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs b/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs index fcbb4f735a..a49d95f1fe 100644 --- a/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs +++ b/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs @@ -528,7 +528,7 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma case RuntimeMoniker.Net70: case RuntimeMoniker.Net80: case RuntimeMoniker.Net90: - case RuntimeMoniker.Net100: + case RuntimeMoniker.Net10_0: return baseJob .WithRuntime(runtimeMoniker.GetRuntime()) .WithToolchain(CsProjCoreToolchain.From(new NetCoreAppSettings(runtimeId, null, runtimeId, options.CliPath?.FullName, options.RestorePath?.FullName))); @@ -548,7 +548,7 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma case RuntimeMoniker.NativeAot90: return CreateAotJob(baseJob, options, runtimeMoniker, "", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json"); - case RuntimeMoniker.NativeAot100: + case RuntimeMoniker.NativeAot10_0: return CreateAotJob(baseJob, options, runtimeMoniker, "", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json"); case RuntimeMoniker.Wasm: @@ -569,7 +569,7 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma case RuntimeMoniker.WasmNet90: return MakeWasmJob(baseJob, options, "net9.0", runtimeMoniker); - case RuntimeMoniker.WasmNet100: + case RuntimeMoniker.WasmNet10_0: return MakeWasmJob(baseJob, options, "net10.0", runtimeMoniker); case RuntimeMoniker.MonoAOTLLVM: @@ -587,7 +587,7 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma case RuntimeMoniker.MonoAOTLLVMNet90: return MakeMonoAOTLLVMJob(baseJob, options, "net9.0", runtimeMoniker); - case RuntimeMoniker.MonoAOTLLVMNet100: + case RuntimeMoniker.MonoAOTLLVMNet10_0: return MakeMonoAOTLLVMJob(baseJob, options, "net10.0", runtimeMoniker); case RuntimeMoniker.Mono60: @@ -602,8 +602,8 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma case RuntimeMoniker.Mono90: return MakeMonoJob(baseJob, options, MonoRuntime.Mono90); - case RuntimeMoniker.Mono100: - return MakeMonoJob(baseJob, options, MonoRuntime.Mono100); + case RuntimeMoniker.Mono10_0: + return MakeMonoJob(baseJob, options, MonoRuntime.Mono10_0); default: throw new NotSupportedException($"Runtime {runtimeId} is not supported"); diff --git a/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs b/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs index 2ba2fc77c5..ccf06519ea 100644 --- a/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs +++ b/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs @@ -25,9 +25,9 @@ public class CoreRuntime : Runtime public static readonly CoreRuntime Core70 = new (RuntimeMoniker.Net70, "net7.0", ".NET 7.0"); public static readonly CoreRuntime Core80 = new (RuntimeMoniker.Net80, "net8.0", ".NET 8.0"); public static readonly CoreRuntime Core90 = new (RuntimeMoniker.Net90, "net9.0", ".NET 9.0"); - public static readonly CoreRuntime Core100 = new (RuntimeMoniker.Net100, "net10.0", ".NET 10.0"); + public static readonly CoreRuntime Core10_0 = new (RuntimeMoniker.Net10_0, "net10.0", ".NET 10.0"); - public static CoreRuntime Latest => Core100; // when dotnet/runtime branches for 11.0, this will need to get updated + public static CoreRuntime Latest => Core10_0; // when dotnet/runtime branches for 11.0, this will need to get updated private CoreRuntime(RuntimeMoniker runtimeMoniker, string msBuildMoniker, string displayName) : base(runtimeMoniker, msBuildMoniker, displayName) @@ -75,7 +75,7 @@ internal static CoreRuntime FromVersion(Version version) case Version v when v.Major == 7 && v.Minor == 0: return GetPlatformSpecific(Core70); case Version v when v.Major == 8 && v.Minor == 0: return GetPlatformSpecific(Core80); case Version v when v.Major == 9 && v.Minor == 0: return GetPlatformSpecific(Core90); - case Version v when v.Major == 10 && v.Minor == 0: return GetPlatformSpecific(Core100); + case Version v when v.Major == 10 && v.Minor == 0: return GetPlatformSpecific(Core10_0); default: return version >= new Version(3, 1) ? CreateForNewVersion($"net{version.Major}.{version.Minor}", $".NET {version.Major}.{version.Minor}") diff --git a/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs b/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs index a3f568b777..15b5a02669 100644 --- a/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs +++ b/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs @@ -10,7 +10,7 @@ public class MonoRuntime : Runtime, IEquatable public static readonly MonoRuntime Mono70 = new ("Mono with .NET 7.0", RuntimeMoniker.Mono70, "net7.0", isDotNetBuiltIn: true); public static readonly MonoRuntime Mono80 = new ("Mono with .NET 8.0", RuntimeMoniker.Mono80, "net8.0", isDotNetBuiltIn: true); public static readonly MonoRuntime Mono90 = new ("Mono with .NET 9.0", RuntimeMoniker.Mono90, "net9.0", isDotNetBuiltIn: true); - public static readonly MonoRuntime Mono100 = new ("Mono with .NET 10.0", RuntimeMoniker.Mono100, "net10.0", isDotNetBuiltIn: true); + public static readonly MonoRuntime Mono10_0 = new ("Mono with .NET 10.0", RuntimeMoniker.Mono10_0, "net10.0", isDotNetBuiltIn: true); public string CustomPath { get; } diff --git a/src/BenchmarkDotNet/Environments/Runtimes/NativeAotRuntime.cs b/src/BenchmarkDotNet/Environments/Runtimes/NativeAotRuntime.cs index c78c296b21..bff018558e 100644 --- a/src/BenchmarkDotNet/Environments/Runtimes/NativeAotRuntime.cs +++ b/src/BenchmarkDotNet/Environments/Runtimes/NativeAotRuntime.cs @@ -25,7 +25,7 @@ public class NativeAotRuntime : Runtime /// /// NativeAOT compiled as net10.0 /// - public static readonly NativeAotRuntime Net100 = new NativeAotRuntime(RuntimeMoniker.NativeAot100, "net10.0", "NativeAOT 10.0"); + public static readonly NativeAotRuntime Net10_0 = new NativeAotRuntime(RuntimeMoniker.NativeAot10_0, "net10.0", "NativeAOT 10.0"); public override bool IsAOT => true; @@ -52,7 +52,7 @@ public static NativeAotRuntime GetCurrentVersion() case Version v when v.Major == 7 && v.Minor == 0: return Net70; case Version v when v.Major == 8 && v.Minor == 0: return Net80; case Version v when v.Major == 9 && v.Minor == 0: return Net90; - case Version v when v.Major == 10 && v.Minor == 0: return Net100; + case Version v when v.Major == 10 && v.Minor == 0: return Net10_0; default: return new NativeAotRuntime(RuntimeMoniker.NotRecognized, $"net{version.Major}.{version.Minor}", $"NativeAOT {version.Major}.{version.Minor}"); } diff --git a/src/BenchmarkDotNet/Extensions/RuntimeMonikerExtensions.cs b/src/BenchmarkDotNet/Extensions/RuntimeMonikerExtensions.cs index 8a1c874f00..ab905bd21e 100644 --- a/src/BenchmarkDotNet/Extensions/RuntimeMonikerExtensions.cs +++ b/src/BenchmarkDotNet/Extensions/RuntimeMonikerExtensions.cs @@ -39,8 +39,8 @@ internal static Runtime GetRuntime(this RuntimeMoniker runtimeMoniker) return CoreRuntime.Core80; case RuntimeMoniker.Net90: return CoreRuntime.Core90; - case RuntimeMoniker.Net100: - return CoreRuntime.Core100; + case RuntimeMoniker.Net10_0: + return CoreRuntime.Core10_0; case RuntimeMoniker.Mono: return MonoRuntime.Default; case RuntimeMoniker.NativeAot60: @@ -49,16 +49,16 @@ internal static Runtime GetRuntime(this RuntimeMoniker runtimeMoniker) return NativeAotRuntime.Net70; case RuntimeMoniker.NativeAot80: return NativeAotRuntime.Net80; - case RuntimeMoniker.NativeAot100: - return NativeAotRuntime.Net100; + case RuntimeMoniker.NativeAot10_0: + return NativeAotRuntime.Net10_0; case RuntimeMoniker.Mono60: return MonoRuntime.Mono60; case RuntimeMoniker.Mono70: return MonoRuntime.Mono70; case RuntimeMoniker.Mono80: return MonoRuntime.Mono80; - case RuntimeMoniker.Mono100: - return MonoRuntime.Mono100; + case RuntimeMoniker.Mono10_0: + return MonoRuntime.Mono10_0; default: throw new ArgumentOutOfRangeException(nameof(runtimeMoniker), runtimeMoniker, "Runtime Moniker not supported"); } diff --git a/src/BenchmarkDotNet/Toolchains/CsProj/CsProjCoreToolchain.cs b/src/BenchmarkDotNet/Toolchains/CsProj/CsProjCoreToolchain.cs index 27faadff28..5e88641187 100644 --- a/src/BenchmarkDotNet/Toolchains/CsProj/CsProjCoreToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/CsProj/CsProjCoreToolchain.cs @@ -29,7 +29,7 @@ public class CsProjCoreToolchain : Toolchain, IEquatable [PublicAPI] public static readonly IToolchain NetCoreApp70 = From(NetCoreAppSettings.NetCoreApp70); [PublicAPI] public static readonly IToolchain NetCoreApp80 = From(NetCoreAppSettings.NetCoreApp80); [PublicAPI] public static readonly IToolchain NetCoreApp90 = From(NetCoreAppSettings.NetCoreApp90); - [PublicAPI] public static readonly IToolchain NetCoreApp100 = From(NetCoreAppSettings.NetCoreApp100); + [PublicAPI] public static readonly IToolchain NetCoreApp10_0 = From(NetCoreAppSettings.NetCoreApp10_0); internal CsProjCoreToolchain(string name, IGenerator generator, IBuilder builder, IExecutor executor, string customDotNetCliPath) : base(name, generator, builder, executor) diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs index cd47f4d6e6..7427b167d1 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs @@ -24,7 +24,7 @@ public class NetCoreAppSettings [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp70 = new ("net7.0", null, ".NET 7.0"); [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp80 = new ("net8.0", null, ".NET 8.0"); [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp90 = new ("net9.0", null, ".NET 9.0"); - [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp100 = new ("net10.0", null, ".NET 10.0"); + [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp10_0 = new ("net10.0", null, ".NET 10.0"); /// /// diff --git a/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs b/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs index 13b17f528e..222eb2111b 100644 --- a/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs @@ -12,7 +12,7 @@ public class MonoToolchain : CsProjCoreToolchain, IEquatable [PublicAPI] public static readonly IToolchain Mono70 = From(new NetCoreAppSettings("net7.0", null, "mono70")); [PublicAPI] public static readonly IToolchain Mono80 = From(new NetCoreAppSettings("net8.0", null, "mono80")); [PublicAPI] public static readonly IToolchain Mono90 = From(new NetCoreAppSettings("net9.0", null, "mono90")); - [PublicAPI] public static readonly IToolchain Mono100 = From(new NetCoreAppSettings("net10.0", null, "mono100")); + [PublicAPI] public static readonly IToolchain Mono10_0 = From(new NetCoreAppSettings("net10.0", null, "mono10_0")); private MonoToolchain(string name, IGenerator generator, IBuilder builder, IExecutor executor, string customDotNetCliPath) : base(name, generator, builder, executor, customDotNetCliPath) diff --git a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs index 41bce68595..412d3f59be 100644 --- a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs @@ -43,7 +43,7 @@ public class NativeAotToolchain : Toolchain /// /// compiled as net10.0, targets latest NativeAOT build from the .NET 9 feed: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json /// - public static readonly IToolchain Net100 = CreateBuilder() + public static readonly IToolchain Net10_0 = CreateBuilder() .UseNuGet("", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json") .TargetFrameworkMoniker("net10.0") .ToToolchain(); diff --git a/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs b/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs index c73f22cd5c..ba8b3c6863 100644 --- a/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs +++ b/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs @@ -66,7 +66,7 @@ internal static IToolchain GetToolchain(this Runtime runtime, Descriptor? descri RuntimeMoniker.Mono70 => GetToolchain(RuntimeMoniker.Net70), RuntimeMoniker.Mono80 => GetToolchain(RuntimeMoniker.Net80), RuntimeMoniker.Mono90 => GetToolchain(RuntimeMoniker.Net90), - RuntimeMoniker.Mono100 => GetToolchain(RuntimeMoniker.Net100), + RuntimeMoniker.Mono10_0 => GetToolchain(RuntimeMoniker.Net10_0), _ => CsProjCoreToolchain.From(new NetCoreAppSettings(mono.MsBuildMoniker, null, mono.Name)) }; } @@ -144,8 +144,8 @@ private static IToolchain GetToolchain(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.Net90: return CsProjCoreToolchain.NetCoreApp90; - case RuntimeMoniker.Net100: - return CsProjCoreToolchain.NetCoreApp100; + case RuntimeMoniker.Net10_0: + return CsProjCoreToolchain.NetCoreApp10_0; case RuntimeMoniker.NativeAot60: return NativeAotToolchain.Net60; @@ -159,8 +159,8 @@ private static IToolchain GetToolchain(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.NativeAot90: return NativeAotToolchain.Net90; - case RuntimeMoniker.NativeAot100: - return NativeAotToolchain.Net100; + case RuntimeMoniker.NativeAot10_0: + return NativeAotToolchain.Net10_0; case RuntimeMoniker.Mono60: return MonoToolchain.Mono60; @@ -174,8 +174,8 @@ private static IToolchain GetToolchain(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.Mono90: return MonoToolchain.Mono90; - case RuntimeMoniker.Mono100: - return MonoToolchain.Mono100; + case RuntimeMoniker.Mono10_0: + return MonoToolchain.Mono10_0; default: throw new ArgumentOutOfRangeException(nameof(runtimeMoniker), runtimeMoniker, "RuntimeMoniker not supported"); diff --git a/src/BenchmarkDotNet/Validators/DotNetSdkVersionValidator.cs b/src/BenchmarkDotNet/Validators/DotNetSdkVersionValidator.cs index d263c9ff68..7f40a10ab8 100644 --- a/src/BenchmarkDotNet/Validators/DotNetSdkVersionValidator.cs +++ b/src/BenchmarkDotNet/Validators/DotNetSdkVersionValidator.cs @@ -210,30 +210,30 @@ private static string GetSdkVersionFromMoniker(RuntimeMoniker runtimeMoniker) RuntimeMoniker.Net70 => "7.0", RuntimeMoniker.Net80 => "8.0", RuntimeMoniker.Net90 => "9.0", - RuntimeMoniker.Net100 => "10.0", + RuntimeMoniker.Net10_0 => "10.0", RuntimeMoniker.NativeAot60 => "6.0", RuntimeMoniker.NativeAot70 => "7.0", RuntimeMoniker.NativeAot80 => "8.0", RuntimeMoniker.NativeAot90 => "9.0", - RuntimeMoniker.NativeAot100 => "10.0", + RuntimeMoniker.NativeAot10_0 => "10.0", RuntimeMoniker.Mono60 => "6.0", RuntimeMoniker.Mono70 => "7.0", RuntimeMoniker.Mono80 => "8.0", RuntimeMoniker.Mono90 => "9.0", - RuntimeMoniker.Mono100 => "10.0", + RuntimeMoniker.Mono10_0 => "10.0", RuntimeMoniker.Wasm => Portability.RuntimeInformation.IsNetCore && CoreRuntime.TryGetVersion(out var version) ? $"{version.Major}.{version.Minor}" : "5.0", RuntimeMoniker.WasmNet50 => "5.0", RuntimeMoniker.WasmNet60 => "6.0", RuntimeMoniker.WasmNet70 => "7.0", RuntimeMoniker.WasmNet80 => "8.0", RuntimeMoniker.WasmNet90 => "9.0", - RuntimeMoniker.WasmNet100 => "10.0", + RuntimeMoniker.WasmNet10_0 => "10.0", RuntimeMoniker.MonoAOTLLVM => Portability.RuntimeInformation.IsNetCore && CoreRuntime.TryGetVersion(out var version) ? $"{version.Major}.{version.Minor}" : "6.0", RuntimeMoniker.MonoAOTLLVMNet60 => "6.0", RuntimeMoniker.MonoAOTLLVMNet70 => "7.0", RuntimeMoniker.MonoAOTLLVMNet80 => "8.0", RuntimeMoniker.MonoAOTLLVMNet90 => "9.0", - RuntimeMoniker.MonoAOTLLVMNet100 => "10.0", + RuntimeMoniker.MonoAOTLLVMNet10_0 => "10.0", _ => throw new NotImplementedException($"SDK version check not implemented for {runtimeMoniker}") }; } diff --git a/tests/BenchmarkDotNet.Tests/ConfigParserTests.cs b/tests/BenchmarkDotNet.Tests/ConfigParserTests.cs index e4717c9ce2..9f42878148 100644 --- a/tests/BenchmarkDotNet.Tests/ConfigParserTests.cs +++ b/tests/BenchmarkDotNet.Tests/ConfigParserTests.cs @@ -388,7 +388,7 @@ public void NetFrameworkMonikerParsedCorrectly(string tfm) [InlineData("net70")] [InlineData("net80")] [InlineData("net90")] - [InlineData("net100")] + [InlineData("net10_0")] public void NetMonikersAreRecognizedAsNetCoreMonikers(string tfm) { var config = ConfigParser.Parse(new[] { "-r", tfm }, new OutputLogger(Output)).config; From 416ec98cc0a135f240d23e81d5515cd22f613f9e Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Tue, 7 Jan 2025 10:55:30 +0100 Subject: [PATCH 3/3] Apply suggestions from code review --- src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs | 2 +- src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs b/src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs index 9b64dd70f9..b7d23e9275 100644 --- a/src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs +++ b/src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs @@ -106,8 +106,8 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker) case RuntimeMoniker.Mono60: case RuntimeMoniker.Mono70: case RuntimeMoniker.Mono80: - case RuntimeMoniker.Mono10_0: case RuntimeMoniker.Mono90: + case RuntimeMoniker.Mono10_0: #pragma warning disable CS0618 // Type or member is obsolete case RuntimeMoniker.NetCoreApp50: #pragma warning restore CS0618 // Type or member is obsolete diff --git a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs index 412d3f59be..9d476bf0e0 100644 --- a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs @@ -41,7 +41,7 @@ public class NativeAotToolchain : Toolchain .ToToolchain(); /// - /// compiled as net10.0, targets latest NativeAOT build from the .NET 9 feed: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json + /// compiled as net10.0, targets latest NativeAOT build from the .NET 10 feed: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json /// public static readonly IToolchain Net10_0 = CreateBuilder() .UseNuGet("", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json")