silk.build.plan.
Pure package requirements built with the same standard actions and deferred paths as tasks.
A package declares pub const PLAN: Plan in build.silk. The compiler evaluates the value
without effects. Generated files and processes execute later through the build graph; package
processes require dependency authorization and a supported operating-system sandbox.
Import as Plan with import silk.build.plan { Plan }.
Public declarations: 4.
Operation#
pub union OperationOne static package requirement, interpreted after its deferred producers complete.
Module#
ModuleA generated Silk module, named relative to the package's source root.
Field name#
pub name: string<'static>Field source#
pub source: InputCompile#
CompileA native source file in the indicated language.
Field language#
pub language: string<'static>Field source#
pub source: InputField flags#
pub flags: &'static [string<'static>]Field include#
pub include: Option<&'static Chain<Input>>Field pattern#
pub pattern: Option<string<'static>>Flag#
FlagA native compiler flag, applied to the package's translation units in order.
Field value#
pub value: string<'static>Include#
IncludeAn include directory shared by the package's native translation units.
Field path#
pub path: InputLinkFile#
LinkFileA linker file or search directory.
Field kind#
pub kind: string<'static>Field path#
pub path: InputLink#
LinkA named library or framework.
Field kind#
pub kind: string<'static>Field name#
pub name: string<'static>Field mode#
pub mode: string<'static>Field weak#
pub weak: boolField needed#
pub needed: boolRPath#
RPathA runtime library search path.
Field value#
pub value: string<'static>FunctionOrder#
FunctionOrderThe package's native symbol order file.
Field path#
pub path: InputLinkDependency#
LinkDependencyA declared dependency whose native plan links into this package's artifacts.
Field name#
pub name: string<'static>Library#
pub struct LibraryHow a named library is linked: by static or dynamic search, and whether it is weak or retained.
When to use#
Pass it to Plan.linkLibrary or Compilation.linkLibrary. Start from Library.dynamicSearch or
Library.staticSearch and add Library.weak or Library.needed only where the link needs them.
Field mode#
pub mode: string<'static>"dynamic" or "static".
Field isWeak#
pub isWeak: boolWhether the program may start when the library is absent.
Field isNeeded#
pub isNeeded: boolWhether the library stays linked when no symbol refers to it.
Implementation Library#
impl LibraryAssociated function dynamicSearch#
pub fn dynamicSearch() -> LibraryA library found by dynamic search, strong and dropped when unused.
Associated function staticSearch#
pub fn staticSearch() -> LibraryA library found by static search, strong and dropped when unused.
Method weak#
pub fn weak(self: Self) -> LibraryReturns this library linked weakly, so the program may start when it is absent.
Method needed#
pub fn needed(self: Self) -> LibraryReturns this library retained even when no symbol refers to it.
Framework#
pub struct FrameworkHow a named macOS framework is linked: whether it is weak or retained.
When to use#
Pass it to Plan.linkFramework or Compilation.linkFramework. Start from Framework.make
and add Framework.weak or Framework.needed only where the link needs them.
Field isWeak#
pub isWeak: boolWhether the program may start when the framework is absent.
Field isNeeded#
pub isNeeded: boolWhether the framework stays linked when no symbol refers to it.
Implementation Framework#
impl FrameworkAssociated function make#
pub fn make() -> FrameworkA framework linked strongly and dropped when unused.
Method weak#
pub fn weak(self: Self) -> FrameworkReturns this framework linked weakly, so the program may start when it is absent.
Method needed#
pub fn needed(self: Self) -> FrameworkReturns this framework retained even when no symbol refers to it.
Plan#
pub struct PlanThe immutable requirements contributed by a package wherever it is used.
Field steps#
pub steps: Option<&'static Chain<Operation>>Requirements in reverse insertion order; producers are retained by their deferred inputs.
Implementation Plan#
impl PlanMethod when#
pub static fn when(self: Self, condition: bool, transform: fn(Self) -> Self) -> SelfApplies transform when condition is true, returning this plan without calling it otherwise.
Associated function archivePath#
pub static fn archivePath(name: string<'static>, path: string<'static>) -> Deferred<Path>Names a file or directory in this package's manifest-pinned native archive. The package plan resolves the target variant and root or machine override before running steps.
Associated function empty#
pub static fn empty() -> SelfStarts a package plan without requirements.
Method module#
pub static fn module(self: Self, name: string<'static>, source: Deferred<Path>) -> SelfAdds the file produced by a standard step as a generated Silk module.
Method compileC#
pub static fn compileC(self: Self, source: Deferred<Path>) -> SelfCompiles a deferred C file into the package's native inputs.
Method compileCpp#
pub static fn compileCpp(self: Self, source: Deferred<Path>) -> SelfCompiles a deferred C++ file into the package's native inputs.
Method compileObjectiveC#
pub static fn compileObjectiveC(self: Self, source: Deferred<Path>) -> SelfCompiles a deferred Objective-C file into the package's native inputs.
Method compileObjectiveCpp#
pub static fn compileObjectiveCpp(self: Self, source: Deferred<Path>) -> SelfCompiles a deferred Objective-C++ file into the package's native inputs.
Method compileNative#
pub static fn compileNative(
self: Self,
language: string<'static>,
source: Deferred<Path>,
flags: &'static [string<'static>],
include: &'static [Deferred<Path>],
) -> SelfCompiles one translation unit with flags and include directories applying only to that file.
language is c, cpp, objc, or objcpp. Package-wide flags and includes are also applied.
Method compileSources#
pub static fn compileSources(
self: Self,
language: string<'static>,
directory: Deferred<Path>,
pattern: string<'static>,
flags: &'static [string<'static>],
include: &'static [Deferred<Path>],
) -> SelfCompiles matching files from a declared directory with flags and include paths for those files. Resolution expands the glob after any producer or pinned archive has supplied the directory.
Method cFlag#
pub static fn cFlag(self: Self, value: string<'static>) -> SelfAdds one allowed native compiler flag to this package's translation units.
Method includePath#
pub static fn includePath(self: Self, path: Deferred<Path>) -> SelfAdds an include directory to this package's native translation units.
Method linkArchive#
pub static fn linkArchive(self: Self, path: Deferred<Path>) -> SelfLinks a deferred static archive.
Method linkObject#
pub static fn linkObject(self: Self, path: Deferred<Path>) -> SelfLinks a deferred object file.
Method searchPath#
pub static fn searchPath(self: Self, path: Deferred<Path>) -> SelfAdds a deferred library search directory.
Method frameworkSearchPath#
pub static fn frameworkSearchPath(self: Self, path: Deferred<Path>) -> SelfAdds a deferred framework search directory.
Method linkerScript#
pub static fn linkerScript(self: Self, path: Deferred<Path>) -> SelfSupplies a deferred native linker script.
Method linkLibrary#
pub static fn linkLibrary(self: Self, name: string<'static>, library: Library) -> SelfLinks a named library as library describes, for example Library.dynamicSearch().
Method linkDependency#
pub static fn linkDependency(self: Self, name: string<'static>) -> SelfLinks the native plan of name, a dependency this package declares, into every artifact that
links this package, even when nothing imports it: for a package of only C, whose functions
this package declares itself. A name the manifest does not declare refuses the plan.
Method linkFramework#
pub static fn linkFramework(self: Self, name: string<'static>, framework: Framework) -> SelfLinks a named macOS framework as framework describes, for example Framework.make().
Method rpath#
pub static fn rpath(self: Self, value: string<'static>) -> SelfAdds a runtime library search path.
Method functionOrder#
pub static fn functionOrder(self: Self, path: Deferred<Path>) -> SelfSelects a deferred native symbol-order file.
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.