Skip to content

Commit

Permalink
Change how protobuf-related BUILD rules are obtained:
Browse files Browse the repository at this point in the history
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
  • Loading branch information
QrczakMK committed Nov 11, 2024
1 parent 4f0b881 commit dc364ce
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
13 changes: 6 additions & 7 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
]
4 changes: 2 additions & 2 deletions python/riegeli/records/BUILD
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
4 changes: 2 additions & 2 deletions python/riegeli/records/tests/BUILD
Original file line number Diff line number Diff line change
@@ -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__"],
Expand Down
3 changes: 2 additions & 1 deletion riegeli/records/BUILD
Original file line number Diff line number Diff line change
@@ -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"],
Expand Down
3 changes: 2 additions & 1 deletion riegeli/records/tools/BUILD
Original file line number Diff line number Diff line change
@@ -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__"],
Expand Down

0 comments on commit dc364ce

Please sign in to comment.