Skip to content

Commit 28b671b

Browse files
committed
Removed CsProjWithRoslynFallbackToolchain, default to CsProjClassicNetToolchain instead.
1 parent 5dec2aa commit 28b671b

File tree

8 files changed

+20
-169
lines changed

8 files changed

+20
-169
lines changed

src/BenchmarkDotNet/Toolchains/CsProj/CsProjClassicNetToolchain.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ public override IEnumerable<ValidationError> Validate(BenchmarkCase benchmarkCas
4747
$"Classic .NET toolchain is supported only for Windows, benchmark '{benchmarkCase.DisplayInfo}' will not be executed",
4848
benchmarkCase);
4949
}
50-
else if (IsCliPathInvalid(customDotNetCliPath: null, benchmarkCase, out var invalidCliError))
50+
else if (IsCliPathInvalid(customDotNetCliPath: null, benchmarkCase, out _))
5151
{
52-
yield return invalidCliError;
52+
yield return new ValidationError(true,
53+
"CsProjClassicNetToolchain requires dotnet SDK to be installed or path to local dotnet cli provided in explicit way using `--cli` argument." +
54+
$" You may also use RoslynToolchain instead. Benchmark '{benchmarkCase.DisplayInfo}' will not be executed",
55+
benchmarkCase);
5356
}
5457
}
5558
}

src/BenchmarkDotNet/Toolchains/CsProj/CsProjWithRoslynFallbackBuilder.cs

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/BenchmarkDotNet/Toolchains/CsProj/CsProjWithRoslynFallbackGenerateResult.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/BenchmarkDotNet/Toolchains/CsProj/CsProjWithRoslynFallbackGenerator.cs

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/BenchmarkDotNet/Toolchains/CsProj/CsProjWithRoslynFallbackToolchain.cs

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/BenchmarkDotNet/Toolchains/Results/GenerateResult.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ namespace BenchmarkDotNet.Toolchains.Results
55
{
66
public class GenerateResult
77
{
8-
public virtual ArtifactsPaths ArtifactsPaths { get; }
9-
public virtual bool IsGenerateSuccess { get; }
10-
public virtual Exception GenerateException { get; }
11-
public virtual IReadOnlyCollection<string> ArtifactsToCleanup { get; }
12-
13-
public GenerateResult() { }
8+
public ArtifactsPaths ArtifactsPaths { get; }
9+
public bool IsGenerateSuccess { get; }
10+
public Exception GenerateException { get; }
11+
public IReadOnlyCollection<string> ArtifactsToCleanup { get; }
1412

1513
public GenerateResult(ArtifactsPaths artifactsPaths, bool isGenerateSuccess, Exception generateException,
1614
IReadOnlyCollection<string> artifactsToCleanup)

src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,23 @@ private static IToolchain GetToolchain(Job job, Descriptor descriptor)
2727
? toolchain
2828
: GetToolchain(
2929
job.ResolveValue(EnvironmentMode.RuntimeCharacteristic, EnvironmentResolver.Instance),
30-
descriptor,
31-
job.HasValue(InfrastructureMode.NuGetReferencesCharacteristic) || job.HasValue(InfrastructureMode.BuildConfigurationCharacteristic));
30+
descriptor);
3231

33-
internal static IToolchain GetToolchain(this Runtime runtime, Descriptor descriptor = null, bool preferMsBuildToolchains = false)
32+
internal static IToolchain GetToolchain(this Runtime runtime, Descriptor descriptor = null)
3433
{
3534
switch (runtime)
3635
{
3736
case ClrRuntime clrRuntime:
38-
{
39-
var toolchain = clrRuntime.RuntimeMoniker != RuntimeMoniker.NotRecognized
37+
// Integration tests take too much time, because each benchmark run rebuilds the test suite and BenchmarkDotNet itself.
38+
// To reduce the total duration of the CI workflows, we just use RoslynToolchain.
39+
if (RuntimeInformation.IsFullFramework && XUnitHelper.IsIntegrationTest.Value)
40+
return RoslynToolchain.Instance;
41+
42+
// Default to CsProjClassicNetToolchain, even if the host is Full Framework.
43+
// If it doesn't work because the user doesn't have dotnet SDK installed, they can manually use RoslynToolchain in their config.
44+
return clrRuntime.RuntimeMoniker != RuntimeMoniker.NotRecognized
4045
? GetToolchain(clrRuntime.RuntimeMoniker)
4146
: CsProjClassicNetToolchain.From(clrRuntime.MsBuildMoniker);
42-
return RuntimeInformation.IsNetCore || preferMsBuildToolchains
43-
? toolchain
44-
// Integration tests take too much time because each benchmark run rebuilds the test suite and BenchmarkDotNet itself.
45-
// To reduce the total duration of the CI workflows, we just use RoslynToolchain.
46-
: XUnitHelper.IsIntegrationTest.Value
47-
? RoslynToolchain.Instance
48-
: new CsProjWithRoslynFallbackToolchain(toolchain);
49-
}
5047

5148
case MonoRuntime mono:
5249
if (RuntimeInformation.IsAndroid())

tests/BenchmarkDotNet.IntegrationTests/NugetReferenceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public NuGetReferenceTests(ITestOutputHelper output) : base(output)
2121
[FactEnvSpecific("For some reason this test is unstable on Ubuntu for both AzureDevOps and Travis CI", EnvRequirement.NonLinux)]
2222
public void UserCanSpecifyCustomNuGetPackageDependency()
2323
{
24-
var toolchain = RuntimeInformation.GetCurrentRuntime().GetToolchain(preferMsBuildToolchains: true);
24+
var toolchain = RuntimeInformation.GetCurrentRuntime().GetToolchain();
2525

2626
var job = Job.Dry.WithToolchain(toolchain).WithNuGet("Newtonsoft.Json", "13.0.2");
2727
var config = CreateSimpleConfig(job: job);

0 commit comments

Comments
 (0)