In traditional industries such as automobile or aerospace, engineers first design the products and the manufacturing facilities produce the cars or aircrafts according to the design. In software development, a build system is similar to the manufacturing facilities that take the source code and turn it into services, tools, and applications. Besides facilitating software compilation and linking, build systems often need to generate code, download external packages, or build different installation packages. Some build systems can also manage tools, such as compilers, linkers and code generators, making the build artifacts less dependent on their local environments. When Uber started leveraging Go to develop our back-end services, we used the popular open source build system Make in combination with Go’s default build system go build.
Upon moving our Android and iOS projects at Uber to a more efficient monorepo model, the Go Developer Experience team made a similar move for Go projects and found that Make and go build no longer met our needs. We finally decided to use Bazel, which provides good support for the Go language and is strengthened by constant contributions from its active open source community.
With a significant portion of our tech stack developed in Go, Uber’s Go monorepo is likely one of the largest Go repositories run on Bazel. We noticed areas where we could improve and contribute to the Bazel ecosystem, enhancing the generation of Bazel rules and integrating Bazel with SubmitQueue, Uber’s system for making sure the master branch of the monorepo can always build and test successfully.
We hope our experience building a large repository with Bazel and our contributions to the open source Bazel ecosystem will help other engineering teams use Bazel to build their source code repositories.
Uber’s Go monorepo
Uber writes most of its back-end services and libraries in Go. Before we decided to build a Go monorepo, engineers at Uber developed these Go projects in many small and isolated repositories (some of which we’ve open sourced). We launched our Go monorepo in early 2018, and saw an immediate uptick in build efficiency among early adopter projects. As the Go monorepo matured, we moved more and more projects on to it and usage expanded rapidly, as depicted in Figures 1 and 2, below: