The Build Time Crisis That Almost Broke Meta's Android Team
For years, Meta's Android engineers lived by Buck2's small module philosophy.
Keep modules tiny, let the build system handle parallelization, and everyone stays happy. But reality has a way of messing with perfect plans.Legacy code grew. Teams merged. What started as elegant 5-file modules turned into 50-file monsters that were choking the build pipeline. "Some critical modules now build up to 3x faster," Meta's Iveta Kovalenko wrote in today's engineering blog post.
That's not optimization
- that's salvation for developers stuck waiting 20+ minutes for builds.### The Technical Deep Dive: Why This Actually MattersHere's where it gets interesting for anyone dealing with large Kotlin codebases.
Meta's team had to solve the same problems every Android shop hits when they scale up:The Shading Nightmare:
Kotlin's Build Tools API expects the shaded compiler (kotlin-compiler-embeddable), but Meta's toolchain used the unshaded version. Their first hack? Strip the org.jetbrains.kotlin prefix with jarjar and rebuild the library. Not pretty, but it worked. I've been down this same rabbit hole trying to integrate Kotlin incremental compilation with Gradle enterprise builds. You spend three days wrestling with compiler version conflicts, then discover the solution is literally renaming package prefixes with a 15-year-old Java tool. Software development is beautiful.Cache Relocation Hell: Buck2's distributed builds mean your compilation cache better work from anyone's machine, anywhere.
Meta had to explicitly configure root project and build directories to keep the incremental compiler from losing its mind across different environments.The Plugin Problem: Meta's custom compiler plugins weren't designed for incremental compilation.
When Kotlin only recompiles changed files, plugins that expect the full codebase fall apart. Meta's solution: make their plugins accumulate results across multiple compilation rounds instead of replacing them.### Why Developers Should Actually Care About ThisThis isn't just Meta solving Meta problems.
Every Android team hits the same walls:
- Legacy module bloat:
That "quick feature" from 2019 is now a 200-file module taking 15 minutes to compile
- Build cache misses: Change one file, wait for half the codebase to recompile
- CI/CD bottlenecks: Pull requests sit in queue while builds crawl through unchanged code
Meta's approach shows there's a path forward that doesn't involve rewriting your entire build system. The Kotlin incremental compiler has been sitting there waiting
- it just needed someone to do the integration work properly.### The Performance Numbers Don't LieA/B testing across Meta's codebase showed 30% improvement for the average developer. But here's the kicker
- modules without annotation processing nearly doubled their speed. That's the difference between grabbing coffee and grabbing lunch while your build runs.The integration is rolling out internally now, with plans to bring it to Buck2's open source version soon. For teams stuck with slow Kotlin builds, this could be the breakthrough that makes large-scale Android development bearable again.Meta's Buck2 team proved that incremental compilation isn't just a nice-to-have feature
- it's the difference between productive developers and developers who spend half their day waiting for builds.