Skip to content

Commit e4a1966

Browse files
committed
Fix _MAIN_REPO_PREFIX in bzlmod.bzl
Backported from bazelbuild/bazel-skylib#548, whereby I realized `Label(//:all)` would not produce the main repo prefix when imported into other repos.
1 parent fd1487c commit e4a1966

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scala/private/macros/bzlmod.bzl

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ def apparent_repo_label_string(label):
6767
label_str = "@" + str(label).lstrip("@")
6868
return label_str.replace(label.repo_name, apparent_repo_name(label))
6969

70-
_MAIN_REPO_PREFIX = str(Label("//:all")).split(":")[0]
70+
_IS_BZLMOD_ENABLED = str(Label("//:all")).startswith("@@")
71+
72+
_MAIN_REPO_PREFIX = "@@//" if _IS_BZLMOD_ENABLED else "@//"
7173

7274
def adjust_main_repo_prefix(target_pattern):
7375
"""Updates the main repo prefix to match the current Bazel version.

0 commit comments

Comments
 (0)