Ninja Artifact
Portable binary distribution of Ninja, a small, fast build system focused on speed. This repository is consumed by the Embedbits Platform Artifact Handler to locate, download, verify, and configure Ninja in downstream embedded projects.
This repository is split into three branches/refs by role — the main (master) branch you are reading now holds only this documentation; the handler scripts live on the Core branch, and versioned binaries are published as GitHub Releases anchored to the Bin branch.
Repository contents
main / master
└── README.md ← This document — no other content
Core
├── ArtifactConfig.cmake ← Artifact metadata (name, version constraints, asset naming)
└── CMakeNinjaDefaults.cmake ← Ninja integration logic (artifact init, version lookup)
Bin (anchor branch — no tracked binary files)
└── (empty commits only; each release tag points here)
Role in the platform
This repository is one of several artifact distributions within the Embedbits platform. The overall flow is:
GitHub (Embedbits)
──────────────────────────────────────────────────────────
Artifact-ninja
main / master → README only (this document)
Core → ArtifactConfig.cmake, CMakeNinjaDefaults.cmake
Bin → Anchor branch (empty commits)
Releases → ninja-<version>-<platform>.zip + .hash
tagged Bin/<version>-<platform> (platform: Win / Unix / DarwinARM)
NinjaImporter.sh publishes each Ninja version as a GitHub Release — tagged Bin/<version>-<platform> — rather than as a file committed to the Bin branch. The Bin branch itself only carries empty anchor commits for the release tags to point at.
The Platform Artifact Handler in downstream projects references the Core branch as a Git submodule. At CMake configure time it reads ArtifactConfig.cmake to determine which release to fetch, then downloads and verifies the matching release asset for the current platform.
Branch structure
| Branch / Ref | Content |
|---|---|
main / master | This README only — no functional content |
Core | CMake handler scripts (ArtifactConfig.cmake, CMakeNinjaDefaults.cmake) for consuming the artifact |
Bin | Anchor branch only — no binaries are committed here |
Release tag Bin/<version>-<platform> | GitHub Release carrying the actual .zip binary and its .hash checksum file as release assets, for platform ∈ Win, Unix, DarwinARM |
Note: The Embedbits Artifact Handler protocol itself is not tied to GitHub Releases — that is simply how the GitHub-hosted importer scripts happen to publish binaries. On a Git host without an equivalent Releases API, the handler also supports packaged binaries committed directly as tracked files on the
Binbranch, tagged per version/platform (Bin/<version>-<platform>) instead of uploaded as release assets. The CMake handler resolves either form transparently.
⚠️ Fetching a release
Binaries are not stored as tracked files in Bin — clone the Core branch for the handler scripts, and download binaries as release assets for a specific tag instead of cloning the Bin branch.
# Core handler scripts
git clone --branch Core --single-branch --depth=1 <repository_url> ninja-core
# Binary + checksum for one specific version/platform (GitHub Release asset)
gh release download Bin/1.12.1-Unix --repo Embedbits/Artifact-ninja --pattern "ninja-1.12.1-Unix.*"
Included components
| Component | Description |
|---|---|
ninja / ninja.exe | Single-file build executable — the only binary shipped in this artifact |
Usage
The artifact is installed automatically during the Artifacts setup phase via:
cmake -P Artifacts/Ninja/ArtifactConfig.cmake
The script ensures the Ninja binary is available, unpacks the archive if needed, and adds the tool to the system PATH for subsequent build steps.
Handler functions
ninja_ArtifactInit(ARTIFACT_BIN_PATH)
Initializes the artifact: locates (or downloads) the Ninja binary and exposes it at ARTIFACT_BIN_PATH for use as the CMake generator executable (-G Ninja).
ninja_GetArtifactVersion()
Returns the version of the currently resolved Ninja binary.
Versioning
Artifact versions correspond directly to official Ninja release versions:
1.11.1, 1.12.0, 1.12.1, ...
New versions are published by NinjaImporter.sh in the GithubArtifactsHandler repository, which downloads the official binaries, packages them as .zip archives with SHA-256 verification, and publishes them as a GitHub Release tagged Bin/<version>-<platform> — the Bin branch itself only advances via an empty anchor commit that the tag points to.
Notes
- No installation required — binaries are portable and self-contained.
- Offline use is supported once the artifact is cached locally.
- In Azure DevOps pipelines, caching the artifact folder is recommended to reduce build time.
License
Ninja is distributed under the Apache License 2.0. For details, see: https://github.com/ninja-build/ninja/blob/master/COPYING
Authors
- Mr.Nobody — embedbits.com
Contributions are welcome! Please open a pull request.