Skip to content

Commit

Permalink
Added support for --nolegacy_external_runfiles to rust_doc_test
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre committed Jan 19, 2023
1 parent 52231ef commit 9d1f614
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ build:clippy --output_groups=+clippy_checks
# https://github.com/bazelbuild/bazel/issues/8195
build --incompatible_disallow_empty_glob=true

# https://github.com/bazelbuild/bazel/issues/12821
build --nolegacy_external_runfiles

###############################################################################
## Custom user flags
##
Expand Down
11 changes: 11 additions & 0 deletions tools/rustdoc/rustdoc_test_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ fn write_test_runner_unix(
let mut content = vec![
"#!/usr/bin/env bash".to_owned(),
"".to_owned(),
// TODO: Instead of creating a symlink to mimic the behavior of
// --legacy_external_runfiles, this rule should be able to correcrtly
// sanitize the action args to run in a runfiles without this link.
"if [[ ! -e 'external' ]]; then ln -s ../ external ; fi".to_owned(),
"".to_owned(),
"exec env - \\".to_owned(),
];

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

0 comments on commit 9d1f614

Please sign in to comment.