Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

A. Command-Line Reference

Everything here is what buildl --help and each command's --help print in this version. Run buildl from the workspace root, the folder holding buildl.toml, or from any folder below it.

$ buildl --help
A sandboxed, deterministic build system

Usage: buildl [OPTIONS] <COMMAND>
CommandWhat it does
checkEvaluate every build file twice and run nothing
graphPrint the target graph
queryAsk what a target needs, or what needs it
planSay what a build would run, and why
buildBuild targets and what they need
watchBuild targets, then build again when a file they read changes
testRun test targets and what they need
verifyRe-run cached actions and name those whose outputs differ
doctorPrint the workspace's ceiling, approver, run settings and what its build wants
logShow what a target printed when it last ran
cleanRemove the output directory
gcDrop rows of targets no longer declared and remove what nothing needs
pluginsWork with the plugins buildl.toml names

buildl help prints the same list, and buildl help <COMMAND> the help of one command.

Options every command takes

These three are accepted before the command and after it, by every command and subcommand.

FlagWhat it does
--color <WHEN>When to colour what is printed: auto (the default) colours when standard error is a terminal and NO_COLOR is unset, always always does, never never does
-h, --helpPrint help; -h prints a shorter summary
-V, --versionPrint the version, such as buildl 0.3.1

Naming targets

Every command that takes a target accepts it in three forms:

FormMeans
//dir:namethe target name declared in the build file of dir
:namethe target name declared in the build file of the folder you are in
namethe same as :name

buildl check

buildl check [OPTIONS]

Evaluates every build file twice and runs nothing. Two evaluations that declare different targets mean a build file is not deterministic, and check says so. No flags of its own.

buildl graph

buildl graph [OPTIONS]

Prints the target graph.

FlagWhat it does
--jsonPrint the graph as canonical JSON, the bytes of .buildl/graph.json (the default)
--dotPrint the graph in Graphviz DOT

buildl query

buildl query [OPTIONS] <EXPR>
ArgumentMeans
<EXPR>deps(TARGET) for what TARGET needs, or rdeps(TARGET) for what needs it
FlagWhat it does
--jsonPrint the answer as canonical JSON

buildl plan

buildl plan [OPTIONS] [TARGET]...

Says what a build would run, and why, without running it. With no target, it plans every target but tests.

FlagWhat it does
--set <NAME=VALUE>Give a build setting a value for this run; may be repeated
--jsonPrint the plan as canonical JSON

buildl build

buildl build [OPTIONS] [TARGET]...

Builds targets and what they need. With no target, it builds every target but tests.

FlagWhat it does
--set <NAME=VALUE>Give a build setting a value for this run; may be repeated
-k, --keep-goingAfter a failure, still build everything that does not depend on it
--streamShow one running action's output as it is printed
--remote-uploadUpload what this run produced to the remote cache
--remote-strictFail the run when a call to the remote cache fails, instead of warning and building locally
--no-remoteDo not use the remote cache in this run, and run nothing on the remote, whatever the manifest and variables say
--remote-executeRun the actions the remote cache has no result for on the remote, whatever the manifest and variables say
--no-remote-executeRun every action here, and keep using the remote cache, whatever the manifest and variables say
--remote-jobs <N>How many actions may be with the remote at once, from 1 to 1024, for this run

The six remote flags are refused, with exit code 2, when they contradict each other or the workspace:

RefusedWhy
--no-remote with --remote-upload, --remote-strict, --remote-execute or --remote-jobsthe run uses no remote
--remote-execute with --no-remote-executethey say opposite things
--remote-upload, --remote-strict, --remote-execute, --no-remote-execute or --remote-jobs in a workspace with no [remote] tablethere is no remote to use
--remote-jobs in a run where remote execution is offthere is nothing to count
--remote-upload or --remote-execute under strategy = "bare"a result from an unconfined action is not shared

buildl watch

buildl watch [OPTIONS] [TARGET]...

Builds the targets, then builds them again whenever a file the build reads changes, or the build files declare a different graph. It takes exactly the flags of build:

FlagWhat it does
--set <NAME=VALUE>Give a build setting a value for this run; may be repeated
-k, --keep-goingAfter a failure, still build everything that does not depend on it
--streamShow one running action's output as it is printed
--remote-uploadUpload what this run produced to the remote cache
--remote-strictFail the run when a call to the remote cache fails, instead of warning and building locally
--no-remoteDo not use the remote cache in this run, and run nothing on the remote, whatever the manifest and variables say
--remote-executeRun the actions the remote cache has no result for on the remote, whatever the manifest and variables say
--no-remote-executeRun every action here, and keep using the remote cache, whatever the manifest and variables say
--remote-jobs <N>How many actions may be with the remote at once, from 1 to 1024, for this run

Changes under the output directory, under .buildl and under .git are ignored, and so are changes to paths a .buildlignore ignores. watch runs until Ctrl-C, a usage error (exit code 2) or a failure of the file watcher (exit code 3).

buildl test

buildl test [OPTIONS] [TARGET]...

Runs test targets and what they need. With no target, it runs every test.

FlagWhat it does
--set <NAME=VALUE>Give a build setting a value for this run; may be repeated
--stopStart nothing new after the first failure
--streamShow one running action's output as it is printed
--rerunRun the selected tests even when nothing they depend on changed
--verboseShow what every test printed, not only what a failing one did
--remote-uploadUpload what this run produced to the remote cache
--remote-strictFail the run when a call to the remote cache fails, instead of warning and building locally
--no-remoteDo not use the remote cache in this run, and run nothing on the remote, whatever the manifest and variables say
--remote-executeRun the actions the remote cache has no result for on the remote, whatever the manifest and variables say
--no-remote-executeRun every action here, and keep using the remote cache, whatever the manifest and variables say
--remote-jobs <N>How many actions may be with the remote at once, from 1 to 1024, for this run

The remote flags are refused in the same cases as for build.

buildl verify

buildl verify [OPTIONS] [TARGET]...

Runs cached actions again in the input sandbox and names those whose outputs differ from the cache. It records nothing. With no target, it takes every target but tests. Under strategy = "bare" it is refused.

FlagWhat it does
--set <NAME=VALUE>Give a build setting a value for this run; may be repeated
--sample <N>Re-run only the N cached actions whose keys sort lowest: the same ones while their keys stay the same

buildl doctor

buildl doctor [OPTIONS]

Prints the workspace's ceiling, its approver, its run settings, its remote settings and everything its build wants. It refuses nothing and connects to nothing. No flags of its own.

buildl log

buildl log [OPTIONS] <TARGET>

Shows what a target printed when it last ran.

ArgumentMeans
<TARGET>The target, as //dir:name, :name or name
FlagWhat it does
--stdoutPrint only what the run wrote to standard output
--stderrPrint only what the run wrote to standard error, on standard output

buildl clean

buildl clean [OPTIONS]

Removes the output directory, out unless buildl.toml names another. The cache in .buildl is kept. No flags of its own.

buildl gc

buildl gc [OPTIONS]

Drops the cache rows of targets no longer declared, and removes from the store what nothing needs. No flags of its own.

buildl plugins

buildl plugins [OPTIONS] <COMMAND>

Works with the plugins buildl.toml names. It has one subcommand.

buildl plugins fetch

buildl plugins fetch [OPTIONS]

Pins every git plugin in buildl.lock and stores its files, so a build needs no network. No flags of its own.

Environment variables

buildl reads these from the environment it is started in. None of them reaches an action: an action gets only the variables its target declares.

VariableRead byWhat it does
NO_COLORevery commandwhen set and not empty, --color auto does not colour
TERMevery commandwhen unset, empty or dumb, output is plain lines: no live status line and no colour under --color auto
BUILDL_REMOTE_UPLOADbuild, watch, test1 is the same as --remote-upload; 0 or unset is off
BUILDL_REMOTE_STRICTbuild, watch, test1 is the same as --remote-strict; 0 or unset is off
BUILDL_REMOTE_EXECUTEbuild, watch, test1 turns remote execution on and 0 turns it off, over what [remote] execute says; the flags win over it
XDG_DATA_HOMEthe interactive approverthe folder approvals are kept in, as buildl/approved/<name>.json below it, when it is an absolute path
HOMEthe interactive approverwhen XDG_DATA_HOME is not usable, approvals are kept below $HOME/.local/share instead
PATHevery command that reads the workspacethe folders searched for a program named by its bare name, such as cc, and for git when fetching plugins

For the three BUILDL_REMOTE_ variables, any value other than 1 or 0 is refused.