3.1 · What a build system actually does
Definition. A build system is a directed-acyclic-graph evaluator that maps a set of input files and tools to a set of output artefacts, while reusing previously computed outputs whenever inputs are unchanged.
- Graph — nodes are targets, edges are dependencies. Cycles are errors.
- Cache — keyed by a hash of inputs + toolchain + flags. A cache hit skips work.
- Parallelism — independent nodes run concurrently up to the configured worker count.
- Reproducibility — same inputs → bit-identical outputs, regardless of when or where.
- Incrementality — only the smallest sub-graph affected by a change is re-evaluated.
3.2 · Per-language tools
| Language | Primary tools (2026) | Notes |
|---|---|---|
| C / C++ | Make, CMake, Meson, Ninja, xmake | CMake generates Ninja files; Ninja is the fast back-end. |
| JVM | Gradle 8.x, Maven 3.9+, Mill, sbt | Gradle has the strongest incremental + remote cache. |
| Rust | Cargo | Workspaces, lockfile, optional sccache. |
| Go | go build, Go modules | Built-in cache at $GOCACHE. |
| JS / TS | npm, pnpm, yarn (Berry), Bun | pnpm/yarn use content-addressed stores; Bun is the new fast runtime + installer. |
| .NET | MSBuild, dotnet build | NuGet for packages; deterministic builds since .NET 5. |
| Scala | sbt, Mill, Bleep | sbt incremental compiler (Zinc) is the model. |
| Python | uv (Astral), Poetry, Hatch, Rye, PDM | uv (2024) is now the de-facto fast resolver/installer. |
| Swift | SwiftPM, Xcodebuild | Bazel rules exist for very large iOS monorepos. |
3.3 · Polyglot build tools
Definition. A polyglot build system handles multiple languages within one DAG, enabling cross-language dependencies, shared caching, and one BUILD definition language.
| Tool | Origin | Strength | Watch out for |
|---|---|---|---|
| Bazel | Google (Blaze, 2015 OSS) | Hermetic, remote cache, RBE | Steep onboarding, Starlark verbosity. |
| Buck2 | Meta (Rust rewrite, 2023 OSS) | Faster than Buck1; remote execution | Smaller ecosystem. |
| Pants 2 | Twitter origin → Toolchain Inc. | Python-first polyglot, low boilerplate | Smaller community than Bazel. |
| Please.build | Thought Machine | Bazel-like, simpler | Niche. |
| Nx | Nrwl (2017) | Best-in-class JS/TS monorepo | JS-centric. |
| Turborepo | Vercel | Easy ramp for JS/TS, remote cache | Less powerful graph than Nx/Bazel. |
| Earthly | Earthly Inc. | Dockerfile + Makefile hybrid | Container-overhead per step. |
| Dagger | Solomon Hykes (post-Docker), 2022 | Programmable pipelines in Go/Python/TS | Newer; engine in BuildKit. |
| Moon (moonrepo) | OSS, 2022 | Modern monorepo orchestrator | Younger ecosystem. |
3.4 · Reproducible builds
Definition. A build is reproducible if anyone, given the same source code, build environment, and instructions, can recreate bit-for-bit identical copies of all artefacts.
- SOURCE_DATE_EPOCH — an env var (reproducible-builds.org spec) used to pin timestamps embedded in archives, binaries, docs.
- Pinned toolchains — exact compiler, linker, and stdlib versions;
rustup-toolchain.toml,.tool-versions(asdf/mise). - Stable file ordering — sorted tarballs/zips; deterministic archive metadata (uid 0, gid 0).
- Nix & Stagex — purely functional package managers that hash every input; the gold standard for reproducibility.
- reproducible-builds.org — cross-distro project (Debian, Arch, Fedora, OpenSUSE) verifying their packages.
3.5 · Hermetic builds
Definition. A hermetic build is one that depends only on declared inputs — no ambient network access, no host-system libraries, no time-of-day side effects.
| Technique | Tool support |
|---|---|
| Sandboxed action exec | Bazel sandbox, Buck2 sandbox, Nix sandbox |
| Vendored dependencies / lockfiles | Cargo, Go modules, pnpm, uv |
| Pinned toolchain in repo | rules_python, rules_go, rules_rust |
| Network disabled at build time | Nix --offline, Bazel --experimental_repository_disable_download |
3.6 · Build caches
The cache is what turns a 40-minute clean build into a 30-second incremental one. There are three layers:
- Local cache —
$GOCACHE,~/.gradle/caches,~/.cache/bazel. - Remote cache — shared between developers and CI: Bazel Remote Cache, Gradle Build Cache (Develocity), Turborepo Remote Cache, BuildBuddy, EngFlow, sccache, ccache.
- Remote execution (RBE) — actions run on a remote cluster; outputs streamed back. Bazel RBE, Buck2 RE, BuildBuddy, EngFlow.
# enable a remote cache for Bazel
build --remote_cache=grpcs://buildbuddy.io
build --remote_upload_local_results=true
build --bes_backend=grpcs://buildbuddy.io
build --bes_results_url=https://app.buildbuddy.io/invocation/
3.7 · Artefact registries
| Artefact | Common registries |
|---|---|
| Container / OCI image | Docker Hub, GHCR, Amazon ECR, Google Artifact Registry, Azure ACR, Quay, Harbor (self-hosted), Zot |
| JAR / Maven | Maven Central, Sonatype Nexus, JFrog Artifactory, GitHub Packages, Cloudsmith |
| npm | npmjs.org, Verdaccio (self-hosted), Cloudsmith, Artifactory |
| PyPI | PyPI.org, devpi, Cloudsmith, Artifactory |
| Helm charts, WASM, ML models, Cosign signatures | Any OCI-compatible registry (OCI 1.1 artefact spec, 2024) |
| Debian / RPM | Aptly, Pulp, Artifactory, Cloudsmith |
3.8 · Artefact promotion
Definition. Promotion is the act of moving an immutable artefact through environments (dev → staging → prod) by changing its tags or metadata — never by rebuilding it.
- Tag artefacts with immutable digests (e.g.
sha256:…) not floating tags likelatest. - Promotion is metadata + signature update only (Cosign, Notation).
- Environments differ by config, not by build.
3.9 · BOMs and provenance
| Concept | Standard | Tool examples |
|---|---|---|
| SBOM (Software Bill of Materials) | SPDX (ISO/IEC 5962), CycloneDX (OWASP) | Syft, Trivy, Microsoft SBOM Tool, cdxgen |
| Build provenance | SLSA v1.0 (2023, OpenSSF) | GitHub Artifact Attestations, Sigstore Cosign, slsa-github-generator |
| Verifiable supply chain | in-toto (CNCF graduated 2023) | in-toto-attestation, witness |
| Signatures | Sigstore / Cosign, Notation (CNCF), GPG | cosign sign/verify, notation sign |
SLSA levels (build track):
3.10 · Build observability
- Develocity (formerly Gradle Enterprise) — build scans, performance hot-spots, remote cache analytics.
- BuildBuddy & EngFlow — Bazel/Buck2 remote cache + RBE with deep timeline UIs.
- BuildPulse, Trunk Flaky Tests, Datadog Test Optimisation — flakiness detection & quarantine.
- OpenTelemetry CI/CD semantic conventions (2024 draft) — standard span/attribute names for builds.
Quick decision tree
- Single language, small team → native tool (Cargo, Go, Maven, uv).
- JS/TS monorepo → Nx or Turborepo.
- Polyglot monorepo, > 100 engineers → Bazel or Buck2.
- Need pipelines-as-code separate from CI vendor → Dagger or Earthly.
- Strict reproducibility / supply-chain requirement → Nix or Stagex.