Under construction. Expect hiccups and unfinished parts.
A build system as library.
n2o5 is an idea grew out of fiddling n2.
Less ninjutsu, more oxidizer.
For low-level build graph executors like Make and Ninja, the build graph itself is implicit, based on artifacts generated by each build command. However, when writing build systems for high-level languages, it's often easier to think in the relationship between build command themselves, instead of writing the artifacts they generate and parsing it back to the graph.
n2o5 is a project that tries to explore build system design ideas from here:
- An embedded build graph executor that runs in-memory graphs.
- Works directly on build nodes and the edges connecting them. Files are only for determining the up-to-dateness of nodes.
- Build environment agnostic. Mock the world if you like.
- First-class callbacks as build commands.
n2o5 also differs from n2 significantly.
In particular, n2o5 is not optimized for Ninja compatibility,
and aims for better ergonomics as a library & in-memory graph usage.
n2o5 provides overridable implementations
to accommodate different build environments and needs.
Worlds (file system and process spawning):
n2o5::LocalWorld-- The default world implementation, working on the local file system and process space.- (Test only)
tests/mock.rs::MockWorld-- A mocked world for testing.
Databases (build state cache):
n2o5::db::in_memory::InMemoryDb-- An in-memory database implementation, mainly for testing, but can be used for ephemeral builds.n2o5_redb::ExecRedb-- Aredb-backed filesystem database implementation.n2o5_heed::ExecHeedDb-- A LMDB(viaheed)-backed filesystem database implementation. (Untested)
Progress (build status reporting):
n2o5::progress::noop::NoopProgress-- Does nothing at all.n2o5::progress::dumb::DumbConsoleProgress-- An append-only console progress reporter.
The n2o5 commandline executable, located in cli/,
is used for testing and stressing the library.
It contains a subset of ninja for testing with the library and tweaking on ergonomics.
You may use it either as n2o5 ninja [ninja_args...]
or create a symlink whose name starts with ninja and use it as a replacement.
Unsupported features:
- Dry run
- Printing commands executed
- Advanced
ninjafeatures like pools, response files, depfile/dyndep, etc.
Originally this project was called n2o4.
However, this name has been taken by n2o4,
a binding to NASA's Core Flight System, which definitely deserves the name.
It has thus been renamed to n2o5.