Skip to content

Commit

Permalink
test: restrict canonical label resolving only when bzlmod is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhan committed Aug 7, 2024
1 parent 16cb6f1 commit b82e0d9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/flag/flag_validation_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ def _create_cuda_library_flag_test(*config_settings):
# https://github.com/bazelbuild/bazel/issues/19286#issuecomment-1684325913
# Wrapping all keys into str(Label(...)) should be a workaround with Bazel 6 and later.
# NOTE: //command_line_option will resolve to @@//command_line_option which is not correct.
# Only apply to cuda related labels
if "cuda" in k:
# Only apply to cuda related labels when bzlmod is enabled
is_bzlmod_enabled = str(Label("//:invalid")).startswith("@@")
if is_bzlmod_enabled and "cuda" in k:
merged_config_settings[str(Label(k))] = v
else:
merged_config_settings[k] = v
Expand Down

0 comments on commit b82e0d9

Please sign in to comment.