By: Jack Dai, Howard Ho, Loc Dinh, Stepan Goncharov, Ted Tenedorio, and Thomas Bao
Overview
The article discusses Airbnb's migration of its JVM monorepo from Gradle to Bazel, detailing the motivations, process, and outcomes of this significant transition. Key improvements include faster build times and enhanced reliability, achieved through Bazel's unique features.
What You'll Learn
1
How to leverage Bazel for faster local builds and tests
2
Why Bazel's hermeticity improves build reliability
3
How to implement automated build file generation for Bazel
Prerequisites & Requirements
- Understanding of build systems like Gradle and Bazel
- Familiarity with Java, Kotlin, and Scala programming languages
Key Questions Answered
What were the main advantages of migrating to Bazel?
The migration to Bazel provided significant advantages, including a build CSAT improvement from 38% to 68%, 3-5x faster local build and test times, and 2-3x faster IntelliJ syncs. These benefits stem from Bazel's speed, reliability, and shared infrastructure capabilities.
How did Airbnb ensure a smooth transition from Gradle to Bazel?
Airbnb ensured a smooth transition by allowing Bazel to coexist with Gradle during the migration. This approach minimized disruption for developers, enabling them to opt into using Bazel while still having access to Gradle until they were comfortable with the new system.
What challenges did Airbnb face with third-party library versions during migration?
Airbnb encountered issues with multiple versions of third-party libraries during the migration. To address this, they built tooling to generate multiple maven_install rules and implemented a custom aspect to resolve conflicts at the target level, ensuring compatibility across different library versions.
What were the key learnings from the migration process?
Key learnings from the migration included the importance of customer partnerships with pilot teams, the dangers of premature optimization, and the necessity of maintaining a balance between migration and optimization to avoid complications and delays.
Key Statistics & Figures
Build CSAT improvement
38% → 68%
This metric reflects the increased satisfaction with the build system post-migration.
Local build and test time improvement
3–5x faster
This improvement highlights the efficiency gains achieved through Bazel's capabilities.
IntelliJ sync speed improvement
2–3x faster
Faster sync times contribute to a more efficient development workflow.
Deployment speed improvement
2–3x faster
This improvement indicates enhanced efficiency in deploying to development environments.
Technologies & Tools
Some links below are affiliate links. We may earn a commission if you make a purchase.
Build System
Bazel
Used for building and managing dependencies in Airbnb's JVM monorepo.
Build System
Gradle
Previous build system used before migrating to Bazel.
Programming Language
Java
Primary language used in the monorepo.
Programming Language
Kotlin
Secondary language used in the monorepo.
Programming Language
Scala
Another language utilized in the monorepo.
Key Actionable Insights
1Implementing Bazel can significantly enhance build performance and reliability.By migrating to Bazel, teams can achieve faster build times and improved consistency in build environments, which is crucial for large codebases and teams.
2Co-existing build systems can ease the transition for developers.Allowing Bazel to run alongside Gradle helped developers adapt gradually, reducing resistance to change and minimizing disruption during the migration.
3Automated build file generation can streamline the migration process.Investing in tools that automate build file generation reduces manual overhead and helps maintain consistency across builds, making it easier to manage complex projects.
Common Pitfalls
1
Premature optimization can hinder migration progress.
Focusing on optimizing builds before completing the migration can complicate the process and delay benefits. It's crucial to prioritize migration first and optimize later.
2
Maintaining multiple build graphs can lead to increased complexity.
Having both Gradle and Bazel build graphs requires careful management to avoid confusion and errors, which can slow down development if not handled properly.
Related Concepts
Build Systems
Dependency Management
Continuous Integration/Continuous Deployment (ci/Cd)