Expand description
shuriken is a ninja-compatible build engine that can be embedded in
other programs or used through its own command-line tool.
It reads the same build.ninja manifests as
ninja, shares its .ninja_log and
.ninja_deps files byte-for-byte, and reproduces its rebuild logic, so it
can be dropped into an existing build tree.
§Embedding
The quickest way in is Engine:
use shuriken::{Engine, EngineOptions};
let mut engine = Engine::load("build.ninja", EngineOptions::default())?;
let summary = engine.build(&["all"])?;
println!("{} edges run", summary.edges_finished);Everything the engine does is also available piecemeal, so an embedder can replace individual layers:
DiskInterfaceabstracts the filesystem (MemDiskis an in-memory implementation useful for tests),CommandRunnerabstracts process execution,Statusabstracts progress reporting,Stateis the build graph, built byManifestParserand inspected or mutated directly.
§Compatibility notes
- Manifests, depfiles and paths must be valid UTF-8.
- Load-average limiting (
-l) is implemented on Linux; elsewhere it is ignored. - The GNU make jobserver protocol is not implemented.
Re-exports§
pub use build::BuildConfig;pub use build::Builder;pub use build::Verbosity;pub use build_log::BuildLog;pub use build_log::LogEntry;pub use deps_log::DepsLog;pub use disk::DiskInterface;pub use disk::MemDisk;pub use disk::RealDiskInterface;pub use engine::BuildSummary;pub use engine::Engine;pub use engine::EngineOptions;pub use error::Error;pub use error::Result;pub use exec::CommandResult;pub use exec::CommandRunner;pub use exec::RealCommandRunner;pub use graph::DependencyScan;pub use parse::ManifestParser;pub use parse::ParserOptions;pub use parse::PhonyCycleAction;pub use plan::Plan;pub use state::Edge;pub use state::EdgeId;pub use state::Node;pub use state::NodeId;pub use state::Pool;pub use state::PoolId;pub use state::State;pub use status::ConsoleStatus;pub use status::Status;pub use version::NINJA_COMPAT_VERSION;pub use version::SHURIKEN_VERSION;
Modules§
- build
- Running a build: turning a plan into processes, then recording what happened.
- build_
log - The build log (
.ninja_log): command hashes, timings and output mtimes. - canon
- Path canonicalization, matching ninja’s
CanonicalizePathexactly. - clean
- Removing build outputs (
-t clean,-t cleandead). - depfile
- Parser for Makefile-style dependency files (
gcc -MDoutput). - deps_
log - The dependency log (
.ninja_deps): header dependencies discovered while building, stored in ninja’s version 4 binary format. - disk
- Filesystem access, abstracted so embedders can substitute their own.
- dyndep
- Dynamic dependencies (
dyndep): extra inputs and outputs discovered by running part of the build. - engine
- The high-level entry point: load a manifest, keep the logs, run builds.
- error
- Error types for the shuriken build engine.
- escape
- Shell escaping and terminal-output helpers, matching ninja’s behaviour.
- eval
- Variable expansion:
$-interpolated strings, rules and lexical scopes. - exec
- Running commands.
- graph
- Deciding what is out of date.
- hash
- Command hashing, bit-compatible with ninja’s
.ninja_logentries. - lexer
- Lexer for ninja manifests.
- msvc
- Parsing
cl.exe /showIncludesoutput, fordeps = msvc. - parse
- The
.ninjamanifest parser. - plan
- The build plan: which edges we intend to run, and in what order.
- state
- The build graph: nodes (files), edges (build statements) and pools.
- status
- Progress reporting.
- tools
- The
-tsubtools: inspecting the graph, dumping commands, and so on. - util
- Small helpers: edit distance/spell checking and time.
- version
- Version reporting and
ninja_required_versionchecking.