Skip to content

Commit 6f005ef

Browse files
local_crate_repository: mark non-reproducible
`local_crate_repository` symlinks files from the main workspace into its external repo. Bazel >= 9.0.1 replants those symlinks as relative `..\_main\...` paths when placing reproducible repos in the contents cache. On Windows the replanted paths dangle from the action execroot (no `execroot/_main/external/_main`), so actions fail to read the crate sources. Mark these repos non-reproducible unconditionally so the original absolute symlinks survive on every platform. The tradeoff is loss of remote-repo-contents-cache eligibility; the only per-invocation work that re-runs on a cold output_base is the toml2json parse and BUILD.bazel generation, which is negligible. See bazelbuild/bazel#29515.
1 parent 804a0bf commit 6f005ef

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

rs/private/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ bzl_library(
4747
":registry_utils",
4848
":repository_utils",
4949
":toml2json",
50-
"@bazel_features//:features",
5150
"@bazel_tools//tools/build_defs/repo:cache.bzl",
5251
"@bazel_tools//tools/build_defs/repo:utils.bzl",
5352
],

rs/private/crate_repository.bzl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
load("@bazel_features//:features.bzl", "bazel_features")
21
load("@bazel_tools//tools/build_defs/repo:cache.bzl", "get_default_canonical_id")
32
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "patch")
43
load(":cargo_credentials.bzl", "load_cargo_credentials", "registry_auth_headers")
@@ -98,9 +97,14 @@ def _local_crate_repository_impl(rctx):
9897

9998
rctx.file("BUILD.bazel", _generate_build_file(rctx, cargo_toml))
10099

101-
return rctx.repo_metadata(
102-
reproducible = bazel_features.external_deps.repo_rules_relativize_symlinks,
103-
)
100+
# Symlinks into the main workspace get replanted by Bazel >= 9.0.1 as
101+
# relative `..\_main\...` paths before reproducible repos enter the
102+
# contents cache. On Windows those paths dangle from the action
103+
# execroot (no `execroot/_main/external/_main`), so actions fail to
104+
# read the crate sources. Marking non-reproducible skips replanting
105+
# and keeps the original absolute symlinks, which resolve from both
106+
# views. See https://github.com/bazelbuild/bazel/issues/29515.
107+
return rctx.repo_metadata(reproducible = False)
104108

105109
local_crate_repository = repository_rule(
106110
implementation = _local_crate_repository_impl,

0 commit comments

Comments
 (0)