Skip to content

Make grpc-java work with bazel HEAD #12241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

ted-xie
Copy link

@ted-xie ted-xie commented Jul 22, 2025

Symbols such as java_* and ProtoInfo now must be loaded from their starlark equivalents.

Symbols such as java_* and ProtoInfo now must be loaded from their
starlark equivalents.
Copy link

linux-foundation-easycla bot commented Jul 22, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@ted-xie
Copy link
Author

ted-xie commented Jul 22, 2025

For context, these changes will be necessary to make grpc-java work with Bazel 9. Bazel at HEAD requires these changes as well, as more and more legacy rules are removed from the bazel upstream codebase.

It appears that grpc-java's dependencies on protobuf and rules_java, among others, are very out of date. This makes updating them tricky, especially in WORKSPACE, since the WORKSPACE setup for those two repos became slightly more complicated in the Bazel 7 -> 8 transition for a variety of technical reasons. See rules_android's example WORKSPACE for reference.

@ted-xie
Copy link
Author

ted-xie commented Jul 22, 2025

Sigh, making this patch work will also require patching grpc itself, and touching its rather complicated dep setup macro (which seems to have implemented repo autoloads before that feature existed in Bazel).

@shivaspeaks shivaspeaks added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Jul 23, 2025
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Jul 23, 2025
@ejona86
Copy link
Member

ejona86 commented Jul 23, 2025

It appears that grpc-java's dependencies on protobuf and rules_java, among others, are very out of date

The old protobuf is on purpose, as that is the last version that supports protobuf-java 3.x. Protobuf 4.x is incompatible with some existing generated code and upgrading can prevent our users from upgrading to newer grpc versions. And yes, that is making a mess of things. When Bazel 9 is released we will be dropping Bazel 7 support, and Bazel 8 already requires protobuf-java 4.x, so Bazel users will be forced to stay on older Bazel versions at that point if they still have trouble, but grpc-java itself will move forward.

rules_java is probably fine to upgrade.

Sigh, making this patch work will also require patching grpc itself

Do you mean github.com/grpc/grpc? I've got a complicated set of changes in the works where I'm trying to avoid depending on envoy, because envoy is depending the newer protobufs that require protobuf-java 4.x. We copy code around and use jarjar to shade our copies. That might help here, as it reduces the dependencies. grpc/grpc would still be a dependency because of googleapis, but we'd no longer be needing to reference @com_github_grpc_grpc//bazel:grpc_deps.bzl.

@ejona86
Copy link
Member

ejona86 commented Jul 23, 2025

master...ejona86:grpc-java:bazel-jarjar is what is cooking. I don't know if the resulting jar is actually correct yet.

@shivaspeaks
Copy link
Member

@ted-xie Thanks for the contribution!

Could you please update your branch with the latest changes from master? The recent merge of #12243 should fix the failing CI test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants