Upgrading bazel_dep protobuf from version 29.5 to 31.1 causes Error: file '@com_google_protobuf//:protobuf.bzl' does not contain symbol 'py_proto_library'
What version of protobuf and what language are you using?
https://github.com/enola-dev/enola/pull/1426 tries to bump:
bazel_dep(name = "protobuf", version = "29.5")
to:
bazel_dep(name = "protobuf", version = "31.1")
but that causes a new build failure due to:
ERROR: Traceback (most recent call last):
File "/home/runner/.bazel/external/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: /home/runner/.bazel/external/protoc-gen-validate+/validate/BUILD: no such target '@@protoc-gen-validate+//validate:validate_proto': target 'validate_proto' not declared in package 'validate' defined by /home/runner/.bazel/external/protoc-gen-validate+/validate/BUILD
ERROR: /home/runner/.bazel/external/xds+/xds/data/orca/v3/BUILD:5:18: no such target '@@protoc-gen-validate+//validate:validate_proto': target 'validate_proto' not declared in package 'validate' defined by /home/runner/.bazel/external/protoc-gen-validate+/validate/BUILD and referenced by '@@xds+//xds/data/orca/v3:pkg'
ERROR: Analysis of target '//java/dev/enola/ai/adk/web:testsTestSuite' failed; build aborted: Analysis failed
What operating system (Linux, Windows, ...) and version?
Linux.
I suspect that this technically isn't protocolbuffers/protobuf "fault", but it's because something else (!) was using an internal target (of this project) which is now no longer available or visibile.
My project is not actually directly using neither protoc-gen-validate. I suspect that something else is dragging it along.
Unfortunately it's not super clear to me how to figure out where it's coming from. Which project should I be reporting this to? https://github.com/bufbuild/protoc-gen-validate, maybe? Or gRPC / XDS? Both?
#21231 was about very similar (I honestly even forget about that one already!) - but now adding bazel_dep(name = "protoc-gen-validate", version = "1.2.1.bcr.1") does not help.
It's very strange that using a more recent version of protoc-gen-validate doesn't help, because they've fixed this issue. 1.1.0 was the last release using our internal py_proto_library, and since 1.2.0 they've been using the proper recommendation... What happens when you bump to 1.2.1.bcr.1?
What does bazel mod deps --verbose protoc-gen-validate show for which version of protoc-gen-validate you are actually getting?
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, thus I'm closing this.