Toolchain Management
RBS provides a hermetic toolchain system that automatically downloads, caches, and manages all external tools and runtimes your project needs. No manual installation required — RBS handles everything.Why Hermetic Toolchains?
- Reproducibility: Every developer and CI server uses the exact same tool versions.
- No System Dependencies: No need to install Java, Python, Node.js, or any other tool system-wide.
- Version Isolation: Different projects can use different versions of the same tool without conflict.
- Automatic Caching: Tools are downloaded once and cached for future use.
How It Works
- You declare toolchains in
WORKSPACE.rbs. - RBS automatically downloads the correct version for your platform.
- Tools are cached in
.rbs/toolchains/. - Build rules use the managed toolchains — never system-installed tools.
Declaring Toolchains
Language Toolchains
RBS provides built-in toolchain rules for common languages:Custom Toolchains
For tools not covered by built-in rules, use the low-level primitives:native.http_file — Download a Single File
native.http_archive — Download and Extract an Archive
native.tool_binary — Declare a Tool from an Archive
register_toolchain — Register for Use in Rules
Using Toolchains in Rules
In Built-in Rules
Built-in rules automatically use the appropriate registered toolchain:In Custom Rules
Access toolchains viactx.tools:
Platform-Aware Downloads
RBS automatically selects the correct download URL based on the current platform usingselect():
Available Platform Labels
Toolchains vs External Dependencies
It’s important to understand the difference between toolchains and external dependencies:Example: Both Together
Caching and Offline Builds
Cache Location
All toolchains are cached in.rbs/toolchains/: