From 126fc66d55fd807e41fb793952040c9991d8eceb Mon Sep 17 00:00:00 2001 From: A Googler Date: Thu, 18 Jul 2024 16:12:08 -0700 Subject: [PATCH] Add the simple name of the extension class to the filename of the configuration proto, to avoid collisions. PiperOrigin-RevId: 653787033 Change-Id: Ic928e62fe27dd4ea8b83e62340f4c5d254746d0d --- provider/extension/textproto.bzl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/provider/extension/textproto.bzl b/provider/extension/textproto.bzl index 74a8b01..6c91e4e 100644 --- a/provider/extension/textproto.bzl +++ b/provider/extension/textproto.bzl @@ -49,7 +49,13 @@ def extension_to_textproto(ctx, extension): "\n".join(['jar {{\n path: "{}"\n}}'.format(x.short_path) for x in extension.binary]), extension.text_proto.replace("\n", "\\n"), ) - name = extension.extension_target.split(":")[-1] + "_extension.textproto" + + # Make the filename a bit more interesting than the pure target name, without dragging in the + # entire target path (which might bump into Bazel or filesystem limits). + name = "{}_{}_extension.textproto".format( + extension.java_class.split(".")[-1], + extension.extension_target.split(":")[-1], + ) file = ctx.actions.declare_file(name) ctx.actions.write( output = file,