silk.build.compilation.
Compilations as build steps that write explicit requests before invoking the compiler.
Import as Compilation with import silk.build.compilation { Compilation }.
Public declarations: 2.
Compilation#
pub struct CompilationA compilation whose settings freeze when its artifact is first used by the graph.
Implementation Compilation#
impl CompilationMethod when#
pub effect fn when<'env, E, ? R>(
self: Self,
condition: bool,
transform: once effect fn<'env>(Self) -> Self ! E ? R,
) -> Self
! E
? RApplies transform when condition is true, returning the original value otherwise.
Associated function fromDefinition#
pub effect fn fromDefinition(definition: Definition, compiler: Deferred<Path>) -> Self
! StepFailure
? &mut Allocator | &mut FileSystemCreates a compilation from an explicit package definition and compiler. Resolution runs as a graph prerequisite.
Associated function fromPackage#
pub effect fn fromPackage(options: &Options) -> Self
! StepFailure
? &mut Allocator | &mut FileSystem | &mut HostInputUses the current package's default root and artifact with the command's options. A compilation selects at most one target. Commands building several targets create one compilation per target and add them to a Build.
Associated function executable#
pub effect fn executable(name: string, root: string) -> Self
! StepFailure
? &mut Allocator | &mut FileSystem | &mut HostInputCreates a program named name with root resolved against the package directory.
Associated function loadableModule#
pub effect fn loadableModule(name: string, root: string) -> Self
! StepFailure
? &mut Allocator | &mut FileSystem | &mut HostInputCreates a loadable module named name with root resolved against the package directory.
Associated function staticArchive#
pub effect fn staticArchive(name: string, root: string) -> Self
! StepFailure
? &mut Allocator | &mut FileSystem | &mut HostInputCreates a static archive named name with root resolved against the package directory.
Associated function object#
pub effect fn object(name: string, root: string) -> Self
! StepFailure
? &mut Allocator | &mut FileSystem | &mut HostInputCreates a relocatable object named name with root resolved against the package directory.
Associated function test#
pub effect fn test(name: string, root: string) -> Self
! StepFailure
? &mut Allocator | &mut FileSystem | &mut HostInputCreates a test runner named name with root resolved against the package directory.
Method package#
pub effect fn package(self: Self, alias: string, settings: Package) -> Self
! StepFailure
? &mut AllocatorConfigures one declared dependency alias, or self for this package.
Method without#
pub effect fn without(self: Self, alias: string) -> Self
! StepFailure
? &mut AllocatorRemoves a declared dependency from this compilation's available imports.
Method target#
pub effect fn target(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorSets target from a declared deferred value.
Method cpu#
pub effect fn cpu(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorSets cpu from a declared deferred value.
Method deployment#
pub effect fn deployment(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorSets deployment from a declared deferred value.
Method libc#
pub effect fn libc(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorSets libc from a declared deferred value.
Method entry#
pub effect fn entry(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorSets entry from a declared deferred value.
Method runtime#
pub effect fn runtime(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorSets runtime from a declared deferred value.
Method link#
pub effect fn link(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorSets link from a declared deferred value.
Method codeModel#
pub effect fn codeModel(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorSets codeModel from a declared deferred value.
Method relocation#
pub effect fn relocation(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorSets relocation from a declared deferred value.
Method safety#
pub effect fn safety(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorSets safety from a declared deferred value.
Method threading#
pub effect fn threading(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorSets threading from a declared deferred value.
Method unwind#
pub effect fn unwind(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorSets unwind from a declared deferred value.
Method backend#
pub effect fn backend(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorSets backend from a declared deferred value.
Method codegenUnits#
pub effect fn codegenUnits(self: Self, value: Deferred<u64>) -> Self
! StepFailure
? &mut AllocatorSets codegenUnits from a declared deferred value.
Method maxMemory#
pub effect fn maxMemory(self: Self, value: Deferred<u64>) -> Self
! StepFailure
? &mut AllocatorSets maxMemory from a declared deferred value.
Method stackSize#
pub effect fn stackSize(self: Self, value: Deferred<u64>) -> Self
! StepFailure
? &mut AllocatorSets stackSize from a declared deferred value.
Method cpuFeatures#
pub effect fn cpuFeatures(self: Self, value: Deferred<List<String>>) -> Self
! StepFailure
? &mut AllocatorSets cpuFeatures from a declared deferred value.
Method sanitizers#
pub effect fn sanitizers(self: Self, value: Deferred<List<String>>) -> Self
! StepFailure
? &mut AllocatorSets sanitizers from a declared deferred value.
Method optimize#
pub effect fn optimize(self: Self, value: Deferred<Optimize>) -> Self
! StepFailure
? &mut AllocatorSets optimize from a declared deferred value.
Method debug#
pub effect fn debug(self: Self, value: Deferred<bool>) -> Self
! StepFailure
? &mut AllocatorSets debug from a declared deferred value.
Method runner#
pub effect fn runner(self: Self, value: Deferred<Runner>) -> Self
! StepFailure
? &mut AllocatorSelects the program and arguments used to launch this artifact or its tests.
WASI artifacts use wasmtime run when no runner is supplied.
Method standardLibrary#
pub effect fn standardLibrary(self: Self, path: Deferred<Path>) -> Self
! StepFailure
? &mut AllocatorSelects a declared standard-library directory before resolution.
Method platform#
pub effect fn platform(self: Self, value: Deferred<Platform>) -> Self
! StepFailure
? &mut AllocatorSelects the target sysroot, linker, and support installations.
Method windows#
pub effect fn windows(self: Self, value: Deferred<Windows>) -> Self
! StepFailure
? &mut AllocatorSelects Windows subsystem, resource, and manifest settings.
Method macos#
pub effect fn macos(self: Self, value: Deferred<MacOS>) -> Self
! StepFailure
? &mut AllocatorSelects macOS installation, framework, and signing settings.
Method wasm#
pub effect fn wasm(self: Self, value: Deferred<Wasm>) -> Self
! StepFailure
? &mut AllocatorSelects WebAssembly memory, execution, and component settings.
Method header#
pub effect fn header(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorRequests a C header at an absolute output path.
Method importLibrary#
pub effect fn importLibrary(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorRequests an import library at an absolute output path.
Method emit#
pub effect fn emit(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorSets emit from a declared deferred value.
Method root#
pub effect fn root(self: Self, path: Deferred<Path>) -> Self
! StepFailure
? &mut AllocatorSelects a deferred source file as the compilation's root module.
Method moduleFile#
pub effect fn moduleFile(self: Self, name: string, path: Deferred<Path>) -> Self
! StepFailure
? &mut AllocatorAdds a generated module file to the root package.
Method module#
pub effect fn module(self: Self, name: string, text: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorWrites deferred source text as a generated module before compiling its consumer.
Method embed#
pub effect fn embed(self: Self, name: string, path: Deferred<Path>) -> Self
! StepFailure
? &mut AllocatorEmbeds a file or another compilation's artifact in a generated module named name.
Import that module's data constant to read its bytes; the producer runs before compilation.
Method compileC#
pub effect fn compileC(
self: Self,
path: Deferred<Path>,
flags: Deferred<List<String>>,
include: List<Deferred<Path>>,
) -> Self
! StepFailure
? &mut AllocatorCompiles a deferred c source with declared flags and include directory trees.
Method compileCpp#
pub effect fn compileCpp(
self: Self,
path: Deferred<Path>,
flags: Deferred<List<String>>,
include: List<Deferred<Path>>,
) -> Self
! StepFailure
? &mut AllocatorCompiles a deferred cpp source with declared flags and include directory trees.
Method compileObjectiveC#
pub effect fn compileObjectiveC(
self: Self,
path: Deferred<Path>,
flags: Deferred<List<String>>,
include: List<Deferred<Path>>,
) -> Self
! StepFailure
? &mut AllocatorCompiles a deferred objc source with declared flags and include directory trees.
Method compileObjectiveCpp#
pub effect fn compileObjectiveCpp(
self: Self,
path: Deferred<Path>,
flags: Deferred<List<String>>,
include: List<Deferred<Path>>,
) -> Self
! StepFailure
? &mut AllocatorCompiles a deferred objcpp source with declared flags and include directory trees.
Method linkArchive#
pub effect fn linkArchive(self: Self, path: Deferred<Path>) -> Self
! StepFailure
? &mut AllocatorAdds a deferred archive input, including its contents in the key.
Method linkObject#
pub effect fn linkObject(self: Self, path: Deferred<Path>) -> Self
! StepFailure
? &mut AllocatorAdds a deferred object input, including its contents in the key.
Method searchPath#
pub effect fn searchPath(self: Self, path: Deferred<Path>) -> Self
! StepFailure
? &mut AllocatorAdds a deferred search-path input, including its contents in the key.
Method frameworkSearchPath#
pub effect fn frameworkSearchPath(self: Self, path: Deferred<Path>) -> Self
! StepFailure
? &mut AllocatorAdds a deferred framework-search-path input, including its contents in the key.
Method linkerScript#
pub effect fn linkerScript(self: Self, path: Deferred<Path>) -> Self
! StepFailure
? &mut AllocatorAdds a deferred linker-script input, including its contents in the key.
Method functionOrder#
pub effect fn functionOrder(self: Self, path: Deferred<Path>) -> Self
! StepFailure
? &mut AllocatorSelects a deferred function-order file, including its contents in the key.
Method linkLibrary#
pub effect fn linkLibrary(self: Self, name: Deferred<String>, library: Library) -> Self
! StepFailure
? &mut AllocatorLinks a deferred library name as library describes, for example Library.dynamicSearch().
Method linkFramework#
pub effect fn linkFramework(self: Self, name: Deferred<String>, framework: Framework) -> Self
! StepFailure
? &mut AllocatorLinks a deferred macOS framework name as framework describes, for example Framework.make().
Method rpath#
pub effect fn rpath(self: Self, value: Deferred<String>) -> Self
! StepFailure
? &mut AllocatorAdds a deferred runtime library search path, preserving loader-relative tokens.
Method linkArtifact#
pub effect fn linkArtifact(self: Self, artifact: Deferred<Path>) -> Self
! StepFailure
? &mut AllocatorLinks another compilation's deferred artifact and schedules its producer first.
Method build#
pub effect fn build(self: Self) -> Built
! BuildError
? &mut Allocator | &mut FileSystem | &mut HostInputExecutes this compilation through the build runner, publishing its request and artifact.
Method memoryBudget#
pub effect fn memoryBudget(self: Self, bytes: u64) -> Self
! StepFailure
? &mut AllocatorSets the runner's peak-memory estimate for this compiler process; the default is 3 GiB.
Method unsandboxedTools#
pub effect fn unsandboxedTools(self: Self, allowed: bool) -> Self
! StepFailure
? &mut AllocatorAuthorizes package tools to run without a sandbox for this graph execution. This setting is not serialized into compilation definitions or requests.
Method step#
pub effect fn step(self: &Self) -> StepHandle
! StepFailure
? &mut AllocatorRegisters the compilation once, freezing its settings. The step holds the compilation's description, which the compiler restores and runs.
Method artifact#
pub effect fn artifact(self: &Self) -> Deferred<Path>
! StepFailure
? &mut AllocatorReturns the artifact's deferred path; consuming it adds this compilation as a dependency.
Method emittedHeader#
pub effect fn emittedHeader(self: &Self) -> Deferred<Path>
! StepFailure
? &mut AllocatorReturns the generated C header as a deferred input. Configure header before using it.
Consuming the path runs this compilation and rejects a missing header output.
Method emittedImportLibrary#
pub effect fn emittedImportLibrary(self: &Self) -> Deferred<Path>
! StepFailure
? &mut AllocatorReturns the Windows import library as a deferred input. Configure importLibrary first.
Consuming the path runs this compilation and rejects a missing import-library output.
restore#
pub effect fn restore(step: &[u8]) -> StepHandle
! StepFailure
? &mut Allocator | &mut FileSystemRestores a described compilation as the steps this process can run: one resolves its request and one compiles it. Answers the compiling step.
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.