grpc++grpc_repo_deps_ext+com_envoyproxy_protoc_gen_validate/validate/BUILD load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") Error: file '@com_google_protobuf//:protobuf.bzl' does not contain symbol 'py_proto_library'
What version of gRPC-Java are you using?
1.73.0
What is your environment?
Linux, Java 21
What did you expect to see?
Working Build.
What did you see instead?
Broken Build:
ERROR: Traceback (most recent call last):
File "/usr/local/google/home/vorburger/.cache/bazel/_bazel_vorburger/c6543dbace99b08000eb7863bbb3c206/external/grpc++grpc_repo_deps_ext+com_envoyproxy_protoc_gen_validate/validate/BUILD", line 1, column 46, in <toplevel>
load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")
Error: file '@com_google_protobuf//:protobuf.bzl' does not contain symbol 'py_proto_library'
ERROR: /usr/local/google/home/vorburger/.cache/bazel/_bazel_vorburger/c6543dbace99b08000eb7863bbb3c206/external/grpc++grpc_repo_deps_ext+com_envoyproxy_protoc_gen_validate/validate/BUILD: no such target '@@grpc++grpc_repo_deps_ext+com_envoyproxy_protoc_gen_validate//validate:validate_proto': target 'validate_proto' not declared in package 'validate' defined by /usr/local/google/home/vorburger/.cache/bazel/_bazel_vorburger/c6543dbace99b08000eb7863bbb3c206/external/grpc++grpc_repo_deps_ext+com_envoyproxy_protoc_gen_validate/validate/BUILD
ERROR: /usr/local/google/home/vorburger/.cache/bazel/_bazel_vorburger/c6543dbace99b08000eb7863bbb3c206/external/grpc-java++grpc_java_repositories_extension+com_github_cncf_xds/xds/service/orca/v3/BUILD:5:18: no such target '@@grpc++grpc_repo_deps_ext+com_envoyproxy_protoc_gen_validate//validate:validate_proto': target 'validate_proto' not declared in package 'validate' defined by /usr/local/google/home/vorburger/.cache/bazel/_bazel_vorburger/c6543dbace99b08000eb7863bbb3c206/external/grpc++grpc_repo_deps_ext+com_envoyproxy_protoc_gen_validate/validate/BUILD and referenced by '@@grpc-java++grpc_java_repositories_extension+com_github_cncf_xds//xds/service/orca/v3:pkg'
Steps to reproduce the bug
https://github.com/protocolbuffers/protobuf/issues/21231
when bumping a bazel_dep(name = "protobuf", version = "29.5") to 31.1.
I'm seeing a similar issue related to "com_envoyproxy_protoc_gen_validate" originating here.
# MODULE.bazel
grpc_repo_deps_ext = use_extension("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_repo_deps_ext")
use_repo(
grpc_repo_deps_ext,
"com_envoyproxy_protoc_gen_validate",
"opencensus_proto",
)
In my repo, [email protected] is being used in the dependency graph, which depends on [email protected].
[email protected] does not return com_envoyproxy_protoc_gen_validate in the grpc_repo_deps_ext call.
grpc-java depends on [email protected] in the MODULE.bazel file. What's odd is that 1.56.3 doesn't even have grpc_repo_deps_ext, so this is a bit of a botched MODULE.bazel implementation.
It seems like if grpc-java relies on com_envoyproxy_protoc_gen_validate, it should depend on it directly, not rely on another dependency to provide it. Module extensions aren't really made to pass dependencies around, but supposed to be used if separate repos are created by the module.
(Sending what I was working on on Friday.)
The simple answer looks to be that you can't upgrade protobuf right now.
@normmcgarry, [email protected] has a patch to adjust the dependencies: https://github.com/bazelbuild/bazel-central-registry/blob/main/modules/grpc/1.56.3.bcr.1/patches/adopt_bzlmod.patch
[email protected] is the last version that allows the older protobuf major version (to deal with https://github.com/grpc/grpc-java/issues/11015). We can't use protoc-gen-validate from BCR as even the oldest version depends on [email protected] which depends on [email protected].
I tried inlining the com_envoyproxy_protoc_gen_validate dep into grpc-java instead of using grpc repo, but I wasn't seeing a way to upgrade the version from a consuming module. I got pulled into other things, so still could play with it more.
FYI bumping to a bazel_dep(name = "protobuf", version = "31.1") meanwhile worked for me, in https://github.com/enola-dev/enola/pull/1520 (likely because in the meantime I've upgraded some other stuff) - so this is no longer an issue for me, but quite possibly still for @normmcgarry.
These troublesome dependencies were removed in #12243 by making copies of the .protos. It should substantially improve compatibility.
These troublesome dependencies were removed in #12243 by making copies of the .protos. It should substantially improve compatibility.
@ejona86 Awesome; Thank You! This works great.