From 9eb8a9f360d7c6cd19dde8f5ce120f0f5736e382 Mon Sep 17 00:00:00 2001 From: UebelAndre Date: Tue, 26 Nov 2024 15:18:59 -0800 Subject: [PATCH] Bump various dependencies --- MODULE.bazel | 10 ++++---- WORKSPACE.bazel | 4 +++ crate_universe/BUILD.bazel | 5 +++- docs/BUILD.bazel | 20 ++++++++++++--- docs/MODULE.bazel | 14 ++++++++-- examples/WORKSPACE.bazel | 4 +++ examples/ios/WORKSPACE.bazel | 4 +++ examples/ios_build/WORKSPACE.bazel | 4 +++ extensions/bindgen/BUILD.bazel | 1 - extensions/prost/repositories.bzl | 7 ----- extensions/protobuf/repositories.bzl | 8 ------ rust/private/3rdparty/BUILD.bazel | 0 rust/private/3rdparty/rules_cc.patch | 25 ++++++++++++++++++ rust/private/BUILD.bazel | 6 +++++ rust/repositories.bzl | 38 ++++++++++++++++++++-------- rust/repositories_transitive.bzl | 9 +++++++ 16 files changed, 121 insertions(+), 38 deletions(-) create mode 100644 rust/private/3rdparty/BUILD.bazel create mode 100644 rust/private/3rdparty/rules_cc.patch create mode 100644 rust/repositories_transitive.bzl diff --git a/MODULE.bazel b/MODULE.bazel index 10253867a7..464907e59c 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -7,11 +7,11 @@ module( bazel_dep( name = "bazel_features", - version = "1.9.1", + version = "1.21.0", ) bazel_dep( name = "bazel_skylib", - version = "1.5.0", + version = "1.7.1", ) bazel_dep( name = "platforms", @@ -19,15 +19,15 @@ bazel_dep( ) bazel_dep( name = "rules_cc", - version = "0.0.9", + version = "0.0.17", ) bazel_dep( name = "rules_license", - version = "0.0.8", + version = "1.0.0", ) bazel_dep( name = "apple_support", - version = "1.13.0", + version = "1.17.1", repo_name = "build_bazel_apple_support", ) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index f0732d4fb4..71913a6740 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -6,6 +6,10 @@ rules_rust_dependencies() rust_register_toolchains() +load("@rules_rust//rust:repositories_transitive.bzl", "rules_rust_transitive_dependencies") + +rules_rust_transitive_dependencies() + load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies") crate_universe_dependencies(bootstrap = True) diff --git a/crate_universe/BUILD.bazel b/crate_universe/BUILD.bazel index b6da14961a..436286ba59 100644 --- a/crate_universe/BUILD.bazel +++ b/crate_universe/BUILD.bazel @@ -32,7 +32,10 @@ bzl_library( name = "bzl_lib", srcs = [":bzl_srcs"], visibility = ["//visibility:public"], - deps = ["//rust:bzl_lib"], + deps = [ + "//rust:bzl_lib", + "@bazel_features//:features", + ], ) filegroup( diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index d8abae6709..aa512f7476 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -10,8 +10,6 @@ bzl_library( "@bazel_tools//tools:bzl_srcs", ], deps = [ - "@bazel_features//:deps", - "@bazel_features//:features", "@bazel_skylib//lib:paths", "@bazel_skylib//lib:selects", "@bazel_skylib//lib:structs", @@ -172,11 +170,27 @@ stardoc( deps = [":all_docs"], ) +# This target exists to avoid this issue: +# https://github.com/bazelbuild/rules_cc/issues/279 +bzl_library( + name = "bindgen_lib", + srcs = [ + "@com_google_protobuf//:bzl_srcs", + "@rules_cc//cc:bzl_srcs", + ], + deps = [ + "@com_google_protobuf//bazel:cc_proto_library_bzl", + "@rules_cc//cc/common", + "@rules_cc//cc/toolchains:toolchain_rules", + "@rules_rust_bindgen//:bzl_lib", + ], +) + stardoc( name = "rust_bindgen", out = "rust_bindgen.md", input = "@rules_rust_bindgen//:defs.bzl", - deps = ["@rules_rust_bindgen//:bzl_lib"], + deps = [":bindgen_lib"], ) stardoc( diff --git a/docs/MODULE.bazel b/docs/MODULE.bazel index 54c1557643..3a8be77113 100644 --- a/docs/MODULE.bazel +++ b/docs/MODULE.bazel @@ -1,5 +1,10 @@ """rules_rust docs""" +module( + name = "rules_rust_docs", + version = "0.0.0", +) + bazel_dep(name = "rules_rust", version = "0.54.1") local_path_override( module_name = "rules_rust", @@ -39,6 +44,11 @@ bazel_dep( version = "0.6.2", ) bazel_dep( - name = "bazel_features", - version = "1.14.0", + name = "protobuf", + version = "27.0", + repo_name = "com_google_protobuf", +) +bazel_dep( + name = "rules_cc", + version = "0.0.17", ) diff --git a/examples/WORKSPACE.bazel b/examples/WORKSPACE.bazel index 52d360b51e..b1bb3bd170 100644 --- a/examples/WORKSPACE.bazel +++ b/examples/WORKSPACE.bazel @@ -16,6 +16,10 @@ rust_register_toolchains( edition = "2018", ) +load("@rules_rust//rust:repositories_transitive.bzl", "rules_rust_transitive_dependencies") + +rules_rust_transitive_dependencies() + load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies") crate_universe_dependencies(bootstrap = True) diff --git a/examples/ios/WORKSPACE.bazel b/examples/ios/WORKSPACE.bazel index ad8ca218ed..d57a023341 100644 --- a/examples/ios/WORKSPACE.bazel +++ b/examples/ios/WORKSPACE.bazel @@ -22,6 +22,10 @@ rust_register_toolchains( ], ) +load("@rules_rust//rust:repositories_transitive.bzl", "rules_rust_transitive_dependencies") + +rules_rust_transitive_dependencies() + load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( diff --git a/examples/ios_build/WORKSPACE.bazel b/examples/ios_build/WORKSPACE.bazel index 8fabc30a62..62d33507f3 100644 --- a/examples/ios_build/WORKSPACE.bazel +++ b/examples/ios_build/WORKSPACE.bazel @@ -17,6 +17,10 @@ rust_register_toolchains( ], ) +load("@rules_rust//rust:repositories_transitive.bzl", "rules_rust_transitive_dependencies") + +rules_rust_transitive_dependencies() + load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies") crate_universe_dependencies(bootstrap = True) diff --git a/extensions/bindgen/BUILD.bazel b/extensions/bindgen/BUILD.bazel index ee68d3cc31..b3cccb2ee5 100644 --- a/extensions/bindgen/BUILD.bazel +++ b/extensions/bindgen/BUILD.bazel @@ -17,7 +17,6 @@ bzl_library( deps = [ "//3rdparty:bzl_lib", "//private:bzl_lib", - "@rules_rust//rust:bzl_lib", ], ) diff --git a/extensions/prost/repositories.bzl b/extensions/prost/repositories.bzl index 117a9a99e2..27a0772519 100644 --- a/extensions/prost/repositories.bzl +++ b/extensions/prost/repositories.bzl @@ -40,13 +40,6 @@ def rust_prost_dependencies(bzlmod = False): strip_prefix = "protobuf-3.18.0", urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v3.18.0/protobuf-all-3.18.0.tar.gz"], ) - maybe( - http_archive, - name = "bazel_features", - sha256 = "5d7e4eb0bb17aee392143cd667b67d9044c270a9345776a5e5a3cccbc44aa4b3", - strip_prefix = "bazel_features-1.13.0", - url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.13.0/bazel_features-v1.13.0.tar.gz", - ) maybe( http_archive, name = "zlib", diff --git a/extensions/protobuf/repositories.bzl b/extensions/protobuf/repositories.bzl index 165f749f51..0d6f7d0c5e 100644 --- a/extensions/protobuf/repositories.bzl +++ b/extensions/protobuf/repositories.bzl @@ -52,14 +52,6 @@ def rust_proto_protobuf_dependencies(bzlmod = False): ], ) - maybe( - http_archive, - name = "bazel_features", - sha256 = "5d7e4eb0bb17aee392143cd667b67d9044c270a9345776a5e5a3cccbc44aa4b3", - strip_prefix = "bazel_features-1.13.0", - url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.13.0/bazel_features-v1.13.0.tar.gz", - ) - return crate_repositories() # buildifier: disable=unnamed-macro diff --git a/rust/private/3rdparty/BUILD.bazel b/rust/private/3rdparty/BUILD.bazel new file mode 100644 index 0000000000..e69de29bb2 diff --git a/rust/private/3rdparty/rules_cc.patch b/rust/private/3rdparty/rules_cc.patch new file mode 100644 index 0000000000..750e4064c5 --- /dev/null +++ b/rust/private/3rdparty/rules_cc.patch @@ -0,0 +1,25 @@ +diff --git a/cc/defs.bzl b/cc/defs.bzl +index 4fccdcc..d848ede 100644 +--- a/cc/defs.bzl ++++ b/cc/defs.bzl +@@ -13,7 +13,7 @@ + # limitations under the License. + """Starlark rules for building C++ projects.""" + +-load("@com_google_protobuf//bazel:cc_proto_library.bzl", _cc_proto_library = "cc_proto_library") ++load("//cc/private:cc_proto_library.bzl", _cc_proto_library = "cc_proto_library") + load("//cc:cc_binary.bzl", _cc_binary = "cc_binary") + load("//cc:cc_import.bzl", _cc_import = "cc_import") + load("//cc:cc_library.bzl", _cc_library = "cc_library") +diff --git a/cc/private/cc_proto_library.bzl b/cc/private/cc_proto_library.bzl +new file mode 100644 +index 0000000..bd94272 +--- /dev/null ++++ b/cc/private/cc_proto_library.bzl +@@ -0,0 +1,6 @@ ++"""Avoid the following issue by providing a native reexport: ++https://github.com/bazelbuild/rules_cc/issues/274 ++""" ++ ++def cc_proto_library(**kwargs): ++ native.cc_proto_library(**kwargs) diff --git a/rust/private/BUILD.bazel b/rust/private/BUILD.bazel index 0ef93672e3..1dd47569e4 100644 --- a/rust/private/BUILD.bazel +++ b/rust/private/BUILD.bazel @@ -8,12 +8,18 @@ bzl_library( srcs = ["@bazel_tools//tools:bzl_srcs"], ) +bzl_library( + name = "rules_cc_bzl_lib", + srcs = ["@rules_cc//cc:bzl_srcs"], +) + bzl_library( name = "bzl_lib", srcs = glob(["**/*.bzl"]), visibility = ["//rust:__subpackages__"], deps = [ ":bazel_tools_bzl_lib", + ":rules_cc_bzl_lib", "//rust/platform:bzl_lib", "@bazel_skylib//lib:paths", "@bazel_skylib//rules:common_settings", diff --git a/rust/repositories.bzl b/rust/repositories.bzl index 0e5635f8ad..56cca34db0 100644 --- a/rust/repositories.bzl +++ b/rust/repositories.bzl @@ -58,30 +58,46 @@ def rules_rust_dependencies(): ], sha256 = "218efe8ee736d26a3572663b374a253c012b716d8af0c07e842e82f238a0a7ee", ) + + # Avoid the following issue https://github.com/bazelbuild/rules_cc/issues/274 + rules_cc_kwargs = {} + if native.bazel_version.startswith(("6", "7")): + rules_cc_kwargs.update({ + "patch_args": ["-p1"], + "patches": [Label("//rust/private/3rdparty:rules_cc.patch")], + }) maybe( http_archive, name = "rules_cc", - urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"], - sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf", - strip_prefix = "rules_cc-0.0.9", + urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.17/rules_cc-0.0.17.tar.gz"], + sha256 = "abc605dd850f813bb37004b77db20106a19311a96b2da1c92b789da529d28fe1", + strip_prefix = "rules_cc-0.0.17", + **rules_cc_kwargs ) maybe( http_archive, name = "rules_license", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/0.0.8/rules_license-0.0.8.tar.gz", - "https://github.com/bazelbuild/rules_license/releases/download/0.0.8/rules_license-0.0.8.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/1.0.0/rules_license-1.0.0.tar.gz", + "https://github.com/bazelbuild/rules_license/releases/download/1.0.0/rules_license-1.0.0.tar.gz", ], - sha256 = "241b06f3097fd186ff468832150d6cc142247dc42a32aaefb56d0099895fd229", + sha256 = "26d4021f6898e23b82ef953078389dd49ac2b5618ac564ade4ef87cced147b38", + ) + maybe( + http_archive, + name = "bazel_features", + sha256 = "af3d4fb1cf4f25942cb4a933b1ad93a0ea9fe9ee70c2af7f369fb72a67c266e5", + strip_prefix = "bazel_features-1.21.0", + url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.21.0/bazel_features-v1.21.0.tar.gz", ) maybe( http_archive, name = "bazel_skylib", - sha256 = "cd55a062e763b9349921f0f5db8c3933288dc8ba4f76dd9416aac68acee3cb94", + sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz", + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz", ], ) @@ -90,8 +106,8 @@ def rules_rust_dependencies(): maybe( http_archive, name = "build_bazel_apple_support", - sha256 = "1c4031e72b456a048d8177f59a5581808c07585fa9e255c6f5fefb8752af7e40", - url = "https://github.com/bazelbuild/apple_support/releases/download/1.13.0/apple_support.1.13.0.tar.gz", + sha256 = "b53f6491e742549f13866628ddffcc75d1f3b2d6987dc4f14a16b242113c890b", + url = "https://github.com/bazelbuild/apple_support/releases/download/1.17.1/apple_support.1.17.1.tar.gz", ) # process_wrapper needs a low-dependency way to process json. diff --git a/rust/repositories_transitive.bzl b/rust/repositories_transitive.bzl new file mode 100644 index 0000000000..2f02585e10 --- /dev/null +++ b/rust/repositories_transitive.bzl @@ -0,0 +1,9 @@ +"""Transitive repositories for Rust dependencies.""" + +load("@bazel_features//:deps.bzl", "bazel_features_deps") +load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies") + +def rules_rust_transitive_dependencies(): + """Rust transitive repositories.""" + rules_cc_dependencies() + bazel_features_deps()