Dependencies
Ard dependencies are declared in ard.toml, resolved in ard.lock, and restored into a shared cache. Builds use the lockfile and cache; they do not fetch or update dependencies automatically.
Declaring dependencies
Section titled “Declaring dependencies”A project can depend on Git packages or local path packages:
name = "my_app"ard = ">= 0.13.0"
[dependencies]vaxis = { git = "https://github.com/akonwi/vaxis-ard.git", commit = "76f7c1b" }shared = { path = "../shared" }The dependency key is the import root visible to the package that declares it:
use vaxisuse shared/stringsRoot modules
Section titled “Root modules”A bare dependency import loads that package’s root module. The root module is the file whose name matches the dependency’s name in its ard.toml.
For example, a dependency with this manifest:
name = "decode"and this layout:
decode/├── ard.toml├── decode.ard└── path.ardcan be imported as:
use decode // loads decode.arduse decode/path // loads path.ardYou do not need to repeat the package name as use decode/decode. If a dependency alias differs from the package name, use the alias at the call site; Ard still finds the root module from the dependency’s manifest.
Dependency aliases are package-local. Your root project can import only its direct dependencies. A dependency’s own dependencies are available to that dependency, but they are not automatically re-exported into your root project’s import namespace.
Adding a Git dependency
Section titled “Adding a Git dependency”Use ard add to add or update a Git dependency:
ard add github.com/akonwi/vaxis-ard@v0.1.0ard add github.com/akonwi/vaxis-ard@76f7c1b as tuiard add github.com/akonwi/vaxis-ard@latestard add:
- resolves the requested tag, commit, or
latestref, - updates
ard.toml, - writes the resolved graph to
ard.lock, and - fetches Git dependencies into Ard’s shared cache.
Updating dependencies
Section titled “Updating dependencies”Use ard update to move Git dependencies to the latest commit on their default branch:
ard update # update every direct Git dependencyard update vaxis # update one dependencyard update vaxis tui # update severalard update:
- resolves the latest commit for each target,
- rewrites the dependency’s
ard.tomlentry to the resolved commit, - updates
ard.lock, and - fetches the new commit into the shared cache.
A dependency that is already at the latest commit is left untouched. Path dependencies are skipped, since they track a local directory rather than a commit.
Updating pins the resolved commit for that Git source across the whole graph. If the same repository is also pulled in transitively by another dependency, it is updated there too — Ard keeps a single commit per Git source, and the explicit update wins over the commit a transitive dependency pinned.
You can still update a single dependency to a specific ref with ard add:
ard add github.com/akonwi/vaxis-ard@v0.2.0ard add github.com/akonwi/vaxis-ard@latestLockfile and cache
Section titled “Lockfile and cache”ard.lock records the exact package graph used by the project, including resolved commits and cache integrity hashes. Commit ard.lock with your project.
Git dependencies are restored into Ard’s shared cache:
~/.ard/cache/git/<source-hash>/<commit>/You can override the cache location with ARD_CACHE_DIR, which is useful for CI or tests.
Ordinary commands such as ard check, ard run, ard build, and ard test expect locked dependencies to already be present in the cache. If a cache entry is missing, run:
ard deps fetchTo verify that cached dependencies match ard.lock, run:
ard deps verifyRemoving a dependency
Section titled “Removing a dependency”Remove a direct dependency with:
ard remove vaxisThis removes the dependency entry from ard.toml and prunes unreachable packages from ard.lock.
Local path dependencies
Section titled “Local path dependencies”Path dependencies point directly at a local package root:
[dependencies]shared = { path = "../shared" }They are resolved from the path in ard.toml and are not copied into the cache. Path dependencies are useful for local development across multiple packages.
FFI companions
Section titled “FFI companions”Dependency packages may own Go FFI companions, such as ffi/*.go. The compiler routes extern calls to the package that declares them, so a dependency can provide both its Ard API and host-language implementation.
Validation
Section titled “Validation”Every imported Ard module is type-checked by your compiler when it is loaded — project-owned modules and dependencies alike — and any diagnostics are reported against the module’s own source. If a dependency reports errors you did not write, it usually means the dependency has not been updated for your compiler version; pin an older compatible tag or update the dependency.
The standard library is the one exception: it ships inside the compiler and is validated when the compiler itself is built, so imports never re-report its internals.