Table of Contents

Class TargetDefinition

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

Defines a target that can be modeled and executed, including its tasks, dependencies, and parameters.

public sealed class TargetDefinition
Inheritance
object
TargetDefinition
Extension Methods

Constructors

TargetDefinition()

public TargetDefinition()

Properties

ConsumedArtifacts

Gets the list of artifacts that must be produced by other targets before this target can run.

public IReadOnlyList<ConsumedArtifact> ConsumedArtifacts { get; }

Property Value

IReadOnlyList<ConsumedArtifact>

ConsumedVariables

Gets the list of variables that must be produced by other targets before this target can run.

public IReadOnlyList<ConsumedVariable> ConsumedVariables { get; }

Property Value

IReadOnlyList<ConsumedVariable>

Dependencies

Gets the list of target names that must be executed before this target.

public IReadOnlyList<string> Dependencies { get; }

Property Value

IReadOnlyList<string>

Description

Gets the description of the target, used for help text.

public string? Description { get; }

Property Value

string

IsHidden

Gets a value indicating whether the target should be hidden from help output unless verbose mode is enabled.

public bool IsHidden { get; }

Property Value

bool

Name

Gets the name of the target. Target names must be unique.

public required string Name { get; init; }

Property Value

string

Params

Gets the list of parameters that are used or required by this target.

public IReadOnlyList<DefinedParam> Params { get; }

Property Value

IReadOnlyList<DefinedParam>

ProducedArtifacts

Gets the list of artifacts that will be produced by this target.

public IReadOnlyList<ProducedArtifact> ProducedArtifacts { get; }

Property Value

IReadOnlyList<ProducedArtifact>

ProducedVariables

Gets the list of variables that will be produced by this target.

public IReadOnlyList<string> ProducedVariables { get; }

Property Value

IReadOnlyList<string>

Tasks

Gets the list of asynchronous tasks that will be executed when the target runs.

public IReadOnlyList<Func<CancellationToken, Task>> Tasks { get; }

Property Value

IReadOnlyList<Func<CancellationToken, Task>>

Methods

AsHidden(bool)

Sets whether the target should be hidden from help output.

public TargetDefinition AsHidden(bool hidden = true)

Parameters

hidden bool

If true, the target will be hidden.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

ConsumesArtifact(string, string, IEnumerable<string>)

Declares an artifact from multiple build slices that this target consumes.

public TargetDefinition ConsumesArtifact(string targetName, string artifactName, IEnumerable<string> buildSlices)

Parameters

targetName string

The name of the target that produces the artifact.

artifactName string

The name of the artifact to consume.

buildSlices IEnumerable<string>

The build slices to consume the artifact from.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

ConsumesArtifact(string, string, string?)

Declares an artifact that this target consumes.

public TargetDefinition ConsumesArtifact(string targetName, string artifactName, string? buildSlice = null)

Parameters

targetName string

The name of the target that produces the artifact.

artifactName string

The name of the artifact to consume.

buildSlice string

An optional build slice associated with the artifact.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

ConsumesArtifacts(string, IEnumerable<string>, IEnumerable<string>)

Declares multiple artifacts from multiple build slices that this target consumes.

public TargetDefinition ConsumesArtifacts(string targetName, IEnumerable<string> artifactNames, IEnumerable<string> buildSlices)

Parameters

targetName string

The name of the target that produces the artifacts.

artifactNames IEnumerable<string>

The names of the artifacts to consume.

buildSlices IEnumerable<string>

The build slices to consume the artifacts from.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

ConsumesArtifacts(string, IEnumerable<string>, string?)

Declares multiple artifacts from a single target that this target consumes.

public TargetDefinition ConsumesArtifacts(string targetName, IEnumerable<string> artifactNames, string? buildSlice = null)

Parameters

targetName string

The name of the target that produces the artifacts.

artifactNames IEnumerable<string>

The names of the artifacts to consume.

buildSlice string

An optional build slice associated with the artifacts.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

ConsumesVariable(string, string)

Declares a variable that this target consumes.

public TargetDefinition ConsumesVariable(string targetName, string outputName)

Parameters

targetName string

The name of the target that produces the variable.

outputName string

The name of the variable to consume.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

DependsOn(Target, string?)

Adds a dependency on another target.

public TargetDefinition DependsOn(Target target, string? targetName = null)

Parameters

target Target

The target to depend on.

targetName string

The name of the target, inferred from the argument expression.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

DependsOn(TargetDefinition)

Adds a dependency on another target.

public TargetDefinition DependsOn(TargetDefinition target)

Parameters

target TargetDefinition

The target definition to depend on.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

DependsOn(string)

Adds a dependency on another target by its name.

public TargetDefinition DependsOn(string targetName)

Parameters

targetName string

The name of the target to depend on.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

DescribedAs(string)

Sets the description for the target.

public TargetDefinition DescribedAs(string description)

Parameters

description string

A human-readable description of the target's purpose.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

Executes(Action)

Adds a synchronous action to be executed when the target runs.

public TargetDefinition Executes(Action action)

Parameters

action Action

The synchronous action to execute.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

Executes(Func<CancellationToken, Task>)

Adds an asynchronous task to be executed when the target runs.

public TargetDefinition Executes(Func<CancellationToken, Task> task)

Parameters

task Func<CancellationToken, Task>

The asynchronous task to execute.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

Executes(Func<Task>)

Adds an asynchronous task to be executed when the target runs.

public TargetDefinition Executes(Func<Task> task)

Parameters

task Func<Task>

The asynchronous task to execute.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

Extends<T>(Func<T, Target>, bool)

Marks this target as an extension of another, inheriting its tasks, dependencies, and other properties.

public TargetDefinition Extends<T>(Func<T, Target> targetToExtend, bool runExtensionAfter = false)

Parameters

targetToExtend Func<T, Target>

The base target to extend.

runExtensionAfter bool

If true, the tasks of this target will run after the base target's tasks.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

Type Parameters

T

The type of the build definition containing the base target.

ProducesArtifact(string, string?)

Declares an artifact that this target produces.

public TargetDefinition ProducesArtifact(string artifactName, string? buildSlice = null)

Parameters

artifactName string

The name of the artifact.

buildSlice string

An optional build slice associated with the artifact.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

ProducesArtifacts(IEnumerable<string>, string?)

Declares multiple artifacts that this target produces.

public TargetDefinition ProducesArtifacts(IEnumerable<string> artifactNames, string? buildSlice = null)

Parameters

artifactNames IEnumerable<string>

The names of the artifacts.

buildSlice string

An optional build slice associated with the artifacts.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

ProducesVariable(string)

Declares a variable that this target produces.

public TargetDefinition ProducesVariable(string variableName)

Parameters

variableName string

The name of the variable.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

Remarks

This only declares the variable; it must be written using WriteVariable(string, string, CancellationToken).

RequiresParam(params IEnumerable<string>)

Specifies that this target requires the provided parameters.

public TargetDefinition RequiresParam(params IEnumerable<string> paramNames)

Parameters

paramNames IEnumerable<string>

The names of the parameters that are required.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.

UsesParam(params IEnumerable<string>)

Specifies that this target may use the provided parameters.

public TargetDefinition UsesParam(params IEnumerable<string> paramNames)

Parameters

paramNames IEnumerable<string>

The names of the parameters that may be used.

Returns

TargetDefinition

The current TargetDefinition for fluent chaining.