Skip to main content

Crate buildl_lua

Crate buildl_lua 

Source
Expand description

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.

§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

ModuleHolds
sourceLuaSource: read, evaluate, report
limitsDeclarationLimits
enginethe airsl engine configuration
curatedairsl’s path module without absolute
snapshotone-level copies of the library and module tables a plugin must not share
modulethe buildl host module, which raises refusals
pluginbuildl.use: a plugin’s manifest, environment, require and instances
decode_allbuildl.decode_all: a stream of JSON values as a list
primitiveseach primitive’s argument shape
env_marksa target’s env table: each name beside its written mark
valuesthe Lua value readers every primitive shares
refusalwhy a primitive call was refused
resultsthe discovery results buildl.discovered reads
sourcesthe host-side walk behind buildl.sources
stable_texttostring and string.format without address-derived text
stagingthe staging buffer: order, byte budget, first refusal
classifyairsl failures named as EvaluationFailure kinds

This file holds only module declarations and re-exports, so it carries no logic to unit-test.

Structs§

DeclarationLimits
The memory, instruction and source-walk ceilings for evaluating one build file.
LuaSource
Evaluates build files on the airsl embedded runtime, one fresh engine per file.