Axle v0.13.3

The manifest reference

axle.toml sits at a project’s root. Every table is optional except [package], and an absent key falls back to a default rather than an error. Projects and dependencies is the guided version; this page is the lookup table.

[package]
name = "smalt"
version = "0.1.0"
targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"]

[workspace]
members = ["app", "core"]

[dependencies]
mathx = { path = "../mathx", features = ["wayland"] }

[features]
wayland = false

[port.win32]
when = { os = "windows" }
dirs = ["win32"]

[link]
libs  = ["SDL2"]
paths = ["C:/SDL2/lib"]

[fmt]
max_line_width = 100

[package]

KeyTypeDefaultMeaning
namestringrequiredthe package name, and the artefact’s name in target/
versionstring""free-form; nothing derives from it yet
kind"bin" or "lib"inferredwhat the crate builds to
entrypath, relative to the projectinferredthe crate’s entry source
targetslist of triples[]the targets this project promises to serve

kind and entry are inferred from the source layout when omitted:

Layoutkindentry
src/main.axle presentbinsrc/main.axle
only src/lib.axlelibsrc/lib.axle

If both files exist, the crate is a bin. A lib exports pub items for dependents to import and is never a build’s entry point.

targets is a promise, not a build setting: listing a triple is what makes the port checks enforce it. List none and you have promised nothing, which is what lets a port be written one module at a time. A triple the compiler does not recognise is refused rather than skipped.

[workspace]

KeyTypeDefaultMeaning
memberslist of directories[]crates compiled alongside this one

A manifest carrying [workspace] is both a crate and the root of a workspace: members are extra graph roots, compiled whether or not the root depends on them. Cross-crate use edges still come from each crate’s own [dependencies][workspace] members decides what is built, never what is visible.

[dependencies]

[dependencies]
mathx = { path = "../mathx", features = ["wayland"] }
KeyTypeDefaultMeaning
pathpath, relative to this manifestrequiredthe dependency’s directory
featureslist of names[]features to turn on in that dependency

Only path dependencies exist: no registry, no git source, no lockfile.

features only ever enables. That is what makes the request safe to union — two crates asking for different features of one library both get theirs, in any order, and neither takes anything away from the other. A feature the dependency defaults to on is that crate’s own decision about itself.

[features]

[features]
wayland = false

A name and its default state. Two things turn a feature on: the default here, or a request — --features from the command line for the root crate, a [dependencies] edge for everything else. Nothing turns one off. A name a [port]’s when asks for but this table never declared is refused: it could never be on, so the port could never apply.

--features reaches the root crate and stops there, because two crates may spell the same name while meaning different things.

[port.<name>]

A port is one backend of a piece of code: a condition, and the directories that carry it. Nothing is reserved — a crate with no [port] table has no port directories, so a probes/linux/ is an ordinary directory.

KeyTypeDefaultMeaning
whentable{} (applies everywhere)the condition under which this port is the active one
dirslist of directory namesrequired, non-emptythis port’s code, at any depth under src/

A port with no directory is refused: nothing could ever select it.

The when axes

AxisValues
oswindows, linux, macos
archx86_64, aarch64
featureany name declared in [features]

Every axis takes one value or a list:

when = { os = "linux" }
when = { os = ["linux", "macos"] }
when = { os = "linux", feature = "wayland" }

Several axes in one when must all hold. A value no axis has is refused with the list of valid ones, and a feature no [features] table declares is refused too — the alternative is a port that is silently never active.

{ os = "linux", feature = "wayland" } is narrower than { os = "linux" }, so it wins when the feature is on and the plain Linux port serves when it is off. Exactly one port is active for any target: a target left uncovered, or two ports applying with neither narrower, is refused rather than resolved by declaration order.

KeyTypeDefaultMeaning
libslist of names[]native libraries to link
pathslist of directories[]where to find them

On Windows these become /DEFAULTLIB:<name>.lib and /LIBPATH:<dir>; on Unix, -l<name> and -L<dir>. The flags patch the same list ad hoc: axle build --link-lib SDL2 --lib-path C:/SDL2/lib.

[fmt]

Overrides for axle fmt and the language server’s formatter. Every key is optional; an absent one uses the formatter’s default.

KeyTypeMeaning
max_line_widthintegerwidth before a breakable construct wraps
indent_widthintegercolumns of indentation per nesting level
use_tabsboolindent with hard tabs instead of spaces
brace_on_same_lineboolkeep { on the construct’s line, or move it down
trailing_commabooltrailing comma on a broken brace-delimited list
max_blank_linesintegerblank lines preserved between items
single_line_if_max_widthintegercolumn ceiling under which a single-statement if with no else stays on one line; 0 disables the rule

A key the parser does not know

Unrecognised keys are ignored, not reported, so a misspelled one is a setting that silently does nothing. When a table seems to have no effect, check the spelling first.

See also

manifestaxle-tomlreferenceprojectsports