Switch to -Zemit-artifact-notifications

This is the renamed version of `-Zemit-directives`.
This commit is contained in:
Alex Crichton 2019-05-08 08:43:09 -07:00
parent 03a72aacf3
commit 95e240448d
2 changed files with 42 additions and 9 deletions

View File

@ -233,7 +233,7 @@ fn rustc<'a, 'cfg>(
let extract_rendered_errors = if rmeta_produced { let extract_rendered_errors = if rmeta_produced {
match cx.bcx.build_config.message_format { match cx.bcx.build_config.message_format {
MessageFormat::Json => { MessageFormat::Json => {
rustc.arg("-Zemit-directives"); rustc.arg("-Zemit-artifact-notifications");
false false
} }
MessageFormat::Human => { MessageFormat::Human => {
@ -241,7 +241,7 @@ fn rustc<'a, 'cfg>(
.arg("--error-format=json") .arg("--error-format=json")
.arg("--json-rendered=termcolor") .arg("--json-rendered=termcolor")
.arg("-Zunstable-options") .arg("-Zunstable-options")
.arg("-Zemit-directives"); .arg("-Zemit-artifact-notifications");
true true
} }
@ -1119,7 +1119,7 @@ fn on_stderr_line(
} }
// In some modes of execution we will execute rustc with `-Z // In some modes of execution we will execute rustc with `-Z
// emit-directives` to look for metadata files being produced. When this // emit-artifact-notifications` to look for metadata files being produced. When this
// happens we may be able to start subsequent compilations more quickly than // happens we may be able to start subsequent compilations more quickly than
// waiting for an entire compile to finish, possibly using more parallelism // waiting for an entire compile to finish, possibly using more parallelism
// available to complete a compilation session more quickly. // available to complete a compilation session more quickly.
@ -1128,16 +1128,16 @@ fn on_stderr_line(
// that a metadata file has been produced. // that a metadata file has been produced.
if look_for_metadata_directive { if look_for_metadata_directive {
#[derive(serde::Deserialize)] #[derive(serde::Deserialize)]
struct CompilerDirective { struct ArtifactNotification {
directive: String, artifact: String,
} }
if let Ok(directive) = serde_json::from_str::<CompilerDirective>(compiler_message.get()) { if let Ok(artifact) = serde_json::from_str::<ArtifactNotification>(compiler_message.get()) {
log::trace!("found directive from rustc: `{}`", directive.directive); log::trace!("found directive from rustc: `{}`", artifact.artifact);
if directive.directive.starts_with("metadata file written") { if artifact.artifact.ends_with(".rmeta") {
log::debug!("looks like metadata finished early!"); log::debug!("looks like metadata finished early!");
state.rmeta_produced(); state.rmeta_produced();
return Ok(())
} }
return Ok(())
} }
} }

View File

@ -4599,3 +4599,36 @@ fn tricky_pipelining() {
.env("CARGO_BUILD_PIPELINING", "true") .env("CARGO_BUILD_PIPELINING", "true")
.run(); .run();
} }
#[test]
fn pipelining_works() {
if !crate::support::is_nightly() {
return;
}
let foo = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
[dependencies]
bar = { path = "bar" }
"#,
)
.file("src/lib.rs", "extern crate bar;")
.file("bar/Cargo.toml", &basic_lib_manifest("bar"))
.file("bar/src/lib.rs", "")
.build();
foo.cargo("build")
.env("CARGO_BUILD_PIPELINING", "true")
.with_stdout("")
.with_stderr("\
[COMPILING] [..]
[COMPILING] [..]
[FINISHED] [..]
")
.run();
}