-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #9566 - ehuss:relative-rustc-path, r=alexcrichton
Fix rustc/rustdoc config values to be config-relative. The `rustc`, `rustdoc`, `rustc_wrapper`, and `rustc_workspace_wrapper` config values (in the `[build]` table) were being interpreted literally. This caused a problem if you used a relative path like `foo/rustc`. This would be interpreted as a relative path from whatever cwd cargo launches rustc from, which changes for different scenarios, making it essentially unusuable (since crates.io dependencies wouldn't be buildable). Additionally, due to rust-lang/rust#37868, it is a bad idea to use relative paths. This changes it so that those paths are config-relative. Bare names (like "my-rustc-program") still use PATH as before. This also includes a commit to centralize the rustc-wrapper program used by several tests so that it isn't built multiple times (and to allow several tests to work on windows). Fixes #8202
- Loading branch information
Showing
9 changed files
with
121 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ pub mod git; | |
pub mod paths; | ||
pub mod publish; | ||
pub mod registry; | ||
pub mod tools; | ||
|
||
/* | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//! Common executables that can be reused by various tests. | ||
use crate::{basic_manifest, paths, project}; | ||
use lazy_static::lazy_static; | ||
use std::path::PathBuf; | ||
use std::sync::Mutex; | ||
|
||
lazy_static! { | ||
static ref ECHO_WRAPPER: Mutex<Option<PathBuf>> = Mutex::new(None); | ||
} | ||
|
||
/// Returns the path to an executable that works as a wrapper around rustc. | ||
/// | ||
/// The wrapper will echo the command line it was called with to stderr. | ||
pub fn echo_wrapper() -> PathBuf { | ||
let mut lock = ECHO_WRAPPER.lock().unwrap(); | ||
if let Some(path) = &*lock { | ||
return path.clone(); | ||
} | ||
let p = project() | ||
.at(paths::global_root().join("rustc-echo-wrapper")) | ||
.file("Cargo.toml", &basic_manifest("rustc-echo-wrapper", "1.0.0")) | ||
.file( | ||
"src/main.rs", | ||
r#" | ||
fn main() { | ||
let args = std::env::args().collect::<Vec<_>>(); | ||
eprintln!("WRAPPER CALLED: {}", args[1..].join(" ")); | ||
let status = std::process::Command::new(&args[1]) | ||
.args(&args[2..]).status().unwrap(); | ||
std::process::exit(status.code().unwrap_or(1)); | ||
} | ||
"#, | ||
) | ||
.build(); | ||
p.cargo("build").run(); | ||
let path = p.bin("rustc-echo-wrapper"); | ||
*lock = Some(path.clone()); | ||
path | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.