Migrating to Bazel Modules (a.k.a. Bzlmod) - Repo Names, Macros, and Variables
The previous two posts in this series showed how to use runfiles mechanisms
and rules_pkg
mechanisms to avoid dealing with canonical repository names
under Bzlmod. However, one special case remains: when you need to depend on the
name of a repository directory, either at build time or runtime. This post
explains how to access canonical repository names in a portable way to solve
such problems. We'll use a macro when we can, and a custom Make
Variable when we can't, including when dealing with alias
targets.