Table of Contents

Class GeneratorBase

Namespace
BenchmarkDotNet.Toolchains
Assembly
BenchmarkDotNet.dll
public abstract class GeneratorBase : IGenerator
Inheritance
GeneratorBase
Implements
Derived

Constructors

GeneratorBase()

protected GeneratorBase()

Methods

CopyAllRequiredFiles(ArtifactsPaths)

if you need to copy some extra files to make the benchmarks work you should override this method

protected virtual void CopyAllRequiredFiles(ArtifactsPaths artifactsPaths)

Parameters

artifactsPaths ArtifactsPaths

GenerateAppConfig(BuildPartition, ArtifactsPaths)

generates an app.config file next to the executable with benchmarks

protected virtual void GenerateAppConfig(BuildPartition buildPartition, ArtifactsPaths artifactsPaths)

Parameters

buildPartition BuildPartition
artifactsPaths ArtifactsPaths

GenerateBuildScript(BuildPartition, ArtifactsPaths)

generates a script can be used when debugging compilation issues

protected abstract void GenerateBuildScript(BuildPartition buildPartition, ArtifactsPaths artifactsPaths)

Parameters

buildPartition BuildPartition
artifactsPaths ArtifactsPaths

GenerateCode(BuildPartition, ArtifactsPaths)

generates the C# source code with all required boilerplate. You most probably do NOT need to override this method!!

protected virtual void GenerateCode(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 virtual void GenerateNuGetConfig(ArtifactsPaths artifactsPaths)

Parameters

artifactsPaths ArtifactsPaths

GenerateProject(BuildPartition, ILogger, string)

public GenerateResult GenerateProject(BuildPartition buildPartition, ILogger logger, string rootArtifactsFolderPath)

Parameters

buildPartition BuildPartition
logger ILogger
rootArtifactsFolderPath string

Returns

GenerateResult

GenerateProject(BuildPartition, ArtifactsPaths, ILogger)

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

protected virtual 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 abstract 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 virtual string GetBinariesDirectoryPath(string buildArtifactsDirectoryPath, string configuration)

Parameters

buildArtifactsDirectoryPath string
configuration string

Returns

string

GetBuildArtifactsDirectoryPath(BuildPartition, string)

returns a path to the folder where auto-generated project and code are going to be placed

protected abstract string GetBuildArtifactsDirectoryPath(BuildPartition assemblyLocation, string programName)

Parameters

assemblyLocation BuildPartition
programName string

Returns

string

GetExecutableExtension()

returns OS-specific executable extension

protected virtual string GetExecutableExtension()

Returns

string

GetExecutablePath(string, string)

protected virtual string GetExecutablePath(string binariesDirectoryPath, string programName)

Parameters

binariesDirectoryPath string
programName string

Returns

string

GetIntermediateDirectoryPath(string, string)

returns a path where intermediate files should be found after the build (usually \obj)

protected virtual string GetIntermediateDirectoryPath(string buildArtifactsDirectoryPath, string configuration)

Parameters

buildArtifactsDirectoryPath string
configuration string

Returns

string

GetPackagesDirectoryPath(string)

returns a path to the folder where NuGet packages should be restored

protected virtual string GetPackagesDirectoryPath(string buildArtifactsDirectoryPath)

Parameters

buildArtifactsDirectoryPath string

Returns

string

GetProjectFilePath(string)

returns a path to the auto-generated .csproj file

protected virtual string GetProjectFilePath(string buildArtifactsDirectoryPath)

Parameters

buildArtifactsDirectoryPath string

Returns

string