Version 29.x 新聞公告

Protocol Buffers 29.x 版本宣布的變更。

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

Bazel 和 Proto 規則

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

階段 1

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

階段 2

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

最終目標

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