diff --git a/cc/extensions.bzl b/cc/extensions.bzl index 3cb5c758f..5b62fe0d8 100644 --- a/cc/extensions.bzl +++ b/cc/extensions.bzl @@ -168,6 +168,10 @@ CcSharedLibraryInfo = NativeCcSharedLibraryInfo """, ) + if hasattr(rctx, "repo_metadata"): + return rctx.repo_metadata(reproducible = False) + return None + _compatibility_proxy_repo_rule = repository_rule( _compatibility_proxy_repo_impl, # force reruns on server restarts to use correct native.bazel_version diff --git a/cc/private/toolchain/cc_configure.bzl b/cc/private/toolchain/cc_configure.bzl index 1d5314489..2873a83c4 100644 --- a/cc/private/toolchain/cc_configure.bzl +++ b/cc/private/toolchain/cc_configure.bzl @@ -33,6 +33,9 @@ def cc_autoconf_toolchains_impl(repository_ctx): Args: repository_ctx: repository context + + Returns: + repo_metadata consumed by bazel """ if not _should_disable_toolchain(repository_ctx): if repository_ctx.os.name.lower().find("windows") != -1: @@ -51,6 +54,10 @@ def cc_autoconf_toolchains_impl(repository_ctx): else: repository_ctx.file("BUILD", "# C++ toolchain autoconfiguration was disabled by BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 or BAZEL_USE_LEGACY_MACOS_TOOLCHAIN=0.") + if hasattr(repository_ctx, "repo_metadata"): + return repository_ctx.repo_metadata(reproducible = True) + return None + cc_autoconf_toolchains = repository_rule( environ = [ "BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN", @@ -66,6 +73,9 @@ def cc_autoconf_impl(repository_ctx, overriden_tools = dict()): Args: repository_ctx: repository context overriden_tools: dict of tool paths to use instead of autoconfigured tools + + Returns: + repo_metadata consumed by bazel """ cpu_value = get_cpu_value(repository_ctx) if _should_disable_toolchain(repository_ctx): @@ -96,6 +106,10 @@ def cc_autoconf_impl(repository_ctx, overriden_tools = dict()): else: configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools) + if hasattr(repository_ctx, "repo_metadata"): + return repository_ctx.repo_metadata(reproducible = False) + return None + MSVC_ENVVARS = [ "BAZEL_VC", "BAZEL_VC_FULL_VERSION", diff --git a/cc/system_library.bzl b/cc/system_library.bzl index 32a03eb5e..68477dace 100644 --- a/cc/system_library.bzl +++ b/cc/system_library.bzl @@ -330,6 +330,10 @@ alias( ), ) + if hasattr(repo_ctx, "repo_metadata"): + return repo_ctx.repo_metadata(reproducible = False) + return None + system_library = repository_rule( implementation = _system_library_impl, local = True, diff --git a/local_bazel.bzl b/local_bazel.bzl index 2933d389a..ab937b932 100644 --- a/local_bazel.bzl +++ b/local_bazel.bzl @@ -61,6 +61,10 @@ alias( ), ) + if hasattr(repository_ctx, "repo_metadata"): + return repository_ctx.repo_metadata(reproducible = False) + return None + local_bazel_import = repository_rule( implementation = _local_bazel_import_impl, environ = ["PATH"],