Skip to content

Commit 1be9145

Browse files
committed
Added support for --nolegacy_external_runfiles to rust_doc_test
1 parent 52231ef commit 1be9145

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.bazelrc

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ build:clippy --output_groups=+clippy_checks
2727
# https://github.com/bazelbuild/bazel/issues/8195
2828
build --incompatible_disallow_empty_glob=true
2929

30+
# https://github.com/bazelbuild/bazel/issues/12821
31+
build --nolegacy_external_runfiles
32+
3033
###############################################################################
3134
## Custom user flags
3235
##

tools/rustdoc/rustdoc_test_writer.rs

+11
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ fn write_test_runner_unix(
174174
let mut content = vec![
175175
"#!/usr/bin/env bash".to_owned(),
176176
"".to_owned(),
177+
// TODO: Instead of creating a symlink to mimic the behavior of
178+
// --legacy_external_runfiles, this rule should be able to correcrtly
179+
// sanitize the action args to run in a runfiles without this link.
180+
"if [[ ! -e 'external' ]]; then ln -s ../ external ; fi".to_owned(),
181+
"".to_owned(),
177182
"exec env - \\".to_owned(),
178183
];
179184

@@ -228,6 +233,12 @@ fn write_test_runner_windows(
228233
let content = vec![
229234
"@ECHO OFF".to_owned(),
230235
"".to_owned(),
236+
// TODO: Instead of creating a symlink to mimic the behavior of
237+
// --legacy_external_runfiles, this rule should be able to correcrtly
238+
// sanitize the action args to run in a runfiles without this link.
239+
"powershell.exe -c \"if (!(Test-Path .\\external)) { New-Item -Path .\\external -ItemType SymbolicLink -Value ..\\ }\""
240+
.to_owned(),
241+
"".to_owned(),
231242
format!("powershell.exe -c \"{env_str} ; & {argv_str}\""),
232243
"".to_owned(),
233244
];

0 commit comments

Comments
 (0)