Restore compatibility with Bazel 6

This commit is contained in:
Yun Peng 2024-10-11 18:23:48 +02:00
parent ba3ec91a55
commit f7ca57feac
2 changed files with 6 additions and 1 deletions

View File

@ -4,6 +4,7 @@ module(
compatibility_level = 1, compatibility_level = 1,
) )
bazel_dep(name = "bazel_features", version = "1.19.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1") bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "platforms", version = "0.0.10") bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "protobuf", version = "27.0") bazel_dep(name = "protobuf", version = "27.0")

View File

@ -13,11 +13,15 @@
# limitations under the License. # limitations under the License.
"""Module extension for cc auto configuration.""" """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") load("//cc/private/toolchain:cc_configure.bzl", "cc_autoconf", "cc_autoconf_toolchains")
def _cc_configure_extension_impl(ctx): def _cc_configure_extension_impl(ctx):
cc_autoconf_toolchains(name = "local_config_cc_toolchains") cc_autoconf_toolchains(name = "local_config_cc_toolchains")
cc_autoconf(name = "local_config_cc") 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) cc_configure_extension = module_extension(implementation = _cc_configure_extension_impl)