Lines Matching +full:ninja +full:- +full:build

1 # Android Build System Concepts
4 build system components and concepts of the Android build system and Bazel,
10 Android Platform build system, and how each component maps to a concept in
13 |Android build system component|Description|Mapping to Bazel concepts|
14 |---|---|---|
15-compatible front-end. Encodes build logic in `.mk` scripts. Declares buildable units in `Android.…
16 |Blueprint|Build definition syntax. Build syntax parser. Internal data structures like Modules/Vari…
17-like front-end. Encodes build logic in Go. Declares build units in `Android.bp`, parsed by Bluepr…
18 |Ninja|Serialized command line action graph executor. Executes Ninja graph generated from Kati and …
20 |Blueprint + Kati + Soong + Ninja + atest|The entire build pipeline for Android.|Conceptually simil…
22-place by Kati)|No longer in use. Entire build system, replaced by the tools above.|Loading, analy…
23 |`Android.bp`|Build definition file for Soong.|`BUILD.bazel` or `BUILD`.|
24 |`Android.mk`|Build definition file for Kati.|`BUILD.bazel` or `BUILD`.|
29 * **“Kati-config” for the purpose of this document**
30 * Kati component to generate build actions in Ninja files (main.mk, Android.mk files)
31 * **“Kati-build” for the purpose of this document**
32 * Kati component to generate packaging actions in Ninja files (packaging.mk file)
33 * **“Kati-package” for the purpose of this document**
34 * Kati component to generate cleaning actions in Ninja files (cleanbuild.mk, CleanSpec.mk files)
35 * **"Kati-cleanspec" for the purpose of this document**
36 * **soong\_build** (and **Blueprint**) component to generate build actions (Android.bp, Blueprints …
37 * **Ninja** component to execute actions from Kati-build, Kati-package and soong\_build
38 * **Bazel** as the next generation of the entire build system, starting as a Ninja executor drop-in…
41 The current build system architecture primarily uses **files** as the medium
42 for inter-process communication (IPC), with one known case of unix socket
44 …//cs.android.com/android/platform/superproject/+/master:build/soong/ui/build/paths/logs.go;l=112-1…
45 and a fifo between Ninja and soong_ui for the Protobuf stream for build
50 The build system components run in the following order, orchestrated by soong\_ui:
52 1. soong\_ui bootstraps itself with microfactory (`go build` replacement) and launches.
55 1. soong\_ui runs Kati-config with
56 …nt](https://cs.android.com/android/platform/superproject/+/master:build/soong/ui/build/dumpvars.go…
57 1. soong\_ui orchestrates 3 Blueprint/Soong phases to generate the main out/soong/build.ninja file:
59 1. Minibootstrap phase uses Blueprint/Microfactory to build itself
62 1. Bootstrap phase runs Ninja on a build.ninja file that runs minibp to
65 1. Primary phase runs Ninja on a build.ninja file that runs soong_build
66 to generate the final out/soong/build.ninja file.
68 out/soong/build.ninja, which can be skipped with the `--skip-soong-tests`
70 1. soong\_ui runs Kati-cleanspec with
71 …nt](https://cs.android.com/android/platform/superproject/+/master:build/soong/ui/build/kati.go;l=3…
72 1. soong\_ui runs Kati-build to generate a Ninja file, with
73 …t.](https://cs.android.com/android/platform/superproject/+/master:build/soong/ui/build/kati.go;l=2…
74 1. soong\_ui runs Kati-package to generate a Ninja file, with
75 …mk](https://cs.android.com/android/platform/superproject/+/master:build/soong/ui/build/kati.go;l=3…
77 1. soong\_ui generates a Ninja file to combine above Ninja files.
78 1. soong\_ui runs either Ninja or Bazel to execute the build, with the
79 combined Ninja file as entry point.
81 soong\_ui has a --skip-make flag that will skip Kati-config, Kati cleanspec,
82 Kati-build and Kati-package, used for Soong-only builds in NDK and some
87 soong\_ui is primarily responsible for orchestrating the build, cleaning the
88 build environment, and running auxiliary tools. These tools (minibp,
94 tools. For example, it generates Android.mk.list for Kati-build,
95 AndroidProducts.mk.list for Kati-config, and Android.bp.list for
100 tools with checked-in prebuilts, and uses path\_interposer to intercept calls
101 and error out whenever non-allowlisted tools are used (see out/.path for
104 soong\_ui generates a Kati suffix to ensure that Kati-generated files are
107 soong\_ui calls Soong and Kati to generate Ninja files, and eventually
108 creates another Ninja file (out/combined-<product>.ninja) to combine the
109 others, and executes either Ninja or Bazel to complete the build.
111 soong\_ui sets up the sandbox and environment for the Ninja/Bazel process.
113 ## Kati-config
115 As a product configuration tool, soong\_ui runs Kati-config in
116 **[--dumpvars-mode](https://cs.android.com/android/platform/superproject/+/master:build/soong/cmd/s…
118 with build/make/core/config.mk as the entry point. During this phase,
119 Kati-config eventually evaluates[
120 soong\_config.mk](https://cs.android.com/android/platform/superproject/+/master:build/make/core/soo…
122 …s://cs.android.com/android/platform/superproject/+/master:build/make/core/soong_config.mk;l=16-222…
123 This way, Kati-config can communicate product configuration to soong\_build,
125 stores them into an in-memory Config object.
128 [dexpreopt](https://cs.android.com/android/platform/superproject/+/master:build/soong/java/dexpreop…
130 …/cs.android.com/android/platform/superproject/+/master:build/make/core/dex_preopt_config.mk;l=71-1…
132 …://cs.android.com/android/platform/superproject/+/master:build/soong/dexpreopt/config.go;l=175-196…
133 in a similar way as Kati-config evaluates dex\_preopt\_config.mk included in
136 soong\_ui sets up a **KatiReader** to monitor Kati-config’s stdout/err for UI
142 of mutators, and generate out/soong/build.ninja file.
144 soong\_build communicates with Kati-build by generating Make Vars and running
146 (out/soong/{Android, late, make\_vars}-<product>.mk).
148 * Android-<product>.mk contains Soong modules as Make modules so Make
150 * make\_vars-<product>.mk contains Make variables for Kati-build, exported
154 * late-<product>.mk contains Make variables that are not read while Kati-build
163 ## Kati-build / Kati-package
165 Kati-build’s primary role is to evaluate all Android.mk files with
166 build/make/core/main.mk as entry point, and generate
167 out/build-<product>.ninja. It also generates cleanspec.ninja for the
170 Kati-build’s primary role is to evaluate all packaging .mk files with
171 build/make/packaging/main.mk as entry point, including
172 build/make/packaging/distdir.mk for dist-for-goals calls, and generate
173 out/package-<product>.ninja.
175 Kati-build/Kati-package’s stdout/stderr is monitored by soong\_ui’s
178 As Kati-build/Kati-package generates Ninja files, they also generate
179 out/ninja-<product>.sh and out/env-<product>.sh. These scripts are
180 wrappers for soong\_ui to execute Ninja with the correct Ninja files, in a
183 ## Ninja section in Android Build System Concepts
185 As Ninja executes files from Kati-build, Kati-package, soong\_build and other
188 interface for Ninja progress is consistent with the rest of the build.
192 As more Soong modules are converted to BUILD files, soong\_build serializes
193 information about converted modules to BUILD/bzl files on disk. soong\_build