How bazelbuild/bazel works
Bazel is a cross-platform build and test system. The principal workflow starts with a user command, processes startup options and workspace context, then analyzes requested targets and executes only the necessary work, using incremental and local or distributed caching to produce build or test results. The README also documents multi-language rules, extensibility through Starlark, parallel execution, and scaling across repositories. The C++ launcher and Starlark entry points are evidenced in source; links among unsampled product stages reflect README-level capabilities, not inspected implementation calls.
Main entry points: main.cc Bazel launcher · build Dependency analysis · blaze.cc Build orchestration · BazelTestRunner.java JUnit test runner
Components 15
Command startup
- Bazel launcher
src/main/cpp/main.cc - Startup options
src/main/cpp/option_processor.cc - Workspace layout
src/main/cpp/workspace_layout.cc
Configuration and analysis
- Build orchestration
src/main/cpp/blaze.cc - Dependency analysis
src/main/java/com/google/devtools/build
Build execution
- Build caches
src/main/java/com/google/devtools/build - Parallel execution
src/main/java/com/google/devtools/build - Build outputs
src/main/java/com/google/devtools/build
Language and extensions
- Starlark syntax
src/main/java/net/starlark/java/syntax/Parser.java - Starlark evaluation
src/main/java/net/starlark/java/eval/Eval.java - Language rules
src/main/java/com/google/devtools/build
Testing and coverage
- JUnit test runner
src/java_tools/junitrunner/java/com/google/testing/junit/runner/BazelTestRunner.java - Coverage reporting
src/java_tools/junitrunner/java/com/google/testing/coverage/JacocoCoverageRunner.java - Test results
src/java_tools/junitrunner/java/com/google/testing/junit/runner/model/XmlResultWriter.java
Other components
- CLI user
Connections 15
- CLI user → Bazel launcher: runs command
README.md - Bazel launcher → Startup options: configures
src/main/cpp/main.cc - Bazel launcher → Workspace layout: creates context
src/main/cpp/main.cc - Bazel launcher → Build orchestration: dispatches
src/main/cpp/main.cc - Build orchestration → Dependency analysis: analyzes targets
README.md - Dependency analysis → Build caches: uses incrementality
README.md - Dependency analysis → Parallel execution: schedules work
README.md - Build caches → Parallel execution: serves cached work
README.md - Parallel execution → Build outputs: produces outputs
README.md - Starlark syntax → Starlark evaluation: feeds evaluation
README.md - Starlark evaluation → Language rules: enables extensions
README.md - Language rules → Dependency analysis: defines targets
README.md - Build orchestration → JUnit test runner: runs tests
README.md - JUnit test runner → Test results: writes results
README.md - JUnit test runner → Coverage reporting: collects coverage
README.md