Overview
Uber Engineering's transition to a monolithic repository (monorepo) for its iOS applications significantly improved development efficiency and collaboration among its growing team of mobile engineers. The article details the challenges faced with CocoaPods and the benefits realized after adopting Buck as the build tool for their monorepo.
What You'll Learn
1
How to transition from multiple repositories to a monolithic repository
2
Why using Buck improves build times and CI efficiency
3
How to manage dependencies effectively in a monorepo setup
Prerequisites & Requirements
- Understanding of monorepo concepts and benefits
- Familiarity with Buck as a build tool(optional)
Key Questions Answered
What prompted Uber to switch to a monorepo for iOS development?
Uber switched to a monorepo to address the inefficiencies and complexities of managing multiple repositories and dependencies with CocoaPods. The growing size of their engineering team and the increasing complexity of their applications necessitated a more streamlined approach to dependency management and build processes.
How does Buck improve build performance for Uber's iOS applications?
Buck enhances build performance by intelligently caching built artifacts and only rebuilding what has changed. This allows for faster build times, particularly in a CI environment, where previously lengthy build processes under xcodebuild could take hours due to unstable caches.
What are the main challenges faced before adopting the monorepo?
Before adopting the monorepo, Uber faced significant challenges with CocoaPods, including slow dependency resolution times that escalated from under ten seconds to several minutes, leading to wasted developer time and frustration as the number of modules and interdependencies grew.
What is the structure of Uber's new monorepo?
Uber's monorepo is organized into a directory structure that includes separate folders for applications (like iphone-driver, iphone-eats, and iphone-rider), libraries (such as analytics), and vendor dependencies. This structure facilitates better organization and management of their codebase.
Key Statistics & Figures
Number of cities Uber services
550
Uber has expanded to service over 550 cities worldwide.
Number of mobile engineers at Uber
hundreds
Uber's mobile team grew from just over a dozen engineers in 2014 to hundreds today.
Modules in the codebase
over forty
The number of modules increased from five to over forty as the team scaled.
Master success rate after Submit Queue implementation
99%
The introduction of the Submit Queue system improved the success rate of the master branch to 99%.
Technologies & Tools
Build Tool
Buck
Used for building code, running unit tests, and distributing build artifacts efficiently in the monorepo.
Dependency Manager
Cocoapods
Previously used for managing dependencies before transitioning to the monorepo.
Key Actionable Insights
1Transitioning to a monorepo can streamline dependency management and reduce build times.By centralizing code into a single repository, teams can make breaking changes across modules in one commit, simplifying the development process and enhancing collaboration.
2Utilizing a build tool like Buck can significantly improve CI efficiency.Buck's caching capabilities allow for faster builds by avoiding unnecessary recompilation, which is especially beneficial for large teams with frequent code changes.
3Maintaining a clear directory structure in a monorepo is crucial for organization.A well-organized monorepo helps teams navigate the codebase easily and ensures that dependencies are managed effectively, reducing the likelihood of conflicts.
Common Pitfalls
1
Failing to maintain synchronization between module dependencies can lead to integration issues.
When modules are not kept in sync, changes in one module can break others, leading to significant delays and frustrations during development.
2
Over-reliance on versioning can slow down development.
With a monorepo, the focus shifts from managing versions to managing changes, allowing for faster iterations and less overhead in dependency management.
Related Concepts
Monorepo Architecture
Dependency Management Strategies
Build Optimization Techniques