silk.build.request.

Complete compilation inputs for the compiler and development tools.

When to use#

Use Request to describe one compilation independently of a package manifest or task program. Read and write it with silk.schema.toml.SchemaToml or silk.schema.json.SchemaJson. Generate its JSON Schema with silk.schema.json_schema.JsonSchemas.

Details#

All filesystem paths are absolute. Packages and their import edges are explicit. Compilation requests contain resolved values and never execute a task or fetch a dependency. Every record rejects unknown fields. The version field identifies this wire format.

Import as Request with import silk.build.request { Request }.

Public declarations: 25.

Request#

silk
pub struct Request

One complete compilation, with no manifest discovery.

Field version#

silk
pub version: u32

The request format version; currently 1.

Field name#

silk
pub name: String

The artifact name, without a directory.

Field artifact#

silk
pub artifact: String

The artifact kind: executable, loadable-module, static-archive, object, or test.

Field root#

silk
pub root: String

The absolute path of the root Silk module.

Field rootModule#

silk
pub rootModule: String

The root module identity within the root package, independent of its physical file.

Field output#

silk
pub output: String

The absolute path at which the compiler writes the artifact.

Field stdlib#

silk
pub stdlib: String

The absolute path of the standard library.

Field profile#

silk
pub profile: Profile

The program-wide compilation settings.

Field packages#

silk
pub packages: List<Package>

Every package used by this compilation, with the root package first.

Field composition#

silk
pub composition: Composition

The selected runtime, support modules, and execution-storage bindings.

Field native#

silk
pub native: Native

The ordered native inputs of the whole compilation.

Field emit#

silk
pub emit: String

The emitted form: final, llvm-ir, llvm-bitcode, assembly, object, or wasm-text.

Field platform#

silk
pub platform: Option<Platform>

An explicit sysroot and linker supply, when the target needs one.

Field windows#

silk
pub windows: Option<Windows>

Windows-specific link options.

Field macos#

silk
pub macos: Option<MacOS>

macOS-specific link and signing options.

Field wasm#

silk
pub wasm: Option<Wasm>

WebAssembly memory and execution options.

Field header#

silk
pub header: Option<String>

The absolute path of an emitted C header, when requested.

Field importLibrary#

silk
pub importLibrary: Option<String>

The absolute path of an emitted import library, when requested.

Field runner#

silk
pub runner: Option<Runner>

The program used to run a foreign artifact or its tests.

Implementation Schema for Request#

silk
impl Schema for Request

Operation spec#

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

Operation check#

silk
fn check(self: &Self, checks: &mut Checks<Self>) -> ()

Requires unique package identities and import aliases, with every dependency resolved in the request.

Profile#

silk
pub struct Profile

Program-wide source facts and default backend settings.

Field target#

silk
pub target: String

The canonical target triple.

Field cpu#

silk
pub cpu: Option<String>

The CPU model.

Field cpuFeatures#

silk
pub cpuFeatures: List<String>

The enabled CPU features.

Field deployment#

silk
pub deployment: Option<String>

The minimum operating-system version.

Field libc#

silk
pub libc: String

The selected C library.

Field entry#

silk
pub entry: String

The entry selection: default, none, or a declared name.

Field runtime#

silk
pub runtime: String

The runtime selection: default, none, or a declared name.

silk
pub link: String

The link mode.

Field codeModel#

silk
pub codeModel: String

The target code model.

Field relocation#

silk
pub relocation: String

The relocation model.

Field optimization#

silk
pub optimization: String

The program-wide optimization: none, speed, or size.

Field debug#

silk
pub debug: bool

Whether the program emits debug information by default.

Field safety#

silk
pub safety: String

The program-wide safety policy.

Field threading#

silk
pub threading: String

The program-wide threading policy.

Field sanitizers#

silk
pub sanitizers: List<String>

The enabled sanitizers.

Field unwind#

silk
pub unwind: String

The unwind policy.

Field backend#

silk
pub backend: String

The code generator: llvm or direct.

Field codegenUnits#

silk
pub codegenUnits: Option<u64>

The number of code generation units for an optimized build.

Field maxMemory#

silk
pub maxMemory: Option<u64>

The maximum WebAssembly memory, in bytes.

Field stackSize#

silk
pub stackSize: Option<u64>

The main stack size, in bytes.

Implementation Schema for Profile#

silk
impl Schema for Profile

Operation spec#

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

profileSpec#

silk
pub static fn profileSpec<T>() -> Spec<T>

Describes the shared profile field names and domains for resolved and optional settings.

Package#

silk
pub struct Package

A resolved source package and the settings its consumer supplied.

Field name#

silk
pub name: String

The package name.

Field version#

silk
pub version: String

The package version.

Field directory#

silk
pub directory: String

The absolute package directory used for relative embedded files.

Field source#

silk
pub source: String

The absolute root directory of its Silk modules.

Field dependencies#

silk
pub dependencies: List<Dependency>

The import aliases and exact package identities they select.

Field exports#

silk
pub exports: List<String>

The canonical module paths other packages may import.

Field parameters#

silk
pub parameters: List<Parameter>

The declared parameters and their resolved values.

Field modules#

silk
pub modules: List<Module>

Generated modules, with their absolute source paths.

Field optimization#

silk
pub optimization: Option<String>

The backend optimization override; source-visible optimization stays program-wide.

Field debug#

silk
pub debug: Option<bool>

The backend debug-information override.

Implementation Schema for Package#

silk
impl Schema for Package

Operation spec#

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

Dependency#

silk
pub struct Dependency

An import alias bound to an exact package identity.

Field name#

silk
pub name: String

The import alias.

Field package#

silk
pub package: String

The selected package identity, as name@version.

Implementation Schema for Dependency#

silk
impl Schema for Dependency

Operation spec#

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

Parameter#

silk
pub struct Parameter

A declared package parameter, including its documentation and bound value.

Field name#

silk
pub name: String

The public parameter name.

Field module#

silk
pub module: String

The module that declares the parameter, relative to its package.

Field typeName#

silk
pub typeName: String

The admitted Silk type of the parameter.

Field description#

silk
pub description: String

The declaration documentation.

Field required#

silk
pub required: bool

Whether the declaration has no default.

Field default#

silk
pub default: Option<ParameterValue>

The declared default, when present.

Field value#

silk
pub value: ParameterValue

The value bound for this compilation.

Field suppliedPath#

silk
pub suppliedPath: bool

Whether the root supplied this value as a path capability.

Implementation Schema for Parameter#

silk
impl Schema for Parameter

Operation spec#

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

ParameterValue#

silk
pub union ParameterValue

A resolved parameter value. Lists and records preserve their declared element and field types.

Text#

silk
Text

A text parameter.

Field value#

silk
pub value: String

Boolean#

silk
Boolean

A boolean parameter.

Field value#

silk
pub value: bool

Integer#

silk
Integer

An exact decimal integer; its declared type supplies width and signedness.

Field decimal#

silk
pub decimal: String

Enum#

silk
Enum

A member of a named enum.

Field nominal#

silk
pub nominal: String

Field member#

silk
pub member: String

None#

silk
None

An absent optional value.

Some#

silk
Some

A present optional value.

Field value#

silk
pub value: Box<ParameterValue>

Sequence#

silk
Sequence

An ordered sequence of parameter values.

Field values#

silk
pub values: List<ParameterValue>

Record#

silk
Record

A record's named parameter values.

Field fields#

silk
pub fields: List<ParameterField>

Implementation Schema for ParameterValue#

silk
impl Schema for ParameterValue

Operation spec#

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

ParameterField#

silk
pub struct ParameterField

One named field of a structured parameter.

Field name#

silk
pub name: String

The declared field name.

Field value#

silk
pub value: ParameterValue

The field value.

Implementation Schema for ParameterField#

silk
impl Schema for ParameterField

Operation spec#

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

Module#

silk
pub struct Module

A generated module whose source is stored at an explicit path.

Field name#

silk
pub name: String

The canonical module path inside its package.

Field source#

silk
pub source: String

The absolute path of its generated source.

Field producer#

silk
pub producer: Option<String>

The step key that produces the file, for editor diagnostics.

Implementation Schema for Module#

silk
impl Schema for Module

Operation spec#

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

Operation check#

silk
fn check(self: &Self, checks: &mut Checks<Self>) -> ()

Selector#

silk
pub struct Selector

A declaration rooted by the runtime composition.

Field package#

silk
pub package: String

The defining package identity, or silk for the standard library.

Field module#

silk
pub module: String

The canonical module path.

Field declaration#

silk
pub declaration: String

The declaration name.

Implementation Schema for Selector#

silk
impl Schema for Selector

Operation spec#

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

Composition#

silk
pub struct Composition

The resolved runtime composition and exported support modules.

Field runtime#

silk
pub runtime: Option<ModuleRef>

The selected startup module, absent for artifacts without a runtime.

Field support#

silk
pub support: List<Support>

The target support modules rooted by this compilation.

Field retention#

silk
pub retention: List<Selector>

Declarations retained regardless of import reachability.

Field storage#

silk
pub storage: Option<Storage>

The execution-storage operations selected by the runtime.

Implementation Schema for Composition#

silk
impl Schema for Composition

Operation spec#

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

ModuleRef#

silk
pub struct ModuleRef

A module identified without a filesystem path.

Field package#

silk
pub package: String

The package identity.

Field module#

silk
pub module: String

The canonical module path.

Implementation Schema for ModuleRef#

silk
impl Schema for ModuleRef

Operation spec#

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

Support#

silk
pub struct Support

A target support module and its export policy.

Field module#

silk
pub module: ModuleRef

The support module.

Field hosted#

silk
pub hosted: bool

Whether its C exports are also host exports.

Implementation Schema for Support#

silk
impl Schema for Support

Operation spec#

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

Storage#

silk
pub struct Storage

The four runtime execution-storage bindings.

Field create#

silk
pub create: Selector

The declaration that implements create.

Field acquire#

silk
pub acquire: Selector

The declaration that implements acquire.

Field release#

silk
pub release: Selector

The declaration that implements release.

Field destroy#

silk
pub destroy: Selector

The declaration that implements destroy.

Implementation Schema for Storage#

silk
impl Schema for Storage

Operation spec#

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

Native#

silk
pub struct Native

Ordered native compilation and link inputs.

Field sources#

silk
pub sources: List<NativeSource>

Native translation units and their compiler arguments.

silk
pub link: List<LinkInput>

Inputs in linker order.

Field functionOrder#

silk
pub functionOrder: Option<String>

The absolute path of a function-order file.

Implementation Schema for Native#

silk
impl Schema for Native

Operation spec#

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

NativeSource#

silk
pub struct NativeSource

One native translation unit with explicit flags and include paths.

Field path#

silk
pub path: String

The absolute path of the source file.

Field language#

silk
pub language: String

The source language: c, cpp, objc, or objcpp.

Field flags#

silk
pub flags: List<String>

The compiler flags, in argument order.

Field include#

silk
pub include: List<String>

Absolute include directory paths.

Implementation Schema for NativeSource#

silk
impl Schema for NativeSource

Operation spec#

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

LinkInput#

silk
pub struct LinkInput

One ordered native linker input.

Field kind#

silk
pub kind: String

The input kind: object, archive, library, framework, search-path, framework-search-path, rpath, or linker-script.

Field value#

silk
pub value: String

The library or framework name, or an absolute path for a file or directory input.

Field mode#

silk
pub mode: Option<String>

The library search mode, static or dynamic.

Field weak#

silk
pub weak: bool

Whether the platform may leave this library or framework absent.

Field needed#

silk
pub needed: bool

Whether to retain the library even when no symbol references it.

Implementation Schema for LinkInput#

silk
impl Schema for LinkInput

Operation spec#

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

Operation check#

silk
fn check(self: &Self, checks: &mut Checks<Self>) -> ()

Platform#

silk
pub struct Platform

An explicit platform toolchain supply.

Field sysroot#

silk
pub sysroot: String

The absolute sysroot directory.

Field linker#

silk
pub linker: String

The absolute linker executable path.

Field support#

silk
pub support: List<Installation>

Compiler-support installations, each selected by its canonical target triple.

Implementation Schema for Platform#

silk
impl Schema for Platform

Operation spec#

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

Installation#

silk
pub struct Installation

An installed compiler-support directory for one target.

Field target#

silk
pub target: String

The canonical target triple served by the installation.

Field root#

silk
pub root: String

The absolute installation directory.

Implementation Schema for Installation#

silk
impl Schema for Installation

Operation spec#

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

Windows#

silk
pub struct Windows

Windows executable and resource settings.

Field subsystem#

silk
pub subsystem: Option<String>

The subsystem, console or windows.

Field manifest#

silk
pub manifest: Option<String>

The absolute path of the Windows application manifest.

Field resources#

silk
pub resources: List<String>

The absolute paths of resource files.

Implementation Schema for Windows#

silk
impl Schema for Windows

Operation spec#

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

MacOS#

silk
pub struct MacOS

macOS signing and dynamic-library settings.

Field entitlements#

silk
pub entitlements: Option<String>

The absolute path of the signing entitlements.

Field installName#

silk
pub installName: Option<String>

The dynamic-library install name.

Implementation Schema for MacOS#

silk
impl Schema for MacOS

Operation spec#

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

Wasm#

silk
pub struct Wasm

WebAssembly memory, table, and execution settings.

Field importMemory#

silk
pub importMemory: bool

Whether memory is supplied by the host.

Field sharedMemory#

silk
pub sharedMemory: bool

Whether the linear memory is shared.

Field exportTable#

silk
pub exportTable: bool

Whether to export the function table.

Field executionModel#

silk
pub executionModel: String

The WASI execution model, command or reactor.

Field wit#

silk
pub wit: Option<String>

The absolute WIT directory for a component build.

Field world#

silk
pub world: Option<String>

The WIT world name for a component build.

Implementation Schema for Wasm#

silk
impl Schema for Wasm

Operation spec#

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

Runner#

silk
pub struct Runner

A command used to launch a foreign artifact.

Field program#

silk
pub program: String

The runner executable name or absolute path.

Field arguments#

silk
pub arguments: List<String>

Arguments placed before the artifact path.

Implementation Schema for Runner#

silk
impl Schema for Runner

Operation spec#

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

Implementation Request#

silk
impl Request

Method fileName#

silk
pub effect fn fileName(self: &Self) -> String
    ! OutOfMemoryError
    ? &mut Allocator

Returns the stable publication filename for this artifact, target, and optimization mode.

Associated function requestFileName#

silk
pub effect fn requestFileName(name: string, target: string, optimization: string) -> String
    ! OutOfMemoryError
    ? &mut Allocator

Names a published request using its compilation name, canonical target, and optimization.

artifactName#

silk
pub effect fn artifactName(name: string, artifact: string, emit: string, target: string) -> String
  ! OutOfMemoryError
  ? &mut Allocator

Returns the artifact filename selected by the resolved request.

RequestSet#

silk
pub struct RequestSet

The complete request set most recently published by Build.write or the built-in plan command. Readers select only these files when this index exists; other commands may publish additional requests.

Field version#

silk
pub version: u32

The request-set format version, currently 1.

Field files#

silk
pub files: List<String>

Request filenames relative to the directory holding plan.json.

Implementation Schema for RequestSet#

silk
impl Schema for RequestSet

Operation spec#

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

Operation check#

silk
fn check(self: &Self, checks: &mut Checks<Self>) -> ()

Category: Core.

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