Fix Bzlmod build with protobuf 3.19.2 With https://github.com/protocolbuffers/protobuf/commit/c7dfd0d6b92f825a4b9e986b3e948a5ab61c7438, protobuf 3.19.2 now depends on @maven for fetching some jar dependencies. This was still handled by `bind` in WORKSPACE.bzlmod file in the Bzlmod build, and will be removed when rules_jvm_external is available for Bzlmod. For now, we have to patch protobuf 3.19.2 to make it work with Bazel's Bzlmod build. Related change: https://github.com/bazelbuild/bazel/commit/7a22b269d6fe5ffd66f20264320d8821e174c6a9 Closes #14565. PiperOrigin-RevId: 421322828
diff --git a/MODULE.bazel b/MODULE.bazel index f399a39..173f65f 100644 --- a/MODULE.bazel +++ b/MODULE.bazel
@@ -32,3 +32,10 @@ bazel_dep(name = "rules_python", version = "0.4.0") bazel_dep(name = "rules_java", version = "5.0.0") bazel_dep(name = "rules_proto", version = "4.0.0") + +# TODO(pcloudy): Remove this when rules_jvm_external adopts Bzlmod. +single_version_override( + module_name = "protobuf", + patches = ["//third_party/protobuf:3.19.2.bzlmod.patch"], + patch_strip = 1, +)