C# Class Bari.Core.Build.BuildContext

The default IBuildContext implementation.

Build context collects a set of IBuilder instances to be executed and ensures that they are started in topological order according to their dependency constraints.

Inheritance: IBuildContext
Show file Open project: vigoo/bari

Public Methods

Method Description
AddBuilder ( IBuilder builder ) : void

Adds a new builder to be executed to the context

AddTransformation ( Func transformation ) : void

Adds a new graph transformation which will be executed before the builders

BuildContext ( ICachedBuilderFactory cachedBuilderFactory, IMonitoredBuilderFactory monitoredBuilderFactory, Func createBuilderStatistics ) : System

Initializes the build context

Contains ( IBuilder builder ) : bool

Checks whether the given builder was already added to the context

Dump ( Stream>.Func builderGraphStreamFactory, IBuilder rootBuilder ) : void

Dumps the build context to dot files

DumpDependencies ( IBuilder rootBuilder, IUserOutput output ) : void

Dumps the dependencies of the builder

GetAllResultsIn ( TargetRelativePath targetDir ) : IEnumerable

Gets all the result files under the given subdirectory of target root

GetDependencies ( IBuilder builder ) : IEnumerable

Gets the dependent builders of a given builder

GetEffectiveBuilder ( IBuilder builder ) : IBuilder

Gets the registered effective builder instance for a given builder at the given context

GetResults ( IBuilder builder ) : ISet

Gets the result paths returned by the given builder if it has already ran. Otherwise it throws an exception.

Run ( IBuilder rootBuilder = null, bool>.Func filter = null ) : ISet

Runs all the added builders

Private Methods

Method Description
CreateCachedBuilder ( IBuilder builder, IBuilderStatistics statistics ) : IBuilder
CreateMonitoredBuilder ( IBuilder builder, IBuilderStatistics statistics ) : IBuilder
DumpGraph ( Stream finalStream, AdjacencyGraph graph ) : void
HasCycles ( IVertexListGraph graph ) : bool
RemoveIrrelevantBranches ( AdjacencyGraph graph, IBuilder rootBuilder ) : void
RunTransformations ( Stream>.Func builderGraphStreamFactory = null ) : bool
WrapBuilder ( IBuilder builder, IBuilderStatistics statistics ) : IBuilder

Method Details

AddBuilder() public method

Adds a new builder to be executed to the context
public AddBuilder ( IBuilder builder ) : void
builder IBuilder The builder to be executed
return void

AddTransformation() public method

Adds a new graph transformation which will be executed before the builders
public AddTransformation ( Func transformation ) : void
transformation Func Transformation function, returns false to cancel the build process
return void

BuildContext() public method

Initializes the build context
public BuildContext ( ICachedBuilderFactory cachedBuilderFactory, IMonitoredBuilderFactory monitoredBuilderFactory, Func createBuilderStatistics ) : System
cachedBuilderFactory ICachedBuilderFactory Interface to create new cached builders
monitoredBuilderFactory IMonitoredBuilderFactory Interface to create new monitored builders
createBuilderStatistics Func Factory function for IBuilderStatistics instances
return System

Contains() public method

Checks whether the given builder was already added to the context
public Contains ( IBuilder builder ) : bool
builder IBuilder Builder to look for
return bool

Dump() public method

Dumps the build context to dot files
public Dump ( Stream>.Func builderGraphStreamFactory, IBuilder rootBuilder ) : void
builderGraphStreamFactory Stream>.Func Stream factory to open named streams where the builder graphs will be dumped
rootBuilder IBuilder The root builder
return void

DumpDependencies() public method

Dumps the dependencies of the builder
public DumpDependencies ( IBuilder rootBuilder, IUserOutput output ) : void
rootBuilder IBuilder The root builder
output IUserOutput Output to dump information to
return void

GetAllResultsIn() public method

Gets all the result files under the given subdirectory of target root
public GetAllResultsIn ( TargetRelativePath targetDir ) : IEnumerable
targetDir TargetRelativePath Subdirectory of target
return IEnumerable

GetDependencies() public method

Gets the dependent builders of a given builder
public GetDependencies ( IBuilder builder ) : IEnumerable
builder IBuilder Builder to get dependencies of
return IEnumerable

GetEffectiveBuilder() public method

Gets the registered effective builder instance for a given builder at the given context
public GetEffectiveBuilder ( IBuilder builder ) : IBuilder
builder IBuilder Builder to resolve
return IBuilder

GetResults() public method

Gets the result paths returned by the given builder if it has already ran. Otherwise it throws an exception.
public GetResults ( IBuilder builder ) : ISet
builder IBuilder Builder which was added previously with and was already executed.
return ISet

Run() public method

Runs all the added builders
public Run ( IBuilder rootBuilder = null, bool>.Func filter = null ) : ISet
rootBuilder IBuilder The root builder which represents the final goal of the build process. /// If specified, every branch which is not accessible from the root builder will be removed /// from the build graph before executing it.
filter bool>.Func Filter function, can be used to skip specific builders
return ISet