Skip to content

Commit 3337a09

Browse files
am11timcasselladamsitnik
authored
Add .NET 10 support (#2642)
* Add .NET 10 support * Use _ --------- Co-authored-by: Tim Cassell <[email protected]> Co-authored-by: Adam Sitnik <[email protected]>
1 parent cac4f6e commit 3337a09

File tree

21 files changed

+122
-10
lines changed

21 files changed

+122
-10
lines changed

NuGet.Config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
<add key="dotnet7" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" />
1414
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
1515
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
16+
<add key="dotnet10" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json" />
1617
</packageSources>
1718
</configuration>

src/BenchmarkDotNet.Annotations/Jobs/RuntimeMoniker.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ public enum RuntimeMoniker
115115
/// </summary>
116116
Net90,
117117

118+
/// <summary>
119+
/// .NET 10.0
120+
/// </summary>
121+
Net10_0,
122+
118123
/// <summary>
119124
/// NativeAOT compiled as net6.0
120125
/// </summary>
@@ -135,6 +140,11 @@ public enum RuntimeMoniker
135140
/// </summary>
136141
NativeAot90,
137142

143+
/// <summary>
144+
/// NativeAOT compiled as net10.0
145+
/// </summary>
146+
NativeAot10_0,
147+
138148
/// <summary>
139149
/// WebAssembly with default .Net version
140150
/// </summary>
@@ -165,6 +175,11 @@ public enum RuntimeMoniker
165175
/// </summary>
166176
WasmNet90,
167177

178+
/// <summary>
179+
/// WebAssembly with net10.0
180+
/// </summary>
181+
WasmNet10_0,
182+
168183
/// <summary>
169184
/// Mono with the Ahead of Time LLVM Compiler backend
170185
/// </summary>
@@ -190,6 +205,11 @@ public enum RuntimeMoniker
190205
/// </summary>
191206
MonoAOTLLVMNet90,
192207

208+
/// <summary>
209+
/// Mono with the Ahead of Time LLVM Compiler backend and net10.0
210+
/// </summary>
211+
MonoAOTLLVMNet10_0,
212+
193213
/// <summary>
194214
/// .NET 6 using MonoVM (not CLR which is the default)
195215
/// </summary>
@@ -209,5 +229,10 @@ public enum RuntimeMoniker
209229
/// .NET 9 using MonoVM (not CLR which is the default)
210230
/// </summary>
211231
Mono90,
232+
233+
/// <summary>
234+
/// .NET 10 using MonoVM (not CLR which is the default)
235+
/// </summary>
236+
Mono10_0,
212237
}
213238
}

src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,33 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker)
8181
case RuntimeMoniker.Net70:
8282
case RuntimeMoniker.Net80:
8383
case RuntimeMoniker.Net90:
84+
case RuntimeMoniker.Net10_0:
8485
return true;
8586
case RuntimeMoniker.NotRecognized:
8687
case RuntimeMoniker.Mono:
8788
case RuntimeMoniker.NativeAot60:
8889
case RuntimeMoniker.NativeAot70:
8990
case RuntimeMoniker.NativeAot80:
9091
case RuntimeMoniker.NativeAot90:
92+
case RuntimeMoniker.NativeAot10_0:
9193
case RuntimeMoniker.Wasm:
9294
case RuntimeMoniker.WasmNet50:
9395
case RuntimeMoniker.WasmNet60:
9496
case RuntimeMoniker.WasmNet70:
9597
case RuntimeMoniker.WasmNet80:
9698
case RuntimeMoniker.WasmNet90:
99+
case RuntimeMoniker.WasmNet10_0:
97100
case RuntimeMoniker.MonoAOTLLVM:
98101
case RuntimeMoniker.MonoAOTLLVMNet60:
99102
case RuntimeMoniker.MonoAOTLLVMNet70:
100103
case RuntimeMoniker.MonoAOTLLVMNet80:
101104
case RuntimeMoniker.MonoAOTLLVMNet90:
105+
case RuntimeMoniker.MonoAOTLLVMNet10_0:
102106
case RuntimeMoniker.Mono60:
103107
case RuntimeMoniker.Mono70:
104108
case RuntimeMoniker.Mono80:
105109
case RuntimeMoniker.Mono90:
110+
case RuntimeMoniker.Mono10_0:
106111
#pragma warning disable CS0618 // Type or member is obsolete
107112
case RuntimeMoniker.NetCoreApp50:
108113
#pragma warning restore CS0618 // Type or member is obsolete
@@ -113,4 +118,4 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker)
113118
throw new ArgumentOutOfRangeException(nameof(runtimeMoniker), runtimeMoniker, $"Runtime moniker {runtimeMoniker} is not supported");
114119
}
115120
}
116-
}
121+
}

src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,33 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker)
8484
case RuntimeMoniker.Net70:
8585
case RuntimeMoniker.Net80:
8686
case RuntimeMoniker.Net90:
87+
case RuntimeMoniker.Net10_0:
8788
return true;
8889
case RuntimeMoniker.NotRecognized:
8990
case RuntimeMoniker.Mono:
9091
case RuntimeMoniker.NativeAot60:
9192
case RuntimeMoniker.NativeAot70:
9293
case RuntimeMoniker.NativeAot80:
9394
case RuntimeMoniker.NativeAot90:
95+
case RuntimeMoniker.NativeAot10_0:
9496
case RuntimeMoniker.Wasm:
9597
case RuntimeMoniker.WasmNet50:
9698
case RuntimeMoniker.WasmNet60:
9799
case RuntimeMoniker.WasmNet70:
98100
case RuntimeMoniker.WasmNet80:
99101
case RuntimeMoniker.WasmNet90:
102+
case RuntimeMoniker.WasmNet10_0:
100103
case RuntimeMoniker.MonoAOTLLVM:
101104
case RuntimeMoniker.MonoAOTLLVMNet60:
102105
case RuntimeMoniker.MonoAOTLLVMNet70:
103106
case RuntimeMoniker.MonoAOTLLVMNet80:
104107
case RuntimeMoniker.MonoAOTLLVMNet90:
108+
case RuntimeMoniker.MonoAOTLLVMNet10_0:
105109
case RuntimeMoniker.Mono60:
106110
case RuntimeMoniker.Mono70:
107111
case RuntimeMoniker.Mono80:
108112
case RuntimeMoniker.Mono90:
113+
case RuntimeMoniker.Mono10_0:
109114
#pragma warning disable CS0618 // Type or member is obsolete
110115
case RuntimeMoniker.NetCoreApp50:
111116
#pragma warning restore CS0618 // Type or member is obsolete
@@ -116,4 +121,4 @@ internal override bool IsSupported(RuntimeMoniker runtimeMoniker)
116121
throw new ArgumentOutOfRangeException(nameof(runtimeMoniker), runtimeMoniker, $"Runtime moniker {runtimeMoniker} is not supported");
117122
}
118123
}
119-
}
124+
}

src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma
528528
case RuntimeMoniker.Net70:
529529
case RuntimeMoniker.Net80:
530530
case RuntimeMoniker.Net90:
531+
case RuntimeMoniker.Net10_0:
531532
return baseJob
532533
.WithRuntime(runtimeMoniker.GetRuntime())
533534
.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
547548
case RuntimeMoniker.NativeAot90:
548549
return CreateAotJob(baseJob, options, runtimeMoniker, "", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json");
549550

551+
case RuntimeMoniker.NativeAot10_0:
552+
return CreateAotJob(baseJob, options, runtimeMoniker, "", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10/nuget/v3/index.json");
553+
550554
case RuntimeMoniker.Wasm:
551555
return MakeWasmJob(baseJob, options, RuntimeInformation.IsNetCore ? CoreRuntime.GetCurrentVersion().MsBuildMoniker : "net5.0", runtimeMoniker);
552556

@@ -565,6 +569,9 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma
565569
case RuntimeMoniker.WasmNet90:
566570
return MakeWasmJob(baseJob, options, "net9.0", runtimeMoniker);
567571

572+
case RuntimeMoniker.WasmNet10_0:
573+
return MakeWasmJob(baseJob, options, "net10.0", runtimeMoniker);
574+
568575
case RuntimeMoniker.MonoAOTLLVM:
569576
return MakeMonoAOTLLVMJob(baseJob, options, RuntimeInformation.IsNetCore ? CoreRuntime.GetCurrentVersion().MsBuildMoniker : "net6.0", runtimeMoniker);
570577

@@ -580,6 +587,9 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma
580587
case RuntimeMoniker.MonoAOTLLVMNet90:
581588
return MakeMonoAOTLLVMJob(baseJob, options, "net9.0", runtimeMoniker);
582589

590+
case RuntimeMoniker.MonoAOTLLVMNet10_0:
591+
return MakeMonoAOTLLVMJob(baseJob, options, "net10.0", runtimeMoniker);
592+
583593
case RuntimeMoniker.Mono60:
584594
return MakeMonoJob(baseJob, options, MonoRuntime.Mono60);
585595

@@ -592,6 +602,9 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma
592602
case RuntimeMoniker.Mono90:
593603
return MakeMonoJob(baseJob, options, MonoRuntime.Mono90);
594604

605+
case RuntimeMoniker.Mono10_0:
606+
return MakeMonoJob(baseJob, options, MonoRuntime.Mono10_0);
607+
595608
default:
596609
throw new NotSupportedException($"Runtime {runtimeId} is not supported");
597610
}

src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ public class CoreRuntime : Runtime
2525
public static readonly CoreRuntime Core70 = new (RuntimeMoniker.Net70, "net7.0", ".NET 7.0");
2626
public static readonly CoreRuntime Core80 = new (RuntimeMoniker.Net80, "net8.0", ".NET 8.0");
2727
public static readonly CoreRuntime Core90 = new (RuntimeMoniker.Net90, "net9.0", ".NET 9.0");
28+
public static readonly CoreRuntime Core10_0 = new (RuntimeMoniker.Net10_0, "net10.0", ".NET 10.0");
2829

29-
public static CoreRuntime Latest => Core90; // when dotnet/runtime branches for 10.0, this will need to get updated
30+
public static CoreRuntime Latest => Core10_0; // when dotnet/runtime branches for 11.0, this will need to get updated
3031

3132
private CoreRuntime(RuntimeMoniker runtimeMoniker, string msBuildMoniker, string displayName)
3233
: base(runtimeMoniker, msBuildMoniker, displayName)
@@ -74,6 +75,7 @@ internal static CoreRuntime FromVersion(Version version)
7475
case Version v when v.Major == 7 && v.Minor == 0: return GetPlatformSpecific(Core70);
7576
case Version v when v.Major == 8 && v.Minor == 0: return GetPlatformSpecific(Core80);
7677
case Version v when v.Major == 9 && v.Minor == 0: return GetPlatformSpecific(Core90);
78+
case Version v when v.Major == 10 && v.Minor == 0: return GetPlatformSpecific(Core10_0);
7779
default:
7880
return version >= new Version(3, 1)
7981
? CreateForNewVersion($"net{version.Major}.{version.Minor}", $".NET {version.Major}.{version.Minor}")

src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class MonoRuntime : Runtime, IEquatable<MonoRuntime>
1010
public static readonly MonoRuntime Mono70 = new ("Mono with .NET 7.0", RuntimeMoniker.Mono70, "net7.0", isDotNetBuiltIn: true);
1111
public static readonly MonoRuntime Mono80 = new ("Mono with .NET 8.0", RuntimeMoniker.Mono80, "net8.0", isDotNetBuiltIn: true);
1212
public static readonly MonoRuntime Mono90 = new ("Mono with .NET 9.0", RuntimeMoniker.Mono90, "net9.0", isDotNetBuiltIn: true);
13+
public static readonly MonoRuntime Mono10_0 = new ("Mono with .NET 10.0", RuntimeMoniker.Mono10_0, "net10.0", isDotNetBuiltIn: true);
1314

1415
public string CustomPath { get; }
1516

src/BenchmarkDotNet/Environments/Runtimes/NativeAotRuntime.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ public class NativeAotRuntime : Runtime
2222
/// NativeAOT compiled as net9.0
2323
/// </summary>
2424
public static readonly NativeAotRuntime Net90 = new NativeAotRuntime(RuntimeMoniker.NativeAot90, "net9.0", "NativeAOT 9.0");
25+
/// <summary>
26+
/// NativeAOT compiled as net10.0
27+
/// </summary>
28+
public static readonly NativeAotRuntime Net10_0 = new NativeAotRuntime(RuntimeMoniker.NativeAot10_0, "net10.0", "NativeAOT 10.0");
2529

2630
public override bool IsAOT => true;
2731

@@ -48,6 +52,7 @@ public static NativeAotRuntime GetCurrentVersion()
4852
case Version v when v.Major == 7 && v.Minor == 0: return Net70;
4953
case Version v when v.Major == 8 && v.Minor == 0: return Net80;
5054
case Version v when v.Major == 9 && v.Minor == 0: return Net90;
55+
case Version v when v.Major == 10 && v.Minor == 0: return Net10_0;
5156
default:
5257
return new NativeAotRuntime(RuntimeMoniker.NotRecognized, $"net{version.Major}.{version.Minor}", $"NativeAOT {version.Major}.{version.Minor}");
5358
}

src/BenchmarkDotNet/Extensions/RuntimeMonikerExtensions.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ internal static Runtime GetRuntime(this RuntimeMoniker runtimeMoniker)
3939
return CoreRuntime.Core80;
4040
case RuntimeMoniker.Net90:
4141
return CoreRuntime.Core90;
42+
case RuntimeMoniker.Net10_0:
43+
return CoreRuntime.Core10_0;
4244
case RuntimeMoniker.Mono:
4345
return MonoRuntime.Default;
4446
case RuntimeMoniker.NativeAot60:
@@ -47,16 +49,16 @@ internal static Runtime GetRuntime(this RuntimeMoniker runtimeMoniker)
4749
return NativeAotRuntime.Net70;
4850
case RuntimeMoniker.NativeAot80:
4951
return NativeAotRuntime.Net80;
50-
case RuntimeMoniker.NativeAot90:
51-
return NativeAotRuntime.Net90;
52+
case RuntimeMoniker.NativeAot10_0:
53+
return NativeAotRuntime.Net10_0;
5254
case RuntimeMoniker.Mono60:
5355
return MonoRuntime.Mono60;
5456
case RuntimeMoniker.Mono70:
5557
return MonoRuntime.Mono70;
5658
case RuntimeMoniker.Mono80:
5759
return MonoRuntime.Mono80;
58-
case RuntimeMoniker.Mono90:
59-
return MonoRuntime.Mono90;
60+
case RuntimeMoniker.Mono10_0:
61+
return MonoRuntime.Mono10_0;
6062
default:
6163
throw new ArgumentOutOfRangeException(nameof(runtimeMoniker), runtimeMoniker, "Runtime Moniker not supported");
6264
}

src/BenchmarkDotNet/Toolchains/CsProj/CsProjCoreToolchain.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class CsProjCoreToolchain : Toolchain, IEquatable<CsProjCoreToolchain>
2929
[PublicAPI] public static readonly IToolchain NetCoreApp70 = From(NetCoreAppSettings.NetCoreApp70);
3030
[PublicAPI] public static readonly IToolchain NetCoreApp80 = From(NetCoreAppSettings.NetCoreApp80);
3131
[PublicAPI] public static readonly IToolchain NetCoreApp90 = From(NetCoreAppSettings.NetCoreApp90);
32+
[PublicAPI] public static readonly IToolchain NetCoreApp10_0 = From(NetCoreAppSettings.NetCoreApp10_0);
3233

3334
internal CsProjCoreToolchain(string name, IGenerator generator, IBuilder builder, IExecutor executor, string customDotNetCliPath)
3435
: base(name, generator, builder, executor)

0 commit comments

Comments
 (0)