buildl-lua 0.2.0

Lua build-file evaluation for buildl, on the airsl embedded runtime.
Documentation
//! Lua build-file evaluation for buildl, on the airsl embedded runtime.
//!
//! This crate is the only part of buildl that depends on a Lua runtime, so the effect of an
//! airsl upgrade stays within one crate. It implements `buildl-core`'s [`DeclarationSource`]
//! port as [`LuaSource`].
//!
//! [`DeclarationSource`]: buildl_core::DeclarationSource
//!
//! # Responsibilities
//!
//! - Evaluating one build file per call on a fresh airsl engine, and returning what it staged
//!   exactly as written, or the one failure that stopped it.
//! - Installing the `buildl` module table, reachable from Lua both as `airsstack.buildl` and as
//!   the global `buildl`: `target`, `test`, `discover`, `rule`, `alias`, `option`, `subdir`,
//!   `sources`, `discovered`, which returns the result a discovery target last produced,
//!   `decode_all`, which returns the JSON values of a stream as a list, and `use`, which loads a
//!   plugin under an environment of its own.
//! - Keeping the declaration phase sandboxed: airsl's minimal language surface, no grant of any
//!   kind, only the `json`, `path`, `regex`, `hash` and `glob` modules, and no `math.random`,
//!   `math.randomseed`, `print` or `airsstack.path.absolute`, and with `tostring` and
//!   `string.format` refusing address-derived text (a table, function, thread or userdata without `__tostring`,
//!   and `%p`). `buildl.sources` is the only filesystem read, and it walks only the declaring
//!   directory, never entering a directory [`LuaSource::new`] was told to skip, such as the
//!   workspace's output and state directories.
//! - Bounding a build file's memory, instructions and source walk: the ceilings of
//!   [`DeclarationLimits`], and a byte budget, equal to the memory ceiling, on what one file may
//!   stage. The `buildl.sources` walk is capped at `walk_entries` directory entries per build
//!   file, counted across all its calls. Wall time is outside every ceiling.
//!
//! # Non-responsibilities
//!
//! - Deciding which build files to evaluate, validating names, resolving labels or joining
//!   paths. The caller does all of that with what a file staged.
//! - Resolving, planning, scheduling, caching, or executing anything a build file declares.
//!
//! # Where things live
//!
//! | Module | Holds |
//! |---|---|
//! | `source` | [`LuaSource`]: read, evaluate, report |
//! | `limits` | [`DeclarationLimits`] |
//! | `engine` | the airsl engine configuration |
//! | `curated` | airsl's `path` module without `absolute` |
//! | `snapshot` | one-level copies of the library and module tables a plugin must not share |
//! | `module` | the `buildl` host module, which raises refusals |
//! | `plugin` | `buildl.use`: a plugin's manifest, environment, `require` and instances |
//! | `decode_all` | `buildl.decode_all`: a stream of JSON values as a list |
//! | `primitives` | each primitive's argument shape |
//! | `env_marks` | a target's `env` table: each name beside its written mark |
//! | `values` | the Lua value readers every primitive shares |
//! | `refusal` | why a primitive call was refused |
//! | `results` | the discovery results `buildl.discovered` reads |
//! | `sources` | the host-side walk behind `buildl.sources` |
//! | `stable_text` | `tostring` and `string.format` without address-derived text |
//! | `staging` | the staging buffer: order, byte budget, first refusal |
//! | `classify` | airsl failures named as `EvaluationFailure` kinds |
//!
//! This file holds only module declarations and re-exports, so it carries no logic to
//! unit-test.

mod classify;
mod curated;
mod decode_all;
mod engine;
mod env_marks;
mod limits;
mod module;
mod plugin;
mod primitives;
mod refusal;
mod results;
mod snapshot;
mod source;
mod sources;
mod stable_text;
mod staging;
mod values;

pub use limits::DeclarationLimits;
pub use source::LuaSource;