Is your feature request related to a problem?
There is currently no simple way to use the (wonderful) new 1.64.0 feature @generated=omit from Bazel. Which leaves Bazel users with a superfluous dependency for a single annotation.
It might be possible to do so with a new toolchain, but that's a lot of effort for a minor feature. If that doesn't work either, it's probably impossible. This might also be related to #11097
Describe the solution you'd like
Either set it to omit by default or add an option to change it.
https://github.com/grpc/grpc-java/blob/v1.64.0/java_grpc_library.bzl#L95 looks like the right place; args.add("--rpc-plugin_opt=@generated={0}".format(<???>)) behind a conditional (only if non-default) should do the trick - with a new attribute in the rules below.
The ..._opt flag to set the CodeGeneratorRequest.parameter for a plugin is not well documented, but is referenced e.g. here: protocolbuffers/protobuf#4759 (comment) (EDIT: a better reference would be https://github.com/protocolbuffers/protobuf/blob/v26.1/src/google/protobuf/compiler/command_line_interface.h#L107-L175)
It can occur more than once. It might even be worth it to also use this instead of the lite/non-lite toolchains.
Describe alternatives you've considered
I tried a .bazelrc entry with build --protocopt=--rpc-plugin_opt=@generated=omit - but that failed. The descriptors are created before the plugin is called, the option is unknown at that point and the command fails.
Additional context
Is your feature request related to a problem?
There is currently no simple way to use the (wonderful) new 1.64.0 feature
@generated=omitfrom Bazel. Which leaves Bazel users with a superfluous dependency for a single annotation.It might be possible to do so with a new toolchain, but that's a lot of effort for a minor feature. If that doesn't work either, it's probably impossible. This might also be related to #11097
Describe the solution you'd like
Either set it to omit by default or add an option to change it.
https://github.com/grpc/grpc-java/blob/v1.64.0/java_grpc_library.bzl#L95 looks like the right place;
args.add("--rpc-plugin_opt=@generated={0}".format(<???>))behind a conditional (only if non-default) should do the trick - with a new attribute in the rules below.The
..._optflag to set the CodeGeneratorRequest.parameter for a plugin is not well documented, but is referenced e.g. here: protocolbuffers/protobuf#4759 (comment) (EDIT: a better reference would be https://github.com/protocolbuffers/protobuf/blob/v26.1/src/google/protobuf/compiler/command_line_interface.h#L107-L175)It can occur more than once. It might even be worth it to also use this instead of the lite/non-lite toolchains.
Describe alternatives you've considered
I tried a
.bazelrcentry withbuild --protocopt=--rpc-plugin_opt=@generated=omit- but that failed. The descriptors are created before the plugin is called, the option is unknown at that point and the command fails.Additional context