Standardbibliothek
Antra::Project
import Antra::ProjectThe project file antra.and and antra init.
One file in the project's root folder says what the project is and how it
is shipped, like package.json or Cargo.toml:
# antra.and: the project
%Project{
name: "breakout",
version: "1.0.0",
main: "raylib_breakout.ant",
native: %{raylib: "6.2"},
pack: %{targets: ["windows-x86_64", "macos-aarch64"], onefile: true}
}native: holds what native.and holds (antra native), pack: the
settings of app.and (antra pack) except name, version and main,
which stand at the top. With an antra.and both old files are ignored.
The root is the nearest folder with an antra.and, searched upwards (up
to the home folder); antra puts its lib/ on the search path, so a
script in t/ or tools/ imports the project's packages.
Unknown keys are an error with a suggestion: a typo in a small file like this one should never be silently ignored.
Funktionen#
fn exists?(dir)Whether dir has an antra.and.
fn find_root(start)Returns %Ok[dir]: the nearest folder from start upwards with an
antra.and, or %Err when there is none. The search stops at the
home folder.
fn init(dir, [lib: = undef, targets: = undef, onefile: = false, macos_app: = false,
author: = undef, log: = &println])Creates a project in dir: antra.and and, where missing, the main
script (or for lib: a package and a test) and .gitignore. Takes
over app.and and native.and. Never overwrites a file. Returns
%Ok[[created file, ...]].
fn init_cli(argv)Runs antra init <argv...>; returns the exit code.
fn legacy_warning(dir, legacy, section)The warning for an old settings file next to antra.and, or undef.
fn native_libraries(project)The C libraries of a project (native:), an empty map without any.
fn pack_settings(project)The antra pack settings of a project: pack: plus name, version
and main from the top (pack.main wins).
fn read(dir)Returns %Ok[project]: the checked map in <dir>/antra.and, untagged.
fn validate(m, path)Checks a decoded project map; path names it in messages. Returns
%Ok[project].
