Articles tagged "bazel"

How GitHub's upgrade broke Bazel builds
Published on 2023-02-08
Last week, GitHub upgraded the version of Git they use to produce repository archives. Upgrading Git regularly is a generally good idea, but this change broke a huge number of Bazel projects. What happened? Most Bazel projects fetch at least some of their dependencies using http_archive rules in their WORKSPACE files like this:
Tagged: bazel dependency-management

Go Editor Support in Bazel Workspaces
Published on 2022-11-21, edited on 2022-11-26
The story of how Go editor support was implemented in Bazel workspaces. This article is the script I wrote for that talk, together with my slides.
Tagged: bazel editors go

Leaving Google
Published on 2021-10-22
Last Friday was my last day at Google. This article is a reflection on the last seven years of my life, thinking about what was important and what I'll do differently in the future.
Tagged: bazel career go

Organizing Bazel WORKSPACE files
Published on 2020-09-13
WORKSPACE has several functions, but its main purpose is to declare external dependencies using repository rules. In this article, I'll explain how WORKSPACE is evaluated, then I'll give some guidelines for organizing WORKSPACE files to avoid confusion and ambiguity.
Tagged: bazel

Writing Bazel rules: platforms and toolchains
Published on 2019-12-07, edited on 2020-02-01
Bazel can isolate a build from the host system using platforms and toolchains. In this article, we'll walk through the process of configuring our simple set of rules to use toolchains. When this is done, the rules will be almost completely independent from the host system.
Tagged: bazel go

Writing Bazel rules: repository rules
Published on 2019-11-09, edited on 2020-02-01
In this article, we'll define a repository rule that downloads a Go toolchain and generates a custom build file. This lets us avoid depending on the host toolchain, which aids reproducibility and make remote execution possible.
Tagged: bazel go

Writing Bazel rules: moving logic to execution
Published on 2018-12-26, edited on 2020-02-01
Bazel's execution phase has many advantages, and you should prefer to implement rule logic there if at all possible. Execution code has I/O access to source files. It can be written in any language. Work can be distributed across many machines, so it can be faster for everyone.
Tagged: bazel go

Writing Bazel rules: data and runfiles
Published on 2018-10-02, edited on 2020-02-01
Bazel has a neat feature that can simplify a lot of work with tests and executables: the ability to make data files available at run-time using `data` attributes. This is useful for all kinds of things such as plugins, configuration files, certificates and keys, and resources.
Tagged: bazel go

Writing Bazel rules: library rule, depsets, providers
Published on 2018-08-15, edited on 2020-02-01
We'll define a go_library rule, which can be depended on by other libraries and binaries. We'll also cover structs, providers, and depsets. They are data structures used to pass information between rules, and we'll need them to gather information about dependencies.
Tagged: bazel go

Writing Bazel rules: simple binary rule
Published on 2018-07-31, edited on 2023-09-10
Bazel lets you write rules in Starlark to support new languages. This time, we'll cover writing a simple rule that compiles and links a Go binary from sources. Bazel rules are highly structured, and learning this structure takes time. However, this structure helps you avoid introducing unnecessary complication in complex builds.
Tagged: bazel go

Migrating to Bazel: Part 2
Published on 2017-03-16
Previously, I focused mostly on getting Python and C++ code to build. This time, I'll talk about adding support for building Gypsum packages. I'll also give a bit more background on the Skylark language and how Bazel deals with extensions.
Tagged: bazel gypsum

Migrating to Bazel: Part 1
Published on 2017-02-21
Bazel is the open source version of Google's internal build system. Gypsum is a cross-language project, and wanted something that could easily be extended to work with Gypsum itself. Bazel was a natural choice.
Tagged: bazel gypsum