Skip to content

Commit e473053

Browse files
committed
Re-add MonoPublisher.
1 parent 621face commit e473053

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System.Collections.Generic;
2+
using BenchmarkDotNet.Jobs;
3+
using BenchmarkDotNet.Loggers;
4+
using BenchmarkDotNet.Running;
5+
using BenchmarkDotNet.Toolchains.DotNetCli;
6+
using BenchmarkDotNet.Toolchains.Results;
7+
8+
namespace BenchmarkDotNet.Toolchains.Mono;
9+
10+
public class MonoPublisher(string tfm, string customDotNetCliPath) : DotNetCliPublisher(tfm, customDotNetCliPath)
11+
{
12+
private string TargetFrameworkMoniker { get; } = tfm;
13+
private string CustomDotNetCliPath { get; } = customDotNetCliPath;
14+
15+
public override BuildResult Build(GenerateResult generateResult, BuildPartition buildPartition, ILogger logger)
16+
=> new DotNetCliCommand(
17+
CustomDotNetCliPath,
18+
generateResult.ArtifactsPaths.ProjectFilePath,
19+
TargetFrameworkMoniker,
20+
GetExtraArguments(),
21+
generateResult,
22+
logger,
23+
buildPartition,
24+
[],
25+
buildPartition.Timeout
26+
).Publish().ToBuildResult(generateResult);
27+
28+
private static string GetExtraArguments()
29+
{
30+
var runtimeIdentifier = CustomDotNetCliToolchainBuilder.GetPortableRuntimeIdentifier();
31+
// /p:RuntimeIdentifiers is set explicitly here because --self-contained requires it, see https://github.com/dotnet/sdk/issues/10566
32+
return $"--self-contained -r {runtimeIdentifier} /p:UseMonoRuntime=true /p:RuntimeIdentifiers={runtimeIdentifier}";
33+
}
34+
}

src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,10 @@ private MonoToolchain(string name, IGenerator generator, IBuilder builder, IExec
2323
public static new IToolchain From(NetCoreAppSettings settings)
2424
=> new MonoToolchain(settings.Name,
2525
new MonoGenerator(settings.TargetFrameworkMoniker, settings.CustomDotNetCliPath, settings.PackagesPath, settings.RuntimeFrameworkVersion),
26-
new DotNetCliPublisher(settings.TargetFrameworkMoniker, settings.CustomDotNetCliPath, GetExtraArguments()),
26+
new MonoPublisher(settings.TargetFrameworkMoniker, settings.CustomDotNetCliPath),
2727
new DotNetCliExecutor(settings.CustomDotNetCliPath),
2828
settings.CustomDotNetCliPath);
2929

30-
private static string GetExtraArguments()
31-
{
32-
var runtimeIdentifier = CustomDotNetCliToolchainBuilder.GetPortableRuntimeIdentifier();
33-
// /p:RuntimeIdentifiers is set explicitly here because --self-contained requires it, see https://github.com/dotnet/sdk/issues/10566
34-
return $"--self-contained -r {runtimeIdentifier} /p:UseMonoRuntime=true /p:RuntimeIdentifiers={runtimeIdentifier}";
35-
}
36-
3730
public override bool Equals(object obj) => obj is MonoToolchain typed && Equals(typed);
3831

3932
public bool Equals(MonoToolchain other) => Generator.Equals(other.Generator);

0 commit comments

Comments
 (0)