Skip to content

Package Manager

Zora is the Zeen package manager.
Ships as the zora binary in each release.

  • Directorymy-project
    • Zora.toml project manifest
    • Zora.lock resolved dependencies
    • .gitignore
    • Directorysrc
      • main.zn entry point (bin), or index.zn (lib/*)
    • Directorydist/ build output
      • …

Create and run new project:

Terminal window
zora new hello
cd hello
zora run
Command Flags Description
zora init --lib Initialize a project in the current directory
zora new <name> --lib Create a new project directory
zora build -m --mode [Debug/Release], --release, --debug, --target <TRIPLE>, --emit <EMIT> Build the project
zora run -m --mode [Debug/Release], --release, --debug, [-- <ARGS>...] Build and run the project
zora test Run the project’s test suite
zora add <git-url> --branch <BRANCH> Add a dependency
zora remove <name> Remove a dependency
zora update Update lockfile dependencies from the manifest
zora check Check the project config and source
zora clean --global Remove build artifacts and caches
zora deps-map Print the dependency sources map
[package]
name = "hello"
version = "0.0.0"
zeen = "^0.4.0"
type = "bin"
description = "A small Zeen program"
[build]
output = "hello"
flags = ["--no-warns"]
link = ["raylib"]
[build.os.linux]
link = ["raylib", "m", "pthread", "dl", "rt", "GL", "X11"]
[build.os.windows]
link = ["raylib", "winmm", "gdi32", "opengl32", "shell32", "ole32"]
[dependencies]
greeting = "https://github.com/mealet/greeting"
math = { git = "https://github.com/mealet/math", rev = "dev" }
Field Description
name Package name, also the default output name
version Package version (semver)
zeen Required compiler version, a semver requirement
type bin, lib/static or lib/dynamic
description Optional package description
authors Optional author list
repository Optional repository URL
license Optional license identifier
Field Description
output Output name, overriding the package name
flags Extra flags passed to the compiler
link Native libraries to link, repeated as --link
link-dir Native library search directories, relative to the package root, repeated as --link-dir

Each entry maps a package name to a git source: a bare URL or a { git, rev } pair. rev may be a commit, tag or branch. Dependencies are resolved into Zora.lock, which pins every one to a commit.

[build] accepts per-platform sub-tables. Selector values use the same vocabulary as the compiler directives (@os, @arch, @env, @family, @target):

  • [build.target.<triple>]
  • [build.arch.<value>]
  • [build.env.<value>]
  • [build.os.<value>]
  • [build.family.<value>]

An override carries the same fields as [build]: output, flags, link, link-dir.

The override replaces the base [build] entirely, there is no merge. Repeat every field the platform needs, link included.

Precedence, first match wins: target, arch, env, os, family.

The example above links raylib twice on purpose: the base table carries it, and each platform override repeats it together with the platform libraries. A missing repeat would drop it, since Linux and Windows override sections replace the base table.

Link directives from the package and its dependencies, transitively, are collected into Zora.lock and passed to the compiler at build time.

A consumer of a library that declares link (for example zora add .../zaylib) links it automatically, with no [build] section in the consumer manifest.

A relative link-dir inside a dependency resolves against that dependency checkout.

The lockfile format is version 3 now. It records the build spec, platform sections included. Older lockfiles are re-resolved automatically on the next zora build or zora check.

Terminal window
zora add https://github.com/mealet/greeting
zora add https://github.com/mealet/math --branch dev
zora remove math
zora update

Resolved dependencies are handed to the compiler through --pkg, so use greeting; works inside src/.

Terminal window
zora build --release
Mode Output Dir
Debug dist/debug/<name>
Release dist/release/<name>

Passing --target adds the triple, dist/<triple>/<mode>/<name>, with a .exe suffix on Windows.

Builds are cached: when the inputs did not change, zora build skips the compiler and prints <path> (cached).

ZORA_HOME overrides the global cache and database directory, default ~/.zora. It is used by zora add, zora update and zora clean --global.

Library Type Output File
lib/static libNAME.a, NAME.lib (MSVC)
lib/dynamic libNAME.so, NAME.dll (Windows), libNAME.dylib (macOS)

Create new test files:

  • Directorymy-project
    • Directorytests
      • add.zn tests file

Define public tests functions:

use std.testing;
fn add_2(x: i32) i32 {
x + 2
}
/// @test
pub fn add_test() {
assert_eq(add_2(2), 4);
}
/// @test
/// @should-fail
pub fn fail_test() {
assert_eq(add_2(2), 6);
}

And run tests:

Terminal window
zora test
Tests from `tests/add.zn`:
test add.add_test ... [OK]
test add.fail_test ... [OK]
Tests 2 passed in 0.06s