Class Generator
- Namespace
- BenchmarkDotNet.Toolchains.NativeAot
- Assembly
- BenchmarkDotNet.dll
generates new csproj file for self-contained NativeAOT app based on https://github.com/dotnet/corert/blob/7f902d4d8b1c3280e60f5e06c71951a60da173fb/Documentation/how-to-build-and-run-ilcompiler-in-console-shell-prompt.md#compiling-source-to-native-code-using-the-ilcompiler-you-built and https://github.com/dotnet/corert/tree/7f902d4d8b1c3280e60f5e06c71951a60da173fb/samples/HelloWorld#add-corert-to-your-project
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
BuildPartitionartifactsPaths
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
BuildPartitionartifactsPaths
ArtifactsPathslogger
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
Returns
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
BuildPartitionprogramName
string
Returns
GetExecutableExtension()
returns OS-specific executable extension
protected override string GetExecutableExtension()
Returns
GetRdXmlFiles(Type, ILogger)
public IEnumerable<string> GetRdXmlFiles(Type benchmarkTarget, ILogger logger)