Building large-scale iOS apps on Airbnb


Airbnb’s iOS team rose to the challenge of its growing code base and complexity for mobile apps by adopt new tools and processes, including modern building systems, module types and development applications.

The first hurdle the Airbnb team had to work around was Xcode’s slowness, especially when indexing files and build code, and its “lack of usability” for code release systems. :

Not only are Xcode project files difficult to examine in pull requests, but the incidence of merge conflicts and race conditions in these project files has increased with a larger team of engineers moving to large speed.

Xcode is very powerful and offers an unmatched level of integration with iOS and other Apple tools, but it lacks a few essential features for Airbnb engineers, such as a network cache for construction artifacts, a query interface for the build chart, and a way to add custom steps as dependencies.

To offer all these features to developers, Airbnb chose Facebook male, a construction system based on the same Lark star language used by Google’s Bazel. Buck allows you to generate Xcode workspaces from a declarative build graph, thus ensuring an optimal level of integration with the iOS development ecosystem. Instead of using the native Xcode build system, which is unable to take advantage of artifact caching, Buck Extended Airbnb it therefore generates Xcode projects that transparently invoke Buck for the build. This makes the build step 5-6 times faster when HTTP Buck Cache is enabled.

In addition to improving their infrastructure, Airbnb engineers designed a discovery-driven organizational structure for their codebase by organizing the modules into groups called types of modules. Each type of module has a set of visibility rules which define which dependencies are allowed between modules of that type.

For example, a module type is a characteristic, which is a UIViewController, which may include a child UIViewControllers but not the others characteristics. Characteristics can only communicate with each other by function interface, which is another type of module with wider visibility.

According to Airbnb engineers, module types act as a table of contents for their entire codebase and immediately convey their meaning.

A third innovation in Airbnb’s iOS infrastructure is Development applications, which are ephemeral on-demand Xcode workspaces for a single module and its dependencies.

The popularity and success of Android and iOS development apps stems from a simple axiom: reducing the scope of your IDE to just the files you edit tightens the development loop.

Development applications are built using a command line tool that uses Buck to find out which files are required to create a requested module. The tool also generates a container application that hosts the functionality and makes it executable. Most development apps can be built in under two minutes, according to Airbnb engineers.

This global approach, which led to the definition of nearly 1,500 modules, also made it possible to effectively strengthen code ownership and improve test coverage.

Airbnb’s approach to building iOS apps at scale involves a lot more than can be covered here, so don’t miss the original writing if you’re interested.

Source link


Comments are closed.