Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Bazel Will Be the New Build System for the Android Open Source Project

Bazel Will Be the New Build System for the Android Open Source Project

This item in japanese

Google has announced that the Android Open Source Project (AOSP), which provides the foundations for all Android-labelled OSes available in the market and more derivative OSes, will transition to use Bazel as its new build tool.

According to Google, Bazel provides the best guarantee to build the Android platform correctly and quickly. Although the migration has already started with the first Bazel-related contributions to the AOSP repository, the whole process is actually slated to take place over the next few Android releases to ensure a smooth transition for all parties involved.

There will be no immediate impact to the Android Platform build workflow or the existing supported Android Platform Build tools in 2020 or 2021.

Once the migration is completed, Bazel will replace a number of tools that are actually used to build AOSP. For example, Blueprint, which is a meta-build system using a custom syntax to describe modules and able to output a Ninja manifest, will be replaced by Starlark, Bazel's Python 3-inspired internal configuration language. To put this in perspective, Starlark powers Bazel's BUILD files as well as it macro language that enables extending it to support new languages and compilers. Similarly, the Ninja build system will be replaced by Bazel's execution phase; atest will be replaced by bazel test, and so on.

This is not the first time Android transition to a new build system. In fact, Android used make as its official build system until Android 7. At that point, though, Android had already reached a scale that made make slow, error prone, unscalable, and difficult to test, Google says. As a consequence of that, Android 7 introduced Soong to speed things up and phase out make, which has currently no place in Android builds.

For the transition to Bazel, Google lists a number of key advantages, such as increasing configuration flexibility, enabling hermetic builds, reduce build complexity, and significantly improving build time and experience. It is too early to be able to provide any figures about those improvements, but it is worth noting that according to a Reddit commenter Bazel's strictness should make it better at partial computations and optimizations, with benefits for builds and even more so for rebuilds. Other commenters hinted at a notable increase in build complexity going from Android 10 to Android 11 as a possible rationale for the move.

While Google aims to make this transitions as seamless as possible, this should not hide the fact that for the next few Android releases developers will foreseeably need to use a mix of different build tools, including Soongs, Ninja, and Bazel. This will not necessarily make things easier but the hope is this effort will pay out in the medium term.

AOSP is used not only in Google-certified "Android" phones, but in a myriad of other devices, including game consoles, digital cameras, portable media players, PCs and others. Google has been long criticized for its strategy aiming to regain control over the Android experience and thus moving parts of it towards a more closed development model.

Rate this Article