Bazel: Starlark and Skyframe

2025/01/15

BUILDbazeldeep-dive

“Efficient Starlark coding begins with an understanding of its operational semantics and how they interact with Bazel’s build system.”

The Build Process in Skyframe

Skyframe is Bazel’s incremental computation framework that enables continuous analysis and execution. It manages dependencies and efficiently determines what work needs to be done.

Skyframe divides the Bazel build process into two main phases:

  1. Analysis Phase
  2. Execution Phase

1. Target Pattern Parsing

When you run a command like bazel build //foo:all, Bazel first parses the target pattern to determine the set of build targets. This outputs the TargetPatternParsingResult.

2. Analysis Phase

Bazel evaluates ActionLookupKeys to produce ActionLookupValues:

This builds an AnalysisResult that describes what needs to be executed.

3. Execution Phase

Bazel evaluates CompletionKeys to produce CompletionValues:

How Skyframe Makes Bazel Efficient

Key Takeaways