Changes Announced on October 1, 2024

Changes announced for Protocol Buffers on October 1, 2024.

Bazel and Proto Rules

There are upcoming changes to the way that Bazel will work for protobuf builds. These changes require awareness in the first stage, and action by project owners before the second stage.

Stage 1

With the release of Bazel 8, proto rules (proto_library, cc_proto_library, java_proto_library, java_lite_proto_library, and py_proto_library) will be removed from the Bazel project. The will be added to the Protocol Buffers project in v29. Bazel will be updated to automatically use the rules from the protobuf project, so the change is initially a no-op for project owners.

After the release of Bazel 8 and before the release of Bazel 9, users will need to explicitly load the rules from the Protocol Buffers project repository. The automatic use of the rules is only temporary to support the migration.

Users should add the following load() statements to any BUILD or .bzl files that use these proto rules. Note that these require Protobuf v29.0 or higher.

load("@protobuf//bazel:proto_library.bzl", "proto_library")

load("@protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
load("@protobuf//bazel:java_proto_library.bzl", "java_proto_library")
load("@protobuf//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
load("@protobuf//bazel:py_proto_library.bzl", "py_proto_library")

Stage 2

When Bazel 9 is released, the automatic loading of the protobuf library’s rules will be removed. At that point, you will need to have load statements in your Bazel build files.

End Goal

Once the rules are in the protobuf repo, we intend to address common user requests, such as using prebuilts for the proto compiler where possible.