In Android O framework code, we see both Android.bp and Android.mk files. What is the need for both files? As per documentation .bp files are used for soong build system. When we do a build which file will be executed? .mk or .bp?
Android now uses the Soong build system for simpler test configuration. Soong uses Blueprint or . bp files, which are JSON-like simple declarative descriptions of modules to build. This format replaces the Make-based system used in previous releases.
Comments. Android. bp files can contain C-style multiline /* */ and C++ style single-line // comments.
The Android build system compiles app resources and source code, and packages them into APKs or Android App Bundles that you can test, deploy, sign, and distribute.
Soong is a build system for Android, intended as a replacement for the old make-based build system. Soong reads Android.bp
files, which define modules in a Bazel-like syntax.
Soong itself is written in Go on top of the Blueprint framework, which in turn uses Ninja as a back-end. Ninja is designed for high efficiency, especially for incremental builds.
Because Android is a large project, the move to Soong/Android.bp
will take some time. During the transitionary period, both formats are supported, with Soong for Android.bp
, and Kati for Android.mk
. A standard build will run both. Modules in Android.mk
files can depend on modules in Android.bp
files, but not the other way.
An important difference of Android.bp
is the absence of explicit if-statements to increase performance. Whereas Android.mk
files can contain ifeq
checks over arbitrary environment variables, the Android.bp
format only allows to differentiate pre-defined cases such as processor architecture or debug/release builds (reference). Custom case distinctions have to be defined separately in Go (reference).
Because of the design differences, automatic conversion of Android.mk
to Android.bp
is not feasible,
though there is a tool called androidmk that can translate simple
Android.mk
files (e.g. no if-statements) to Android.bp
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With