Skip to content

neul-labs/rninja

Repository files navigation

rninja

Crates.io npm PyPI CI Documentation License: MIT

rninja is a drop-in replacement for Ninja with built-in caching — build faster, cache smarter, change nothing.

Website · Documentation · GitHub

A Rust-powered build tool with modern scheduling that reads your existing .ninja files and cuts build times without changing a line of your build configuration.

Installation

Homebrew (macOS & Linux)

brew tap neul-labs/tap
brew install rninja

NPM

npm install -g rninja-cli

PyPI

pip install rninja-cli

Cargo

cargo install rninja

From GitHub Releases

Download prebuilt binaries from the Releases page.

Build from source

git clone https://github.com/neul-labs/rninja
cd rninja
cargo install --path .

Usage

rninja works exactly like ninja—just swap the binary:

# Use directly
rninja

# Or with your existing workflow
rninja -C out/Release
rninja -j8 my_target

# Symlink as ninja for seamless integration
ln -s $(which rninja) /usr/local/bin/ninja

All ninja flags work: -C, -j, -k, -d, -t, and more.

Why rninja?

Feature Benefit
Drop-in compatible Works with existing .ninja files from CMake, GN, Meson, or any generator
Built-in caching Content-addressed cache skips redundant work automatically
Modern scheduler Rust async runtime keeps all cores busy, minimizing idle time
Remote cache ready Share cached artifacts across machines and CI runners

Performance

Scenario Speedup
Warm incremental builds 2× – 5×
CI with shared cache 2× – 5×
Cold builds 1.3× – 2×

See BENCHMARK.md for detailed comparisons.

Configuration

rninja works out of the box with sensible defaults. For customization:

# Generate a sample config
rninja -t config -v

Config files are loaded from:

  1. .rninjarc (project)
  2. ~/.rninjarc (user)
  3. ~/.config/rninja/config.toml (XDG)

Environment Variables

Variable Description
RNINJA_CACHE_DIR Cache directory location
RNINJA_CACHE_ENABLED Enable/disable caching (0 or 1)
RNINJA_REMOTE_URL Remote cache server URL
RNINJA_CACHE_MODE local, remote, or both

Subtools

All ninja subtools plus extras:

rninja -t clean       # Remove built files
rninja -t compdb      # Dump JSON compilation database
rninja -t graph       # Output graphviz dot file
rninja -t deps        # Show stored dependencies
rninja -t query       # Show inputs/outputs for a path
rninja -t config      # Show/generate configuration

Run rninja -t list for the complete list.

Who is rninja for?

  • C/C++ projects with multi-minute incremental builds
  • CI pipelines running many builds per day
  • Monorepos with shared code across teams
  • Game studios and performance-sensitive teams already using Ninja
  • Anyone who wants faster builds without changing their workflow

How it works

  1. Parse your existing build.ninja file (no changes needed)
  2. Hash inputs, compiler flags, and environment
  3. Check cache for matching artifacts
  4. Build only what's actually changed
  5. Store results for next time

The local cache uses sled for metadata and content-addressed blob storage for artifacts. Optional remote caching uses nng for high-throughput artifact sharing.

Contributing

Contributions welcome! Please see our GitHub repository for:

  • Bug reports and feature requests
  • Pull requests
  • Architecture discussions

Documentation

Part of the Neul Labs toolchain

Explore the rest of the Neul Labs developer tools:

Project Description
rjest A blazing-fast, Jest-compatible test runner — 100x faster warm runs.
rpytest Run your pytest suite faster. Change nothing.
gity Make large Git repositories feel instant.
stkd Stacked diffs for GitHub and GitLab.
grite The issue tracker that lives in your repo. Built for AI agents.

Learn more at neullabs.com.

License

MIT License - see LICENSE for details.


Built with Rust by Neul Labs