From dc364cecf108d151f52b0a810657e43451be0ebf Mon Sep 17 00:00:00 2001 From: Marcin Kowalczyk Date: Mon, 11 Nov 2024 11:24:07 +0100 Subject: [PATCH] Change how protobuf-related BUILD rules are obtained: Update required versions of `protobuf` and `rules_python`. Remove `rules_proto`. Import `proto_library` from `@com_google_protobuf//bazel:proto_library.bzl` instead of `@rules_proto//proto:defs.bzl`. Import `cc_proto_library` from `@com_google_protobuf//bazel:cc_proto_library.bzl` instead of using a builtin. Import `py_proto_library` from `@com_google_protobuf//bazel:py_proto_library.bzl` instead of `@rules_python//python:proto.bzl`. PiperOrigin-RevId: 695253164 --- MODULE.bazel | 13 ++++++------- python/riegeli/records/BUILD | 4 ++-- python/riegeli/records/tests/BUILD | 4 ++-- riegeli/records/BUILD | 3 ++- riegeli/records/tools/BUILD | 3 ++- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 9cc1673b..82718d69 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -44,16 +44,12 @@ bazel_dep( ) bazel_dep( name = "protobuf", - version = "23.1", + version = "28.3", repo_name = "com_google_protobuf", ) -bazel_dep( - name = "rules_proto", - version = "4.0.0", -) bazel_dep( name = "rules_python", - version = "0.31.0", + version = "0.36.0", ) bazel_dep( name = "snappy", @@ -81,12 +77,15 @@ SUPPORTED_PYTHON_VERSIONS = [ "3.11", "3.12", ] + DEFAULT_PYTHON_VERSION = SUPPORTED_PYTHON_VERSIONS[-1] + python = use_extension("@rules_python//python/extensions:python.bzl", "python") + [ python.toolchain( - python_version = version, is_default = version == DEFAULT_PYTHON_VERSION, + python_version = version, ) for version in SUPPORTED_PYTHON_VERSIONS ] diff --git a/python/riegeli/records/BUILD b/python/riegeli/records/BUILD index 01d62414..ad83d1f8 100644 --- a/python/riegeli/records/BUILD +++ b/python/riegeli/records/BUILD @@ -1,6 +1,6 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") +load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library") +load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library") load("@rules_python//python:defs.bzl", "py_library") -load("@rules_python//python:proto.bzl", "py_proto_library") load("//python/riegeli:py_extension.bzl", "py_extension") package( diff --git a/python/riegeli/records/tests/BUILD b/python/riegeli/records/tests/BUILD index a9e8c382..55f23558 100644 --- a/python/riegeli/records/tests/BUILD +++ b/python/riegeli/records/tests/BUILD @@ -1,6 +1,6 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") +load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library") +load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library") load("@rules_python//python:defs.bzl", "py_test") -load("@rules_python//python:proto.bzl", "py_proto_library") package( default_visibility = ["//python/riegeli:__subpackages__"], diff --git a/riegeli/records/BUILD b/riegeli/records/BUILD index e373eb36..2b5d9d4c 100644 --- a/riegeli/records/BUILD +++ b/riegeli/records/BUILD @@ -1,4 +1,5 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") +load("@com_google_protobuf//bazel:cc_proto_library.bzl", "cc_proto_library") +load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library") package( default_visibility = ["//visibility:public"], diff --git a/riegeli/records/tools/BUILD b/riegeli/records/tools/BUILD index d5f53872..2b0c0114 100644 --- a/riegeli/records/tools/BUILD +++ b/riegeli/records/tools/BUILD @@ -1,4 +1,5 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") +load("@com_google_protobuf//bazel:cc_proto_library.bzl", "cc_proto_library") +load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library") package( default_visibility = ["//riegeli:__subpackages__"],