mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Auto merge of #12829 - Nilstrieb:verbosebuildrs, r=weihanglo
Print environment variables for build script executions with `-vv` ### What does this PR try to resolve? When debugging complicated builds (I was trying to figure out how `cargo-miri` cross-compiles compiler_builtins without needing a C cross compiler), it's useful to see all the environment variables passed to the build script. This is also consistent with other commands. ### How should we test and review this PR? I tested it locally by creating a small crate with an empty `build.rs` and building it. Additionally, a test is included.
This commit is contained in:
commit
a275529de2
@ -353,6 +353,10 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
|
|||||||
);
|
);
|
||||||
cmd.env_remove("RUSTFLAGS");
|
cmd.env_remove("RUSTFLAGS");
|
||||||
|
|
||||||
|
if cx.bcx.ws.config().extra_verbose() {
|
||||||
|
cmd.display_env_vars();
|
||||||
|
}
|
||||||
|
|
||||||
// Gather the set of native dependencies that this package has along with
|
// Gather the set of native dependencies that this package has along with
|
||||||
// some other variables to close over.
|
// some other variables to close over.
|
||||||
//
|
//
|
||||||
|
@ -180,6 +180,22 @@ fn rustc_bootstrap() {
|
|||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn build_script_env_verbose() {
|
||||||
|
let build_rs = r#"
|
||||||
|
fn main() {}
|
||||||
|
"#;
|
||||||
|
let p = project()
|
||||||
|
.file("Cargo.toml", &basic_manifest("verbose-build", "0.0.1"))
|
||||||
|
.file("src/lib.rs", "")
|
||||||
|
.file("build.rs", build_rs)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
p.cargo("check -vv")
|
||||||
|
.with_stderr_contains("[RUNNING] `[..]CARGO=[..]build-script-build`")
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
fn build_script_sees_cfg_target_feature() {
|
fn build_script_sees_cfg_target_feature() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user