Table of Contents

Class BuildDefinition

Namespace
Invex.Atom.Build.Definition
Assembly
Invex.Atom.Build.dll

The standard abstract base class for creating build definitions, providing default implementations for IBuildDefinition.

public abstract class BuildDefinition : IBuildDefinition, IBuildAccessor
Inheritance
object
BuildDefinition
Implements
Derived

Examples

A typical build definition:

[BuildDefinition]
internal partial class MyBuild : BuildDefinition, IMyTargets
{
    // ...
}

Remarks

The TargetDefinitions and ParamDefinitions properties are populated by source generators based on the interfaces and attributes used in the derived class. A derived class must be decorated with BuildDefinitionAttribute.

The generated part of the class also implements IConfigureHost and declares the optional partial methods static partial void OnConfigureHostBuilder(IHostApplicationBuilder builder) and static partial void OnConfigureHost(IHost host). Implement them in the derived class to register services or configure the host. They run after the module hooks, without constructing the build definition.

Constructors

BuildDefinition(IServiceProvider)

The standard abstract base class for creating build definitions, providing default implementations for IBuildDefinition.

protected BuildDefinition(IServiceProvider services)

Parameters

services IServiceProvider

The service provider for dependency injection.

Examples

A typical build definition:

[BuildDefinition]
internal partial class MyBuild : BuildDefinition, IMyTargets
{
    // ...
}

Remarks

The TargetDefinitions and ParamDefinitions properties are populated by source generators based on the interfaces and attributes used in the derived class. A derived class must be decorated with BuildDefinitionAttribute.

The generated part of the class also implements IConfigureHost and declares the optional partial methods static partial void OnConfigureHostBuilder(IHostApplicationBuilder builder) and static partial void OnConfigureHost(IHost host). Implement them in the derived class to register services or configure the host. They run after the module hooks, without constructing the build definition.

Properties

ParamDefinitions

Gets the collection of parameter definitions for the build.

public abstract IReadOnlyDictionary<string, ParamDefinition> ParamDefinitions { get; }

Property Value

IReadOnlyDictionary<string, ParamDefinition>

Remarks

Parameters allow for external input to customize the build process. This collection is populated by source generation based on properties marked with ParamDefinitionAttribute or SecretDefinitionAttribute.

Services

Provides access to the service provider associated with the build definition. This property allows resolving dependencies and accessing services registered in the application.

public IServiceProvider Services { get; }

Property Value

IServiceProvider

TargetDefinitions

Gets the collection of target definitions for the build.

public abstract IReadOnlyDictionary<string, Target> TargetDefinitions { get; }

Property Value

IReadOnlyDictionary<string, Target>

Remarks

Targets represent individual units of work. This collection is populated by source generation based on Target properties in interfaces that inherit IBuildAccessor

Methods

AccessParam(string)

Retrieves the value of a build parameter by its name.

public abstract object? AccessParam(string paramName)

Parameters

paramName string

The name of the parameter to access.

Returns

object

The value of the specified parameter, or null if not defined or has no value.