Skip to content

Commit 112242b

Browse files
authored
Prevent crates_vendor from restarting bazel. (#1791)
Previously, crates_vendor had the potential to restart bazel every time it runs, as the bazel startup options are dependent on PATH.
1 parent 52231ef commit 112242b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crate_universe/private/crates_vendor.bzl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ export RUNTIME_PWD="$(pwd)"
1212
if [[ -z "${{BAZEL_REAL:-}}" ]]; then
1313
BAZEL_REAL="$(which bazel || echo 'bazel')"
1414
fi
15-
eval exec env - BAZEL_REAL="${{BAZEL_REAL}}" BUILD_WORKSPACE_DIRECTORY="${{BUILD_WORKSPACE_DIRECTORY}}" {env} \\
15+
16+
# The path needs to be preserved to prevent bazel from starting with different
17+
# startup options (requiring a restart of bazel).
18+
# If you provide an empty path, bazel starts itself with
19+
# --default_system_javabase set to the empty string, but if you provide a path,
20+
# it may set it to a value (eg. "/usr/local/buildtools/java/jdk11").
21+
eval exec env - BAZEL_REAL="${{BAZEL_REAL}}" BUILD_WORKSPACE_DIRECTORY="${{BUILD_WORKSPACE_DIRECTORY}}" PATH="${{PATH}}" {env} \\
1622
"{bin}" {args} "$@"
1723
"""
1824

0 commit comments

Comments
 (0)