Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How Open Source Powers Facebook on Android

How Open Source Powers Facebook on Android

The Facebook application on Android is a terrifically complicated beast, compiled from a large codebase developed by hundreds of software engineers. Despite this, a new alpha release that we’re pretty sure is solid is pushed three times a week. We’d not be able to go this fast, or scale our development team this effectively, without using large amounts of OSS.

In this talk, I’ll discuss the Open Source tools that help us build Facebook for Android, how we contribute technology to OSS, and how we do our best to be good citizens in the broader OSS world. I’ll do this by looking at the full life cycle of a release, going from how we organize our git repo, do code reviews in phabricator, through building using tools such as Buck, to how we’ve improved the quality of our releases using OSS testing tools such as Selendroid.

Simon Stewart

July 23, 2014
Tweet

More Decks by Simon Stewart

Other Decks in Programming

Transcript

  1. Facebook and OSS Over 200 repositories on GitHub 13k commits

    in the first 6 months of 2014 9.9M lines of code React, Shimmer, Pop, KVOController, HHVM, Hack, Presto, Warp, Haxl, and so many more…. ! Personal Story: Almost every line of code I’ve written at Facebook has been Open Sourced.
  2. The Things You May Already Know Facebook on Android is

    a native application Facebook on Android is worked on by 100s of engineers Facebook on Android is released every 4 weeks Facebook on mobile is used by 1 Billion Monthly Active Users
  3. Buck Smarts 1 Build rule knows all of the inputs

    that can affect its output 2 Changes to dx and proguard for faster compilation 3 Java ABI smarts 4 Android resource smarts 5 Daemon to watch file changes and kick off builds
  4. Android’s Evolution Gingerbread Larger displays, WebM support, better native code

    development Honeycomb New “Look and Feel”, Action and System bars introduced, hardware acceleration, multicore support, tweaks to SD Card access Ice Cream Sandwich UI refresh, more hardware acceleration JellyBean “Project Butter”, lock screen improvements, RTL languages now supported KitKat UI refresh, Chromium WebViews, API for messaging and storage “L” ART enabled by default, “Material Design”
  5. Rebound public SpringExample() {
 ...
 springSystem = new SpringSystem();
 spring

    = springSystem
 .createSpring()
 .setSpringConfigConfig(DEFAULT_TRANSITION_SPRING)
 .addListener(transitionSpringListener);
 }
 public void toggleSpring() {
 double value = spring.getEndValue();
 spring.setEndValue(value == 0 ? 1 : 0);
 }
  6. Rebound private class TransitionSpringListener extends SimpleSpringListener { 
 @Override
 public

    void onSpringUpdate(Spring spring) {
 // map the spring function to desired view properties
 float value = (float) spring.getValue();
 float scale = SpringUtil.mapValueFromRangeToRange(value, 0, 1, 0.75, 1);
 
 // update the views
 photoView.setScaleX(scale);
 photoView.setScaleY(scale);
 } 
 }
  7. Source Control ▪ A single tree ▪ Hundreds of thousands

    of files ▪ Millions of lines ▪ > 2 commits/day ▪ Original source control not scaling ▪ Moving to Mercurial ▪ Easy to extend
  8. Mercurial Contributions ▪Contributed >1000 patches ▪Hosted the past 2 Mercurial

    sprints ▪Open Sourced ▪ hgwatchman ▪ remotefilelog
  9. Large Repos Are Slow ▪Lots of commits a day ▪

    Pulls are slow ▪ Checkouts are slow ▪Years of history ▪ Clones are slow ▪ Requires lots of disk space ▪Impacts developers and build infrastructure
  10. Build 
 Slave COMMANDS Build 
 Slave Build Master COMMANDS

    STATUS Repository • Subversion • Mercurial • Bazaar • Darcs • GIT • CVS CHANGES POLL Notifiers • Email • Web Status • IRC • Status Client Continuous Builds: Buildbot
  11. Android Release Process 4 weeks of development 4 weeks of

    development 3.5 weeks of stabilization RC Master Release branch