Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for --nolegacy_external_runfiles to rust_doc_test #1790

Merged
merged 2 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 (!(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