Skip to content

Commit a21cfdc

Browse files
authored
Remove incorect use of rstrip (#1262)
* Remove incorect use of rstrip * Add back check to not change labels of targets not ending with _proto
1 parent 0ac75d3 commit a21cfdc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scala_proto/private/scala_proto_aspect.bzl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,18 @@ def _phase_aspect_provider(ctx, p):
160160
},
161161
)
162162

163+
def _strip_suffix(str, suffix):
164+
if str.endswith(suffix):
165+
return str[:-len(suffix)]
166+
else:
167+
return str
168+
163169
def _phase_stamp_label(ctx, p):
164170
rule_label = str(p.target.label)
165171
toolchain = ctx.toolchains["@io_bazel_rules_scala//scala_proto:toolchain_type"]
166172

167173
if toolchain.stamp_by_convention and rule_label.endswith("_proto"):
168-
return rule_label.rstrip("_proto") + "_scala_proto"
174+
return _strip_suffix(rule_label, "_proto") + "_scala_proto"
169175
else:
170176
return rule_label
171177

0 commit comments

Comments
 (0)