From 7356adb87a194cf3a76551900d584a0627764551 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 8 Aug 2024 09:10:25 -0700 Subject: [PATCH] internal proto_library change PiperOrigin-RevId: 660861340 --- bazel/common/proto_common.bzl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bazel/common/proto_common.bzl b/bazel/common/proto_common.bzl index fcddfc7dcc..876cb97b43 100644 --- a/bazel/common/proto_common.bzl +++ b/bazel/common/proto_common.bzl @@ -123,6 +123,7 @@ def _compile( additional_args = None, additional_tools = [], additional_inputs = depset(), + additional_proto_lang_toolchain_info = None, resource_set = None, experimental_exec_group = None, experimental_progress_message = None, @@ -146,6 +147,9 @@ def _compile( of the command line. additional_tools: (list[File]) Additional tools to add to the action. additional_inputs: (Depset[File]) Additional input files to add to the action. + additional_proto_lang_toolchain_info: (list[ProtoLangToolchainInfo]) Additional proto lang + toolchain info for invoking multiple plugins in a single protoc invocation. For example, + this is needed for plugin insertion points. resource_set: (func) A callback function that is passed to the created action. See `ctx.actions.run`, `resource_set` parameter for full definition of the callback. @@ -187,6 +191,10 @@ def _compile( tools.append(proto_lang_toolchain_info.plugin) args.add(proto_lang_toolchain_info.plugin.executable, format = proto_lang_toolchain_info.plugin_format_flag) + if additional_proto_lang_toolchain_info != None: + tools.append(additional_proto_lang_toolchain_info.plugin) + args.add(additional_proto_lang_toolchain_info.plugin.executable, format = additional_proto_lang_toolchain_info.plugin_format_flag) + # Protoc searches for .protos -I paths in order they are given and then # uses the path within the directory as the package. # This requires ordering the paths from most specific (longest) to least @@ -212,7 +220,7 @@ def _compile( mnemonic = proto_lang_toolchain_info.mnemonic, progress_message = experimental_progress_message if experimental_progress_message else proto_lang_toolchain_info.progress_message, executable = proto_lang_toolchain_info.proto_compiler, - arguments = [additional_args, args] if additional_args else [args], + arguments = [args, additional_args] if additional_args else [args], inputs = depset(transitive = [proto_info.transitive_sources, additional_inputs]), outputs = generated_files, tools = tools,