Ninja-compatible build system for improved end-user experience written in Rust.
- Memory safe implementation of the Ninja build system in Rust
- Modest, comprehensible, and customizable build/error outputs
- Turtle never shows any information that is inscrutable to end-users.
- This is important for users of high-level programming languages who do not know how compilers and build systems work.
cargo install turtle-buildturtleFor more information, see turtle --help.
- Ninja-compatible build file syntax and command line options 🥷
- Content hash-based rebuild
- Description-only outputs
- Turtle never shows commands of build rules but only descriptions because they are incomprehensible to end-users.
- Source mapping
- Turtle maps outputs in error messages to source filenames defined as
srcdepvariables defined inbuilddirectives to make them understandable to end-users.
- Turtle maps outputs in error messages to source filenames defined as
--log-prefixoption- It changes log prefixes attached to every line of logs from Turtle itself (e.g.
--log-prefix my-build-systemfor a log ofmy-build-system: build failed.)
- It changes log prefixes attached to every line of logs from Turtle itself (e.g.
--quietoption- It suppresses error messages from Turtle itself on expected build errors. This is useful when you are spawning Turtle as a child process of some higher-level build system.
- Console output handling similar to Rust's Cargo
- Turtle shows outputs of build jobs running currently at the bottom of logs. So it's easy to track what is going on during builds.
Compatibility with Ninja
Turtle aims to support full syntax of the Ninja build files. It also supports basic command line arguments but is not going to implement all the original options (e.g. -t option.)
-
buildstatement- Explicit outputs
- Explicit inputs
- Implicit outputs
- Implicit inputs
- Order-only inputs
-
phonyrule
-
rulestatement -
defaultstatement -
includestatement -
subninjastatement -
poolstatement - Global variables
- Build-local variables
-
inandoutspecial variable -
in_newlinespecial variable
-
-fcustom build file option -
-jjob limit option -
-kkeep-going option -
-Cchange-directory option
- Circular build dependency detection
- Circular build file dependency detection
-
builddirspecial variable - Dynamic dependencies
- Implicit inputs
- Implicit outputs
- Circular build dependency detection
- C/C++ header dependencies
-
depfileoption -
depsoption
-
-
rspfileandrspfile_contentoptions - Windows support
Unlike traditional build systems, Turtle parallelizes builds naturally in a way similar to parallel graph reduction, where a graph is rewritten in parallel until it is reduced to a final result. This is made possible by Rust's ecosystem of futures and stackless coroutines.
Here is how parallel builds work in Turtle:
- Turtle spawns futures for all builds of default targets.
- Depending on builds' configuration, they spawn more futures or resolve their futures.
- If they require some input targets to be built first, they spawn those builds for input targets all in parallel.
- Those futures are scheduled and run in parallel by an asynchronous runtime in Rust.
- Builds complete when all the futures are resolved.
Currently, Turtle uses a topological sort algorithm only to detect dependency cycles but not for scheduling of build jobs.
Dual-licensed under MIT and Apache 2.0.