Google’s I/O event is just around the corner and Facebook has come up with a very positive development at the right time and on Tuesday, May 14th the popular social networking site announced that it has developed a brand new Android build system known as ‘Buck.’ Although, Buck is just a working prototype, it is certainly great news for Android developers. The announcement was made by Michael Bolin through a post on the social network in which he had mentioned the whole story about how they “build Android apps at Facebook.” Below is the official post for your eyes:
“In 2012, we made the transition from WebView to native in the Facebook app for Android. In the past year, both the number of engineers at Facebook writing Java code for Android and the number of lines of Java code in our Android repository exploded. We quickly discovered that the standard set of Android build tools was not keeping up with our growth.
In particular, we noticed that building with Ant was slow and using Android library projects to modularize our code was a heavyweight operation. We quickly found ourselves drowning in a sea of duplicate AndroidManifest.xml and build.xml files, coupled with unnecessary res/directories. There was so much boilerplate when introducing a new module that engineers preferred to do the wrong thing, bloating existing modules with new code rather than attempting to navigate the complexity of creating a new module.
This had to stop.
At the end of Camp Hack-a-Thona (the name of our annual three day hackathon in the summer), I had a working prototype for Buck, a new Android build system. By the end of August, I introduced Buck as the build tool for our Android apps, and we deleted all of the build.xml files in our repository a couple of weeks later. It took less time to download Buck’s source code, build it from scratch, and then build the Android app with Buck than it took to build the Android app with Ant. From Day 1, Buck was twice as fast as Ant, cutting Facebook for Android app build times down from 3:40 to 1:30.
Buck has enabled us to scale our repository, as modules are defined by simple, declarative build rules, so the overhead in creating one is negligible. Today we have the equivalent of over 400 Android library projects in our repository (but only 51 AndroidManifest.xml files and 141 res/ directories), which would be unthinkable using Ant. Because all four of our Android apps (Facebook for Android, Messenger, and Pages Manager) are built from one codebase with a single, unified directory of Java source code, code reuse is straightforward. This fine-grained design also makes it easier to create small, sample applications for testing individual features of an app. These sample apps can be built much more quickly than the full-blown Facebook for Android app, which helps our developers iterate faster.
The crowd at Mobile DevCon NYC convinced me that we should not keep this tool to ourselves and that it was time to open-source Buck. Watch the video here.
We are extremely excited to share Buck with the Android development community. You can check out the code from GitHub as well as explore the documentation. We hope that you find Buck as helpful in scaling and speeding up your Android development as we have.”
Source: Facebook, 9to5Google