Skip to content

Commit

Permalink
Switch to + separator in use_repo_rule
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Dec 19, 2024
1 parent e58965c commit 9c03c55
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ static InnateRunnableExtension load(
RepositoryMapping repoMapping = usagesValue.getRepoMappings().get(moduleKey);
Label.RepoContext repoContext = Label.RepoContext.of(repoMapping.ownerRepo(), repoMapping);

// The name of the extension is of the form "<bzl_file_label>%<rule_name>".
Iterator<String> parts = Splitter.on('%').split(extensionId.extensionName()).iterator();
// The name of the extension is of the form "<bzl_file_label>+<rule_name>".
Iterator<String> parts = Splitter.on('+').split(extensionId.extensionName()).iterator();
Location location = tags.getFirst().getLocation();
Label bzlLabel;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static ModuleExtensionId create(
}

public boolean isInnate() {
return extensionName().contains("%");
return extensionName().contains("+");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ private static void injectRepos(
new ModuleThreadContext.ModuleExtensionUsageBuilder(
context,
"//:MODULE.bazel",
"@bazel_tools//tools/build_defs/repo:local.bzl%local_repository",
"@bazel_tools//tools/build_defs/repo:local.bzl+local_repository",
/* isolate= */ false);
ModuleFileGlobals.ModuleExtensionProxy extensionProxy =
new ModuleFileGlobals.ModuleExtensionProxy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ public RepoRuleProxy useRepoRule(String bzlFile, String ruleName, StarlarkThread
ModuleThreadContext context = ModuleThreadContext.fromOrFail(thread, "use_repo_rule()");
context.setNonModuleCalled();
// Not a valid Starlark identifier so that it can't collide with a real extension.
String extensionName = bzlFile + '%' + ruleName;
String extensionName = bzlFile + '+' + ruleName;
// Find or create the builder for the singular "innate" extension of this repo rule for this
// module.
for (ModuleExtensionUsageBuilder usageBuilder : context.getExtensionUsageBuilders()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ public void testModuleExtensions_innate() throws Exception {
.addExtensionUsage(
ModuleExtensionUsage.builder()
.setExtensionBzlFile("//:MODULE.bazel")
.setExtensionName("//:repo.bzl%repo")
.setExtensionName("//:repo.bzl+repo")
.setIsolationKey(Optional.empty())
.setRepoOverrides(ImmutableMap.of())
.addProxy(
Expand Down Expand Up @@ -1234,7 +1234,7 @@ public void testModuleExtensions_innate() throws Exception {
.addExtensionUsage(
ModuleExtensionUsage.builder()
.setExtensionBzlFile("//:MODULE.bazel")
.setExtensionName("@bazel_tools//:http.bzl%http_archive")
.setExtensionName("@bazel_tools//:http.bzl+http_archive")
.setIsolationKey(Optional.empty())
.setRepoOverrides(ImmutableMap.of())
.addProxy(
Expand Down

0 comments on commit 9c03c55

Please sign in to comment.