I was reading about the Android Testing Samples project and noticed that a "new" build tool named Bazel is being used for building Android projects:
Experimental Bazel Support
Some of these samples can be built with Bazel on Linux. These samples contain a
BUILD.bazel
file, which is similar to abuild.gradle
file. The external dependencies are defined in the top level WORKSPACE file.This is experimental feature. To run the tests, please install the latest version of Bazel (0.12.0 or later) by following the instructions on the Bazel website.
Then,
Update #1: Updated with accepted answer from farhana and thanks to Jin for the in depth details about the google build systems.
Update #2: Updated with google code labs for bazel android introduction.
I'm the author of the Bazel support in that repository, and I work on the Bazel Android rules team. farhana has written an amazing answer already, but I just want to add on a few points:
mobile-install
, which allows for fast and iterative development of Android apps. It builds your app, shards out native libs, dexes and resource files, and only pushes changed shards to the device to reduce build and deploy times. Read more about it here.Is it really good to have TWO build tools for Android?
There are more than just two: Buck & Pants are two other popular build systems for Android. Each build system has its pros and cons, and are designed and implemented to solve a particular set of requirements. For example, Bazel (and its surrounding ecosystem of tools) was born out of Google's gigantic monorepo, so it solves scalability issues really well.
Having the option to try out different approaches, IMO, is a good thing.
Does it mean that Android developer probably need to learn this new build tools in future?
Bazel is open source and has support in Android Studio via the Bazel plugin. If you think it looks interesting, feel free to try it out! We're still in early stages of adapting the Android rules to work in the open source world, so expect some features to be work-in-progress for the time being.
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