Table of Contents

Class Generator

Namespace
BenchmarkDotNet.Toolchains.NativeAot
Assembly
BenchmarkDotNet.dll
public class Generator : CsProjGenerator, IGenerator, IEquatable<CsProjGenerator>
Inheritance
Generator
Implements
Inherited Members

Methods

GenerateBuildScript(BuildPartition, ArtifactsPaths)

generates a script can be used when debugging compilation issues

protected override void GenerateBuildScript(BuildPartition buildPartition, ArtifactsPaths artifactsPaths)

Parameters

buildPartition BuildPartition
artifactsPaths ArtifactsPaths

GenerateNuGetConfig(ArtifactsPaths)

generates NuGet.Config file to make sure that BDN is using the right NuGet feeds

protected override void GenerateNuGetConfig(ArtifactsPaths artifactsPaths)

Parameters

artifactsPaths ArtifactsPaths

GenerateProject(BuildPartition, ArtifactsPaths, ILogger)

generates .csproj file with a reference to the project with benchmarks

protected override void GenerateProject(BuildPartition buildPartition, ArtifactsPaths artifactsPaths, ILogger logger)

Parameters

buildPartition BuildPartition
artifactsPaths ArtifactsPaths
logger ILogger

GetArtifactsToCleanup(ArtifactsPaths)

returns a list of artifacts that should be removed after running the benchmarks

protected override string[] GetArtifactsToCleanup(ArtifactsPaths artifactsPaths)

Parameters

artifactsPaths ArtifactsPaths

Returns

string[]

GetBinariesDirectoryPath(string, string)

returns a path where executable should be found after the build (usually \bin)

protected override string GetBinariesDirectoryPath(string buildArtifactsDirectoryPath, string configuration)

Parameters

buildArtifactsDirectoryPath string
configuration string

Returns

string

GetBuildArtifactsDirectoryPath(BuildPartition, string)

we need our folder to be on the same level as the project that we want to reference we are limited by xprojs (by default compiles all .cs files in all subfolders, Program.cs could be doubled and fail the build) and also by NuGet internal implementation like looking for global.json file in parent folders

protected override string GetBuildArtifactsDirectoryPath(BuildPartition buildPartition, string programName)

Parameters

buildPartition BuildPartition
programName string

Returns

string

GetExecutableExtension()

returns OS-specific executable extension

protected override string GetExecutableExtension()

Returns

string

GetRdXmlFiles(Type, ILogger)

public IEnumerable<string> GetRdXmlFiles(Type benchmarkTarget, ILogger logger)

Parameters

benchmarkTarget Type
logger ILogger

Returns

IEnumerable<string>