Show / Hide Table of Contents

Class GeneratorBase

Inheritance
Object
GeneratorBase
DotNetCliGenerator
Generator
Implements
IGenerator
Namespace: BenchmarkDotNet.Toolchains
Assembly: BenchmarkDotNet.dll
Syntax
public abstract class GeneratorBase : IGenerator

Methods

CopyAllRequiredFiles(ArtifactsPaths)

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

Declaration
protected virtual void CopyAllRequiredFiles(ArtifactsPaths artifactsPaths)
Parameters
Type Name Description
ArtifactsPaths artifactsPaths

GenerateAppConfig(BuildPartition, ArtifactsPaths)

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

Declaration
protected virtual void GenerateAppConfig(BuildPartition buildPartition, ArtifactsPaths artifactsPaths)
Parameters
Type Name Description
BuildPartition buildPartition
ArtifactsPaths artifactsPaths

GenerateBuildScript(BuildPartition, ArtifactsPaths)

generates a script can be used when debugging compilation issues

Declaration
protected abstract void GenerateBuildScript(BuildPartition buildPartition, ArtifactsPaths artifactsPaths)
Parameters
Type Name Description
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!!

Declaration
protected virtual void GenerateCode(BuildPartition buildPartition, ArtifactsPaths artifactsPaths)
Parameters
Type Name Description
BuildPartition buildPartition
ArtifactsPaths artifactsPaths

GenerateNuGetConfig(ArtifactsPaths)

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

Declaration
protected virtual void GenerateNuGetConfig(ArtifactsPaths artifactsPaths)
Parameters
Type Name Description
ArtifactsPaths artifactsPaths

GenerateProject(BuildPartition, ILogger, String)

Declaration
public GenerateResult GenerateProject(BuildPartition buildPartition, ILogger logger, string rootArtifactsFolderPath)
Parameters
Type Name Description
BuildPartition buildPartition
ILogger logger
String rootArtifactsFolderPath
Returns
Type Description
GenerateResult

GenerateProject(BuildPartition, ArtifactsPaths, ILogger)

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

Declaration
protected virtual void GenerateProject(BuildPartition buildPartition, ArtifactsPaths artifactsPaths, ILogger logger)
Parameters
Type Name Description
BuildPartition buildPartition
ArtifactsPaths artifactsPaths
ILogger logger

GetArtifactsToCleanup(ArtifactsPaths)

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

Declaration
protected abstract string[] GetArtifactsToCleanup(ArtifactsPaths artifactsPaths)
Parameters
Type Name Description
ArtifactsPaths artifactsPaths
Returns
Type Description
String[]

GetBinariesDirectoryPath(String, String)

returns a path where executable should be found after the build

Declaration
protected virtual string GetBinariesDirectoryPath(string buildArtifactsDirectoryPath, string configuration)
Parameters
Type Name Description
String buildArtifactsDirectoryPath
String configuration
Returns
Type Description
String

GetBuildArtifactsDirectoryPath(BuildPartition, String)

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

Declaration
protected abstract string GetBuildArtifactsDirectoryPath(BuildPartition assemblyLocation, string programName)
Parameters
Type Name Description
BuildPartition assemblyLocation
String programName
Returns
Type Description
String

GetExecutableExtension()

returns OS-specific executable extension

Declaration
protected virtual string GetExecutableExtension()
Returns
Type Description
String

GetExecutablePath(String, String)

Declaration
protected virtual string GetExecutablePath(string binariesDirectoryPath, string programName)
Parameters
Type Name Description
String binariesDirectoryPath
String programName
Returns
Type Description
String

GetPackagesDirectoryPath(String)

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

Declaration
protected virtual string GetPackagesDirectoryPath(string buildArtifactsDirectoryPath)
Parameters
Type Name Description
String buildArtifactsDirectoryPath
Returns
Type Description
String

GetProjectFilePath(String)

returns a path to the auto-generated .csproj file

Declaration
protected virtual string GetProjectFilePath(string buildArtifactsDirectoryPath)
Parameters
Type Name Description
String buildArtifactsDirectoryPath
Returns
Type Description
String

Implements

IGenerator
In This Article
Back to top Copyright © 2013–2021 .NET Foundation and contributors