Skip to content

Commit

Permalink
[8.1.1] Fall back to rctx.name if $original_name is empty (#25310)
Browse files Browse the repository at this point in the history
The default for the attribute is the empty string, not `null`.

Fixes #25286

Closes #25296.

PiperOrigin-RevId: 728298504
Change-Id: Ibc7209e248c3abb57a5fb2487e7dab7202960bbd

Commit
fa7900a

Co-authored-by: Fabian Meumertzheim <[email protected]>
  • Loading branch information
bazel-io and fmeum authored Feb 18, 2025
1 parent 7e086c2 commit d81c123
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import static java.nio.charset.StandardCharsets.ISO_8859_1;

import com.github.difflib.patch.PatchFailedException;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.docgen.annot.DocCategory;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
Expand Down Expand Up @@ -168,7 +169,7 @@ public String getOriginalName() {
// backing Bazel modules. In case of the former, the original name is the same as the name, in
// the latter the original name doesn't matter as the restricted set of rules that can back
// Bazel modules do not use the name.
return originalName != null ? originalName : rule.getName();
return Strings.isNullOrEmpty(originalName) ? rule.getName() : originalName;
}

@StarlarkMethod(
Expand Down

0 comments on commit d81c123

Please sign in to comment.