{"id":47725604,"url":"https://github.com/buildbuddy-io/reninja","last_synced_at":"2026-04-02T20:22:18.564Z","repository":{"id":341748408,"uuid":"1046589406","full_name":"buildbuddy-io/reninja","owner":"buildbuddy-io","description":"Reninja: faster, more observable ninja builds","archived":false,"fork":false,"pushed_at":"2026-03-10T05:16:09.000Z","size":3053,"stargazers_count":12,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-10T13:40:26.685Z","etag":null,"topics":["build-tools","ninja-build","remote-caching","remote-execution"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/buildbuddy-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-28T23:13:08.000Z","updated_at":"2026-03-09T16:26:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/buildbuddy-io/reninja","commit_stats":null,"previous_names":["buildbuddy-io/reninja"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/buildbuddy-io/reninja","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildbuddy-io%2Freninja","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildbuddy-io%2Freninja/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildbuddy-io%2Freninja/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildbuddy-io%2Freninja/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buildbuddy-io","download_url":"https://codeload.github.com/buildbuddy-io/reninja/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildbuddy-io%2Freninja/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31315646,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-tools","ninja-build","remote-caching","remote-execution"],"created_at":"2026-04-02T20:22:17.972Z","updated_at":"2026-04-02T20:22:18.557Z","avatar_url":"https://github.com/buildbuddy-io.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reninja\n\n```\n ____  _____ _   _ ___ _   _     _   _\n|  _ \\| ____| \\ | |_ _| \\ | |   | | / \\\n| |_) |  _| |  \\| || ||  \\| |_  | |/ _ \\\n|  _ \u003c| |___| |\\  || || |\\  | |_| / ___ \\\n|_| \\_\\_____|_| \\_|___|_| \\_|\\___/_/   \\_\\\n```\n\nReninja is a complete reimplementation of the Ninja build system\nfocused on correctness, remote caching, remote execution, and build\ntelemetry.\n\n## Features\n - **Drop in replacement for Ninja** - If it works in Ninja, Reninja\n will build it too. By default, all flags and options are honored,\n even the hidden 🐢 ones.\n - **Build visibility** - use the timing profile (flame graph) to\n visualize the slow parts of the build and fix them.\n - **Remote caching** - allows for massive reductions in CPU usage and\n drastically reduces build times by not building the same thing twice.\n - **Remote execution** - run builds with massive parallelization (`-j\n   2000`) to speed them up. Build LLVM, from scratch, in 3 minutes!\n - **Extensive unit and integration tests** - all Ninja tests were\n ported over, and new ones added for Reninja-only\n functionality. Additional parity tests ensure that Reninja and Ninja\n produce the same outputs.\n\n## Quick Start\n\n#### Install the Reninja binary:\n```shell\n  go install github.com/buildbuddy-io/reninja/cmd/reninja@latest\n```\n\n#### Build locally \n  This does the exact same thing as ninja.\n```shell\n  reninja\n```\n\n#### Build with Build Event Stream (BES) enabled\n```shell\n  reninja --bes_backend=remote.buildbuddy.io --results_url=https://app.buildbuddy.io/invocation\n```\n\nThis will show basic information about the build and allow for later\nanalysis of build time trends. [Example\nbuild](https://app.buildbuddy.io/invocation/695b24ca-b8ea-4781-9594-6b621474455c)\n\n\n#### Build your project with BES and Remote Cache enabled\n```shell\n  reninja --bes_backend=remote.buildbuddy.io --results_url=https://app.buildbuddy.io/invocation --remote_cache=remote.buildbuddy.io\n```\n\nThis will show more information about the build (including the timing\nprofile!) and allow for reusing cached results from previous builds\nwhich is significantly faster than building from scratch. [Example\nbuild](https://app.buildbuddy.io/invocation/93289e2d-595e-4452-8cb5-61874935fe98)\n\n![Timing\nProfile](https://github.com/user-attachments/assets/905ac68b-7588-47c4-8cd0-299222afd754)\n\n#### Build with remote execution (see [Remote Execution](#remote-execution) below for details)\n```shell\n  SRC=$PWD\n  BUILD_DIR=$SRC/build-rbe\n  mkdir -p \"$BUILD_DIR\"\n  docker run --rm \\\n\t  --user \"$(id -u):$(id -g)\" \\\n\t  -v \"$SRC:$SRC\" \\\n\t  -v \"$(which ninja):/usr/local/bin/ninja:ro\" \\\n\t  -w \"$BUILD_DIR\" \\\n\t  gcr.io/flame-public/rbe-ubuntu22-04:ninja \\\n\t  cmake -G Ninja \\\n\t\t-DCMAKE_SUPPRESS_REGENERATION=ON \\\n\t\t\"$SRC\"\n  reninja -C $BUILD_DIR --bes_backend=remote.buildbuddy.io \\\n\t  --results_url=https://app.buildbuddy.io \\\n\t  --remote_executor=remote.buildbuddy.io \\\n\t  --container_image=gcr.io/flame-public/rbe-ubuntu22-04:ninja \\\n\t  --remote_header=x-buildbuddy-api-key=YOUR_API_KEY_HERE \\\n\t  -j 1000\n```\n\nThis will run all build actions remotely and download the results of\neach action. [Example\nbuild](https://app.buildbuddy.io/invocation/aec6d04d-d354-4d69-9811-ab08d5cb2bca)\n\n[![Local vs\nRemote](https://asciinema.org/a/yvz42ATqgpJHtEU4.svg)](https://asciinema.org/a/yvz42ATqgpJHtEU4)\n\n## About\n\nReninja owes its existence to the original [Ninja Build\nSystem](https://ninja-build.org/) and all credit goes to the [original\nauthor](https://neugierig.org/) and [many open source\ncontributors](https://github.com/ninja-build/ninja/graphs/contributors).\nAll bugs / mistakes are my own.\n\n## Motivation\n\nNinja is an excellent and **simple** build tool. Many projects have\nmodified it to add in various forms of observability or remote\nexecution. I wanted to roll up some of those improvements in one place\nand also add proper support for *remote caching* and *remote\nexecution*, which do not cleanly fit in the original project due to\ncomplex networking requirements and extensive (proto, gRPC)\ndependencies.\n\nAt BuildBuddy, we've spent a lot of time building tools for\n[Bazel](https://bazel.build/) and our customers derive a lot of value\nfrom being able to build and test their software in a remote execution\nenvironment or with more observability.\n\nI wanted to make those features available to ninja-based projects and\noffer Reninja as a simple, generic replacement for distcc-style\nbuilding. There's nothing BuildBuddy specific here -- Reninja is just\na normal [remote-apis](https://github.com/bazelbuild/remote-apis/)\nclient.\n\n## Installation\n\nBecause Reninja is a golang application, you can install it with `go install`:\n```shell\n  go install github.com/buildbuddy-io/reninja/cmd/reninja@latest\n```\n\nWe also offer prebuilt binaries for Linux and Mac attached to the github release:\n```shell\n  curl -fSL \"https://github.com/buildbuddy-io/reninja/releases/latest/download/reninja-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | sed\n  's/x86_64/amd64/;s/aarch64/arm64/')\" -o reninja\n  mv reninja /usr/local/bin/ninja\n```\n\n## NinjaRC (Config file configuration)\n\nOne powerful feature Reninja borrows from Bazel is the ability to read\nconfig files from various locations that define common build\nflags. This can be used to define a common build configuration (host,\nremote namespace, container image, etc) that all builders of the\nproject should use.\n\nOut of the box, Reninja will look for a file called `.ninjarc` in the\nfollowing places:\n - the CWD (`.ninjarc`)\n - the project root (`%workspace%/.ninjarc`)\n - the user's home directory (`~/.ninjarc`)\n - the system etc dir (`/etc/.ninjarc`)\n\nA contrived, basic `.ninjarc` file might look like this:\n```\nbuild:local --bes_backend=\"grpc://localhost:1985\"\nbuild:local --remote_cache=\"grpc://localhost:1985\"\nbuild:local --remote_executor=\"grpc://localhost:1985\"\nbuild:local --results_url=\"http://localhost:8080/invocation\"\n```\n\nThis config specifies that for \"build\" commands, when the --config\nflag value is \"local\", the `--bes_backend`, `--remote_cache` and\n`--results_url` flags will be set.\n\nA more useful example might look like this:\n```\ncommon --remote_header=x-buildbuddy-api-key=YOUR_API_KEY_HERE\n\nbuild:bes --bes_backend=remote.buildbuddy.io \nbuild:bes --results_url=https://app.buildbuddy.io/invocation\nbuild:cache --config=bes --remote_cache=remote.buildbuddy.io\nbuild:remote --config=cache --remote_executor=remote.buildbuddy.io\nbuild:remote --container_image=\"gcr.io/flame-public/rbe-ubuntu22-04:ninja\"\nbuild:remote -j 2000\n\n# default to bes + caching, allow passing \"--config=remote\" to rexec\nbuild --config=cache\n```\n\nThis config defines three different modes `bes`, `cache`, and `remote`\nand selects `cache` by default for ninja builds. The special `common`\nsection is *always* expanded.\n\n## Two-stage Cache Lookups\nRemote caching with Reninja is more challenging than with Bazel\nbecause build actions (edges, in ninja parlance) do not always fully\ndeclare *all* of their inputs. That's because not all inputs are known\nat build time -- headers may pull in other headers implicitly.\n\nWhen a command runs for the first time, the compiler will often\ngenerate a Dependency File (depfile) that contains information about\nthe source file's dependencies. After the command finishes, Reninja\nwill read these depfiles and use this information to update the build\ngraph for subsequent builds, avoiding recompilation of objects with no\nchanged dependencies.\n\nTypically, in a remote cache, compiled object files are looked up\nusing a hash of all of their inputs. If any input changes, the hash\nwill change and the object will be a cache-miss and be recompiled.\nExtending this mechanism to Reninja is tricky though: if you only look\nat an actions explicit inputs, you may not recompile the object when\nyou should. But implicit inputs are not known until the compilation\nhas already run once, so if you lookup actions this way, you'll have\ncache misses for partial builds or across users.\n\nReninja does a two-stage lookup: the hashes of an edge's explicit\ninputs are looked up to find the list of implicit deps. The hashes of\nthose implicit deps are looked up to find the actual compiled\nobject. This way if either explicit or implicit inputs change, the\nobject will be recompiled.\n\nThis means you can run two clean builds in a row, and get 100% cache\nhit rate on the second build.\n\n## Remote Execution\n\nRemote execution with Reninja is similarly challenging. Edges do not\nalways fully declare *all* of their inputs, so remote actions may not\nhave all the files needed for compilation. Additionally, CMake\ndefaults to configuring against the installed system libraries rather\nthan specifying everything at the project level (cmake toolchains are\nkind of an option here, but not often used).\n\nTo sidestep these issues, remote execution with Reninja generally\nrequires two things:\n\n1. configuring the build inside a container\n2. using include scanning to determine the inputs for an action\n\nBuilding projects this way has the nice property that all contributors\nto the project are working with a commonly known set of tools --\neverything is fully declared either in the container image used for\nremote execution or in the source code.\n\nHere's an example of using ninja with remote execution to build duckdb\n(a small to mid-size c++ project configured with cmake):\n\nClone the repo:\n```shell\n  cd ~/\n  git clone https://github.com/duckdb/duckdb.git --depth=1\n  mkdir -p ~/duckdb/build-rbe\n```\n\nConfigure it with cmake (against a docker image):\n```shell\n  docker run --rm \\\n      --user \"$(id -u):$(id -g)\" \\\n\t  -v \"$HOME/duckdb:$HOME/duckdb\" \\\n\t  -v \"$(which ninja):/usr/local/bin/ninja:ro\" \\\n\t  -w \"$HOME/duckdb/build-rbe\" \\\n\t  gcr.io/flame-public/rbe-ubuntu22-04:ninja \\\n\t  cmake -G Ninja -DCMAKE_SUPPRESS_REGENERATION=ON $HOME/duckdb\n```\n\nRun the build using remote execution:\n```shell\n  cd ~/duckdb/build-rbe\n  reninja --bes_backend=remote.buildbuddy.io \\\n\t  --results_url=https://app.buildbuddy.io/invocation \\\n\t  --remote_executor=remote.buildbuddy.io \\\n\t  --container_image=gcr.io/flame-public/rbe-ubuntu22-04:ninja \\\n\t  --remote_header=x-buildbuddy-api-key=YOUR_API_KEY_HERE \\\n\t  -j 2000\n```\n\nRun the unit tests inside the container:\n```shell\n  docker run --rm \\\n      --user \"$(id -u):$(id -g)\" \\\n      -v \"$HOME/duckdb:$HOME/duckdb\" \\\n      -w \"$HOME/duckdb/build-rbe\" \\\n      gcr.io/flame-public/rbe-ubuntu22-04:ninja \\\n      $HOME/duckdb/build-rbe/test/unittest\n```\n\n## Usage of AI\n\nIs this just another AI slop project? **No!**\n\nReninja was born from a bet (could AI do this?) but since the [initial\nversion](https://github.com/buildbuddy-io/reninja/commit/8c1bde042af17056246167a338b74aa2172b728c)\nI have re-written each file by hand in go. I have occasionally relied\non claude to port unit tests, but only after writing several examples\nmyself would I then ask it to port more tests following my lead.\n\nSome other BES, remote caching, and remote execution libraries were\nborrowed from BuildBuddy and lightly modified to be suitable for\nReninja.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuildbuddy-io%2Freninja","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuildbuddy-io%2Freninja","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuildbuddy-io%2Freninja/lists"}