Acton
Command reference

acton build

Reference manual for the acton build command

Synopsis

acton build [options] [contract-name]

Description

Compile contracts declared in Acton.toml, resolve their dependencies, and write build artifacts for the requested build set.

By default, acton build compiles every configured contract. If you pass a _contract-name_, Acton builds only that contract and its transitive dependencies.

For each successful build, Acton writes a JSON artifact to the build output directory and a contract ABI JSON file to the ABI output directory. When the contract config has an output path, Acton also writes the compiled .boc file there. Dependency helper files are emitted into the generated-code directory, and optional Fift output can be written separately.

Contracts with .boc sources are treated as precompiled inputs: Acton loads their code, includes them in dependency resolution, and skips recompilation.

If the project has no [contracts] section or the section is empty, the command prints guidance and exits without compiling anything.

Options

Build Options

<contract-name>

Build only the specified contract and its transitive dependencies.

The value must match a [contracts.<name>] key in Acton.toml.

--clear-cache

Clear the project compilation cache before building.

--graph<path>

Write the dependency graph for the requested build set as a DOT file.

--out-dir<dir>

Directory for generated JSON build artifacts.

Default:

[build].out-dir when configured, otherwise build/.

--gen-dir<dir>

Directory for generated dependency helper files such as gen/<dependency>.code.tolk.

Default:

[build].gen-dir when configured, otherwise gen/.

--output-abi<dir>

Directory for contract ABI JSON files.

Default:

[build].output-abi when configured, otherwise build/abi/.

--output-fift<dir>

Directory for compiled Fift output for .tolk contracts.

Default:

[build].output-fift when configured. If neither the flag nor the config value is set, Acton does not write .fif files.

--info

Print compiled code and hash information for each successfully built contract.

Display Options

--color<when>

Control when to use colored output.

Possible values:

auto, always, never

Project Options

--manifest-path<path>

Path to the Acton.toml file to load for this invocation.

Use this when running acton build outside the project directory or when the manifest lives at a non-default location.

--project-root<path>

Path to the project root to use for configuration discovery, cache storage, and default relative output paths.

This conflicts with --manifest-path.

Configuration

acton build reads contracts from Acton.toml:

[contracts.Wallet]
display-name = "Wallet Contract"
src = "contracts/Wallet.tolk"
output = "Wallet.boc"
depends = ["Child"]

Optional default output paths can be configured in [build]:

[build]
out-dir = "build"
gen-dir = "gen"
output-abi = "build/abi"
output-fift = "build/fift"

CLI flags override config values for the current invocation. For dependency helpers, a per-dependency depends[].path still overrides the resolved gen-dir for that helper file.

Outputs

Depending on command flags and project configuration, acton build may write:

  • <out-dir>/<contract-name>.json with code_boc64 and hash
  • <output-abi>/<contract-name>.json with the compiler ABI for .tolk contracts that declare ABI metadata
  • the configured contract output .boc file
  • <gen-dir>/<dependency>.code.tolk helper files for dependencies by default (or a dependency-specific custom path when depends[].path is configured)
  • <output-fift>/<contract-name>.fif for compiled .tolk contracts
  • a DOT dependency graph file when --graph is passed

Existing output files at those paths are replaced with freshly generated artifacts.

Best-Effort Behavior

Dependency-graph failures such as missing contracts or circular dependencies stop the command before the main compile loop starts, so those failures do not produce partial build outputs.

After dependency resolution succeeds, acton build becomes best-effort:

  • compile failures for one contract are recorded while other eligible contracts continue building
  • artifact-writing failures are also collected instead of aborting immediately
  • artifacts that were written successfully before a later failure remain on disk

If an earlier dependency failed, its generated helper file is not produced. A later parent contract may then fail because its generated import is missing.

When you build a specific _contract-name_, Acton limits the build set to that contract and its transitive dependencies.

Side Effects

acton build writes artifacts, cache entries, and optional graph output under the resolved project root. If one contract fails after earlier contracts were built successfully, the successful artifacts remain on disk.

Before compiling, acton build normally refreshes the bundled standard library under .acton/. Set ACTON_DISABLE_AUTO_STDLIB=1 to skip that automatic refresh for the current process.

Exit Status

  • 0: The command completed without compilation failures.
  • 1: The command failed because compilation, artifact writing, or dependency resolution failed for at least one requested contract.

Examples

  1. Build every configured contract:

    acton build
  2. Build one contract and its dependencies:

    acton build Wallet
  3. Rebuild with a cleared cache:

    acton build --clear-cache
  4. Write a dependency graph:

    acton build --graph deps.dot
  5. Override output locations for a single run:

    acton build --out-dir artifacts --gen-dir artifacts/gen --output-abi artifacts/abi --output-fift artifacts/fift
  6. Print compiled code and hashes after the build:

    acton build --info

See Also

Last updated on

On this page