-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a ridiculous bug with Starlark-defined transitions on label-list-…
…typed flags Thanks to @fmeum for spotting this. When we have a Starlark-defined transition on a label-list-typed flag (for example, --platforms), we need to somehow stringify the "label list" object we get in Starlark, so that it might get parsed back into a list of labels by the flag parsing mechanism. This stringification is done using Label#getUnambiguousCanonicalForm (see https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/analysis/starlark/FunctionTransitionUtil.java;l=329;drc=1d4cecf9eab592b1e949185fa1cc850bfe42058d), which does *not* respect the --enable_bzlmod flag, and hence does not use the canonical label literal syntax. This means that the label gets stringified as "@foo//bar", which in turns means that when it gets parsed back using the flag parsing mechanism, it might trigger a strict deps violation. The fix is simply to have Label#getUnambiguousCanonicalForm always use the canonical label literal syntax. This method isn't exposed to users so it doesn't change any visible behavior, so doing this only improves correctness. Work towards #15916 PiperOrigin-RevId: 470203401 Change-Id: I664e15422cf74f2ce427924d8d79e3dee41c07f6
- Loading branch information
1 parent
192f0ab
commit 068d845
Showing
5 changed files
with
98 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters