Skip to content

Commit e876081

Browse files
local_crate_repository: mark non-reproducible on Windows
Bazel >= 9.0.1 replants workspace-pointing symlinks as relative `..\_main\...` paths when placing reproducible repos in the contents cache. On Windows those paths resolve at `<output_base>/external/<repo>` but dangle from `<output_base>/execroot/_main/external/<repo>` (there is no `execroot/_main/external/_main`), so actions fail to read the crate sources. Marking the repo non-reproducible on Windows skips the replanting, so the original absolute symlinks survive and resolve from both views. The tradeoff is loss of remote-repo-contents-cache eligibility on Windows. See bazelbuild/bazel#29515.
1 parent 804a0bf commit e876081

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

rs/private/crate_repository.bzl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,16 @@ def _local_crate_repository_impl(rctx):
9898

9999
rctx.file("BUILD.bazel", _generate_build_file(rctx, cargo_toml))
100100

101+
# On Windows, Bazel >= 9.0.1 replants workspace symlinks as relative
102+
# `..\_main\...` paths before placing reproducible repos in the contents
103+
# cache. Those resolve at the output_base but dangle from the action
104+
# execroot (there is no `execroot/_main/external/_main`). Marking the
105+
# repo non-reproducible on Windows skips the replanting and keeps the
106+
# original absolute symlinks, which resolve from both paths.
107+
# See https://github.com/bazelbuild/bazel/issues/29515.
108+
is_windows = rctx.os.name.lower().startswith("windows")
101109
return rctx.repo_metadata(
102-
reproducible = bazel_features.external_deps.repo_rules_relativize_symlinks,
110+
reproducible = bazel_features.external_deps.repo_rules_relativize_symlinks and not is_windows,
103111
)
104112

105113
local_crate_repository = repository_rule(

0 commit comments

Comments
 (0)