You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for %bazel.version*% variables in bazelrc imports
Follows the proposal:
#24043 (comment) by
mattyclarkson@ to add support for the following variables when importing
additional bazelrc files:
- %bazel.version%
- %bazel.version.major%
- %bazel.version.minor%
- %bazel.version.patch%
Eg. If your bazel version was 8.4.2 and your .bazelrc had the following:
> try-import %bazel.version%.bazelrc
> import %bazel.version.major%.%bazel.version.minor%-%bazel.version.patch%.bazelrc
> try-import %bazel.version.major%.bazelrc
It would be evaluated to:
> try-import 8.4.2.bazelrc
> import 8.4-2.bazelrc
> try-import 8.bazelrc
# Implementation details:
## Build label extraction:
Before: The build label was extracted out only when calling `bazel --version`
and when running in client server mode.
After: Now we always extract the the build label out early in the start of main
## Piping of build label:
The build label is stored in the OptionProcessor so that it can be passed to
`RcFile` when parsing occurs.
## Parsing and mapping of variables:
The build label is parsed during `RcFile::ParseFile` into its constituent parts
(major, minor, patch). This occurs EACH TIME an import statement is found in a
.rc file. This is wasteful, but the logic is simple enough that it shouldn't
matter. Interpolation of the build label happens first, followed by
`%workspace%`.
Fixes: #24043
0 commit comments