From f7ca57feac38f30efcf488b3f6fea097fe5d8719 Mon Sep 17 00:00:00 2001 From: Yun Peng Date: Fri, 11 Oct 2024 18:23:48 +0200 Subject: [PATCH] Restore compatibility with Bazel 6 --- MODULE.bazel | 1 + cc/extensions.bzl | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index cca1a2d..9f7f4aa 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,6 +4,7 @@ module( compatibility_level = 1, ) +bazel_dep(name = "bazel_features", version = "1.19.0") bazel_dep(name = "bazel_skylib", version = "1.7.1") bazel_dep(name = "platforms", version = "0.0.10") bazel_dep(name = "protobuf", version = "27.0") diff --git a/cc/extensions.bzl b/cc/extensions.bzl index 1ac80dc..0d73141 100644 --- a/cc/extensions.bzl +++ b/cc/extensions.bzl @@ -13,11 +13,15 @@ # limitations under the License. """Module extension for cc auto configuration.""" +load("@bazel_features//:features.bzl", "bazel_features") load("//cc/private/toolchain:cc_configure.bzl", "cc_autoconf", "cc_autoconf_toolchains") def _cc_configure_extension_impl(ctx): cc_autoconf_toolchains(name = "local_config_cc_toolchains") cc_autoconf(name = "local_config_cc") - return ctx.extension_metadata(reproducible = True) + if bazel_features.external_deps.extension_metadata_has_reproducible: + return ctx.extension_metadata(reproducible = True) + else: + return None cc_configure_extension = module_extension(implementation = _cc_configure_extension_impl)