# Android Build System Concepts

This document provides high level explanations and mapping of the internal
build system components and concepts of the Android build system and Bazel,
and how components communicate with each other.

For implementation concepts, see:
https://android.googlesource.com/platform/build/bazel/+/refs/heads/master/docs/internal_concepts.md.

## High level components

This table provides a high level overview of the components in the current
Android Platform build system, and how each component maps to a concept in
Bazel.

|Android build system component|Description|Mapping to Bazel concepts|
|---|---|---|
|Kati|Make-compatible front-end. Encodes build logic in `.mk` scripts. Declares buildable units in `Android.mk`. Generates Ninja file directly.|Loading and analysis phase. Conceptually similar to `bazel build --nobuild`.|
|Blueprint|Build definition syntax. Build syntax parser. Internal data structures like Modules/Variations/Context/Scope. Ninja file generator.|Starlark.|
|Soong|Bazel-like front-end. Encodes build logic in Go. Declares build units in `Android.bp`, parsed by Blueprint. Uses Blueprint to generate Ninja file.  Generates a `.mk` file with prebuilt module stubs to Kati.|Loading and analysis phase. Conceptually similar to `bazel build --nobuild command`.|
|Ninja|Serialized command line action graph executor. Executes Ninja graph generated from Kati and Soong.|Bazel's execution phase.|
|atest|Test executor and orchestrator.|Conceptually similar to `bazel test` command.|
|Blueprint + Kati + Soong + Ninja + atest|The entire build pipeline for Android.|Conceptually similar to `bazel build` or `bazel test` commands.|
|`