在大规模Web开发中采用Bazel

A person making pesto sauce with a mortar and pestle

By: Brie Bunge and Sharmila Jesupaul

作者: Brie BungeSharmila Jesupaul

Introduction

介绍

At Airbnb, we’ve recently adopted Bazel — Google’s open source build tool–as our universal build system across backend, web, and iOS platforms. This post will cover our experience adopting Bazel for Airbnb’s large-scale (over 11 million lines of code) web monorepo. We’ll share how we prepared the code base, the principles that guided the migration, and the process of migrating selected CI jobs. Our goal is to share information that would have been valuable to us when we embarked on this journey and to contribute to the growing discussion around Bazel for web development.

在 Airbnb,我们最近采用了 Bazel —— Google 的开源构建工具,作为我们在后端、网页和 iOS 平台上的通用构建系统。这篇文章将介绍我们在 Airbnb 大规模(超过 1100 万行代码)网页 monorepo 中采用 Bazel 的经验。我们将分享我们如何准备代码库、指导迁移的原则以及迁移选定 CI 任务的过程。我们的目标是分享在我们开始这段旅程时对我们有价值的信息,并为围绕 Bazel 的网页开发讨论做出贡献。

Why did we do this?

为什么我们要这样做?

Historically, we wrote bespoke build scripts and caching logic for various continuous integration (CI) jobs that proved challenging to maintain and consistently reached scaling limits as the repo grew. For example, our linter, ESLint, and TypeScript’s type checking did not support multi-threaded concurrency out-of-the-box. We extended our unit testing tool, Jest, to be the runner for these tools because it had an API to leverage multiple workers.

历史上,我们为各种持续集成(CI)任务编写了定制的构建脚本和缓存逻辑,这些脚本和逻辑在维护上非常具有挑战性,并且随着代码库的增长,始终达到了扩展的极限。例如,我们的 linter,ESLint,和 TypeScript 的类型检查不支持多线程并发。我们扩展了我们的单元测试工具,Jest,使其成为这些工具的运行器,因为它有一个可以利用多个工作线程的 API。

It was not sustainable to continually create workarounds to overcome the inefficiencies of our tooling which did not support concurrency and we were incurring a long-run maintenance cost. To tackle these challenges and to best support our growing codebase, we found that Bazel’s sophistication, parallelism, caching, and performance fulfilled our needs.

不断创建解决方法来克服我们工具的低效性并不具有可持续性,因为这些工具不支持并发,我们因此承担了长期的维护成本。为了应对这些挑战并最好地支持我们不断增长的代码库,我们发现 Bazel 的复杂性、并行性、缓存和性能满足了我们的需求。

Additionally, Bazel is language ag...

开通本站会员,查看完整译文。

首页 - Wiki
Copyright © 2011-2024 iteam. Current version is 2.137.1. UTC+08:00, 2024-11-24 09:20
浙ICP备14020137号-1 $访客地图$