版本 29.x 的新聞公告

針對 Protocol Buffers 版本 29.x 公告的變更。

以下公告專屬於版本 29.x。如需依時間順序呈現的資訊,請參閱新聞

Bazel 與 Proto 規則

Bazel 在 protobuf 建置中的運作方式即將發生變更。這些變更在第一階段需要注意,並在第二階段之前需要專案擁有者採取行動。

第一階段

隨著 Bazel 8 的發布,proto 規則 (proto_librarycc_proto_libraryjava_proto_libraryjava_lite_proto_librarypy_proto_library) 將從 Bazel 專案中移除。它們將在 v29 中加入 Protocol Buffers 專案。Bazel 將會更新以自動使用 protobuf 專案中的規則,因此此變更最初對專案擁有者來說是無操作的。

在 Bazel 8 發布後且 Bazel 9 發布前,使用者需要從 Protocol Buffers 專案儲存庫明確地 load 規則。自動使用規則只是暫時性的,以支援遷移。

使用者應將以下 load() 陳述式加入任何使用這些 proto 規則的 BUILD.bzl 檔案中。請注意,這些需要 Protobuf v29.0 或更高版本。

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")

第二階段

當 Bazel 9 發布時,將移除自動載入 protobuf 程式庫規則的功能。屆時,您需要在 Bazel 建置檔案中加入 load 陳述式。

最終目標

一旦規則進入 protobuf 儲存庫,我們打算解決常見的使用者請求,例如在可能的情況下為 proto 編譯器使用預建版本。