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 0bd9c35
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ public RepositoryName read(JsonReader jsonReader) throws IOException {
new TypeAdapter<>() {
@Override
public void write(JsonWriter jsonWriter, ModuleExtensionId moduleExtId) throws IOException {
String isolationKeyPart = moduleExtId.isolationKey().map(key -> "%" + key).orElse("");
jsonWriter.value(
moduleExtId.bzlFileLabel() + "%" + moduleExtId.extensionName() + isolationKeyPart);
jsonWriter.value(moduleExtId.toString());
}

@Override
Expand Down
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 @@ -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

0 comments on commit 0bd9c35

Please sign in to comment.