Chapter 30: platforms, where build actions run, and a cache
Last chapter, and the most backstage. Every compile, link and test that
buck2 runs is an action, and an execution platform says where actions
may run: here, on this machine, or on a remote build farm, and whether a
shared cache of results may be consulted first. .buckconfig names this
folder's one platform, root//platforms:execution.
It is the prelude's own default (run everything locally on the host's CPU and OS) with one switch exposed: an opt-in remote action cache. The prelude's default hard-codes local-only execution, so no amount of configuration elsewhere can make it use a cache; this rule is the same platform with that one door unlocked.
flowchart LR
action["a build action"] --> q{"[buildbuddy] cache = true?"}
q -- no --> local["run it locally (the prelude default)"]
q -- yes --> hit{"already in the remote cache?"}
hit -- yes --> done["use the cached result"]
hit -- no --> run["run it locally, upload the result"]
The switch is read_config("buildbuddy", "cache", "false"). Only a
user-level buckconfig on the owner's development machine sets it, together
with the cache's endpoint and key. Anywhere that file is absent (a fresh
clone, CI, another machine) the flag is false and this is exactly the
prelude default, so the repository never needs the cache, or its
credentials, to build.
Aside: cache-only, never remote execution. Actions always run locally; the cache is only checked first, and local results uploaded. Measured 2026-09-23: a clean rebuild, and a second checkout at another path, both hit 100%.
Try it.
grep -n -A1 '^\[build\]' .buckconfigshows.buckconfigselecting this platform. Without the user-level config it builds exactly as the prelude's default would.
That is the whole guide. Back to the prologue for the map.
For the people who maintain it
In this folder
| Path | What |
|---|---|
| BUCK | cached_execution_platform(name = "execution", ...), with remote_cache from [buildbuddy] cache and the host's CPU and OS. |
| execution.bzl | The rule: the prelude's ExecutionPlatformInfo with local_enabled = True, remote_enabled = False, and remote_cache_enabled/allow_cache_uploads from the flag. |
| README.md | This chapter. |
| CLAUDE.md | Keep it identical across repositories, for agents. |
← Previous: Chapter 29, toolchains/ · Up: jevsnes