build Command (WIP - work-in-progress)
The build command compiles Solana programs located in a given target directory.
It supports both Anchor projects and native SBF (Solana BPF) programs.
Usage
cargo run -- build --target-dir ./examples/my_project --out-dir ./out/
Arguments:
--target-dir: Path to the Solana project root.--out-dir: Path where build outputs should be saved.--unsafe-version-switch: (Optional) Flag to auto switch the anchor version
Behavior
sol-azy automatically detects the project type based on its contents:
| Type | Detection Criteria |
|---|---|
| Anchor | Presence of Anchor.toml |
| Native SBF | Cargo.toml includes solana-program |
Depending on the project type, it runs one of:
anchor build --skip-lint(for Anchor)cargo build-sbf(for SBF)
Before building, the tool runs a series of pre-checks:
- Verifies that
cargoand/oranchoris installed - Checks if the output directory exists or creates it
- Validates the project directory structure
Output
By default, the output directory will contain:
- Compiled
.sofile(s) in subdirectories defined by the framework - Any additional files generated by the Solana toolchain
Example
cargo run -- build \
--target-dir test_cases/base_sbf_addition_checker \
--out-dir test_cases/base_sbf_addition_checker/out
This builds a native Solana SBF program and saves the output in test_cases/base_sbf_addition_checker/out.