从Buck迁移到Bazel的iOS构建系统
By: Qing Yang, Andy Bartholomew
At Airbnb, we are committed to providing the best experience for our engineers. To offer a cohesive and efficient build experience across all platforms, we’ve decided to adopt Bazel as our build system. Bazel is a robust build system widely utilized in the industry. In alignment with Airbnb’s tech initiatives, both our backend and frontend teams initiated the migration process to Bazel. In the first Bazel post, we start with our iOS development migrating from Buck to Bazel.
在Airbnb,我们致力于为工程师提供最好的体验。为了在所有平台上提供一致高效的构建体验,我们决定采用Bazel作为我们的构建系统。Bazel是一个在行业中广泛使用的强大构建系统。与Airbnb的技术倡议保持一致,我们的后端和前端团队都开始了迁移过程,从Buck迁移到Bazel。在第一篇Bazel文章中,我们从iOS开发开始迁移。
We’ll describe the migration approach which involved two main pieces of work: migrating the build configuration and migrating the IDE integration. Such a transition can potentially disrupt engineers’ workflows or hinder the development of new features, but we were able to successfully migrate them without disrupting the day-to-day developer experience. Our aim is to help others who are currently undergoing or planning a similar migration.
我们将描述迁移方法,其中包括两个主要工作:迁移构建配置和迁移IDE集成。这样的转变可能会干扰工程师的工作流程或阻碍新功能的开发,但我们成功地进行了迁移,而不会干扰日常开发者体验。我们的目标是帮助那些正在进行或计划进行类似迁移的人。
Migrating the Build Configuration
迁移构建配置
When it comes to build configuration, Buck and Bazel exhibit significant similarities. They share a comparable directory structure, employ similar command line invocation, and, importantly, both utilize the Starlark language. These similarities present an opportunity for configuration sharing between the two build systems. This would allow us to reuse our Buck configurations in Bazel, while avoiding slowdowns during the “overlap” phase when we were in the process of migrating and still actively using both build systems.
在构建配置方面,Buck和Bazel有很多相似之处。它们共享相似的目录结构,使用类似的命令行调用,并且最重要的是,它们都使用Starlark语言。这些相似之处为两个构建系统之间的配置共享提供了机会。这样我们就可以在Bazel中重用我们的Buck配置,同时避免在迁移过程中和同时使用两个构建系统时出现的减速问题。
Unfortunately, there’s a major problem: Buck and Bazel empl...