silk.build.delegate.

A build graph as a task program hands it to the compiler, and the compiler's answer.

A task program describes its standard steps instead of running them. The compiler restores the description, runs the steps and answers where each left its outputs.

Import as Delegate with import silk.build.delegate as Delegate.

Public declarations: 9.

RootDescription#

silk
pub struct RootDescription

One requested root of a described graph.

Field node#

silk
pub node: u64

The step's identity within the description.

Field name#

silk
pub name: String

The output that becomes the root's artifact.

Field compilation#

silk
pub compilation: bool

Whether the root is a compilation, which publishes its request.

Implementation Schema for RootDescription#

silk
impl Schema for RootDescription

Operation spec#

silk
static fn spec() -> Spec<RootDescription>

GraphDescription#

silk
pub struct GraphDescription

A build graph as the task program hands it to the compiler.

Field version#

silk
pub version: u64

The description format.

Field root#

silk
pub root: String

The package directory.

Field program#

silk
pub program: Option<String>

The executable that constructed the graph, whose contents enter every step key.

Field identity#

silk
pub identity: Option<String>

An explicit hexadecimal identity in place of the program's contents.

Field cache#

silk
pub cache: Option<String>

The step cache directory, when the caller chose one.

Field compile#

silk
pub compile: bool

Whether requested compilations run, or only publish their requests.

Field publish#

silk
pub publish: bool

Whether the roots publish their requests and artifacts, or only run.

Field memory#

silk
pub memory: u64

The bound on the sum of running steps' memory estimates, in bytes.

Field workers#

silk
pub workers: u64

The maximum number of workers.

Field steps#

silk
pub steps: List<StepDescription>

Every step of the graph, each after the steps it reads.

Field roots#

silk
pub roots: List<RootDescription>

The requested roots, in the order they were added.

Implementation Schema for GraphDescription#

silk
impl Schema for GraphDescription

Operation spec#

silk
static fn spec() -> Spec<GraphDescription>

ArtifactDescription#

silk
pub struct ArtifactDescription

One completed artifact of a described graph.

Field name#

silk
pub name: String

The artifact's name.

Field path#

silk
pub path: String

The artifact's path.

Field request#

silk
pub request: Option<String>

The published request file of a compilation.

Implementation Schema for ArtifactDescription#

silk
impl Schema for ArtifactDescription

Operation spec#

silk
static fn spec() -> Spec<ArtifactDescription>

OutputDescription#

silk
pub struct OutputDescription

Where one described step left its outputs.

Field node#

silk
pub node: u64

The step's identity within the description.

Field directory#

silk
pub directory: String

The step's cache directory.

Field volatile#

silk
pub volatile: bool

Whether the step runs every time.

Field compilation#

silk
pub compilation: bool

Whether the step is a compilation.

Field compiled#

silk
pub compiled: bool

Whether a compilation built its artifact, or only wrote its request.

Implementation Schema for OutputDescription#

silk
impl Schema for OutputDescription

Operation spec#

silk
static fn spec() -> Spec<OutputDescription>

CompiledDescription#

silk
pub struct CompiledDescription

One compilation the compiler reached while running a described graph.

Field directory#

silk
pub directory: String

The compilation's cache directory.

Field compiled#

silk
pub compiled: bool

Whether it built its artifact, or only wrote its request.

Implementation Schema for CompiledDescription#

silk
impl Schema for CompiledDescription

Operation spec#

silk
static fn spec() -> Spec<CompiledDescription>

Outcome#

silk
pub struct Outcome

What the compiler answers after running a described graph.

Field error#

silk
pub error: Option<String>

The failure to report, when the graph did not complete.

Field artifacts#

silk
pub artifacts: List<ArtifactDescription>

The completed artifacts of a published graph, in the order their roots were added.

Field outputs#

silk
pub outputs: List<OutputDescription>

The steps of a graph that was only run.

Field compilations#

silk
pub compilations: List<CompiledDescription>

The compilations reached by a graph that was only run.

Implementation Schema for Outcome#

silk
impl Schema for Outcome

Operation spec#

silk
static fn spec() -> Spec<Outcome>

hexadecimal#

silk
pub effect fn hexadecimal(bytes: &[u8]) -> String
  ! OutOfMemoryError
  ? &mut Allocator

Writes bytes as lowercase hexadecimal text.

binary#

silk
pub effect fn binary(text: string) -> Bytes
  ! OutOfMemoryError
  ? &mut Allocator

Reads the bytes that hexadecimal wrote.

submit#

silk
pub effect fn submit(description: &GraphDescription, directory: &Path) -> Outcome
  ! StepFailure
  ? &mut Allocator | &mut FileSystem | &mut HostInput

Hands a described graph to the compiler and reads its answer. The description and the answer are files in directory, named by the description's contents, and removed afterwards.

Errors#

StepError with the compiler's report when the graph fails, or when the compiler cannot run.

Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, wasm32-wasip1, wasm32-wasip2, x86_64-pc-windows-msvc, wasm64-unknown-unknown.

View the source of this page