Make -Zemit-artifact-notifications also emit the artifact type
This is easier for tooling to handle than trying to reverse-engineer it from the filename extension.
This commit is contained in:
parent
09189591c4
commit
6c38625942
7 changed files with 12 additions and 9 deletions
|
@ -96,7 +96,7 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(sess: &'a Session,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if sess.opts.debugging_opts.emit_artifact_notifications {
|
if sess.opts.debugging_opts.emit_artifact_notifications {
|
||||||
sess.parse_sess.span_diagnostic.emit_artifact_notification(&out_filename);
|
sess.parse_sess.span_diagnostic.emit_artifact_notification(&out_filename, "link");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ pub trait Emitter {
|
||||||
/// Emit a notification that an artifact has been output.
|
/// Emit a notification that an artifact has been output.
|
||||||
/// This is currently only supported for the JSON format,
|
/// This is currently only supported for the JSON format,
|
||||||
/// other formats can, and will, simply ignore it.
|
/// other formats can, and will, simply ignore it.
|
||||||
fn emit_artifact_notification(&mut self, _path: &Path) {}
|
fn emit_artifact_notification(&mut self, _path: &Path, _artifact_type: &str) {}
|
||||||
|
|
||||||
/// Checks if should show explanations about "rustc --explain"
|
/// Checks if should show explanations about "rustc --explain"
|
||||||
fn should_show_explain(&self) -> bool {
|
fn should_show_explain(&self) -> bool {
|
||||||
|
|
|
@ -769,8 +769,8 @@ impl Handler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn emit_artifact_notification(&self, path: &Path) {
|
pub fn emit_artifact_notification(&self, path: &Path, artifact_type: &str) {
|
||||||
self.emitter.borrow_mut().emit_artifact_notification(path);
|
self.emitter.borrow_mut().emit_artifact_notification(path, artifact_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1052,7 +1052,8 @@ fn encode_and_write_metadata<'tcx>(
|
||||||
tcx.sess.fatal(&format!("failed to write {}: {}", out_filename.display(), e));
|
tcx.sess.fatal(&format!("failed to write {}: {}", out_filename.display(), e));
|
||||||
}
|
}
|
||||||
if tcx.sess.opts.debugging_opts.emit_artifact_notifications {
|
if tcx.sess.opts.debugging_opts.emit_artifact_notifications {
|
||||||
tcx.sess.parse_sess.span_diagnostic.emit_artifact_notification(&out_filename);
|
tcx.sess.parse_sess.span_diagnostic
|
||||||
|
.emit_artifact_notification(&out_filename, "metadata");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,8 +92,8 @@ impl Emitter for JsonEmitter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn emit_artifact_notification(&mut self, path: &Path) {
|
fn emit_artifact_notification(&mut self, path: &Path, artifact_type: &str) {
|
||||||
let data = ArtifactNotification { artifact: path };
|
let data = ArtifactNotification { artifact: path, emit: artifact_type };
|
||||||
let result = if self.pretty {
|
let result = if self.pretty {
|
||||||
writeln!(&mut self.dst, "{}", as_pretty_json(&data))
|
writeln!(&mut self.dst, "{}", as_pretty_json(&data))
|
||||||
} else {
|
} else {
|
||||||
|
@ -185,6 +185,8 @@ struct DiagnosticCode {
|
||||||
struct ArtifactNotification<'a> {
|
struct ArtifactNotification<'a> {
|
||||||
/// The path of the artifact.
|
/// The path of the artifact.
|
||||||
artifact: &'a Path,
|
artifact: &'a Path,
|
||||||
|
/// What kind of artifact we're emitting.
|
||||||
|
emit: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Diagnostic {
|
impl Diagnostic {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"artifact":"$TEST_BUILD_DIR/emit-artifact-notifications.nll/libemit_artifact_notifications.rmeta"}
|
{"artifact":"$TEST_BUILD_DIR/emit-artifact-notifications.nll/libemit_artifact_notifications.rmeta","emit":"metadata"}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"artifact":"$TEST_BUILD_DIR/emit-artifact-notifications/libemit_artifact_notifications.rmeta"}
|
{"artifact":"$TEST_BUILD_DIR/emit-artifact-notifications/libemit_artifact_notifications.rmeta","emit":"metadata"}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue