Skip to content

Commit 6fb9de7

Browse files
sypharJoshua Nelson
authored and
Joshua Nelson
committed
run coverage before doc-build so it doesn't delete the docs that were just built
related issue: rust-lang/cargo#9447
1 parent 4ef69ca commit 6fb9de7

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/docbuilder/rustwide_builder.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,16 +516,24 @@ impl RustwideBuilder {
516516
let mut storage = LogStorage::new(LevelFilter::Info);
517517
storage.set_max_size(limits.max_log_size());
518518

519+
// we have to run coverage before the doc-build because currently it
520+
// deletes the doc-target folder.
521+
// https://github.com/rust-lang/cargo/issues/9447
522+
let doc_coverage = match self.get_coverage(target, build, metadata, limits) {
523+
Ok(cov) => cov,
524+
Err(err) => {
525+
log::info!("error when trying to get coverage: {}", err);
526+
log::info!("continuing anyways.");
527+
None
528+
}
529+
};
530+
519531
let successful = logging::capture(&storage, || {
520532
self.prepare_command(build, target, metadata, limits, rustdoc_flags)
521533
.and_then(|command| command.run().map_err(failure::Error::from))
522534
.is_ok()
523535
});
524-
let doc_coverage = if successful {
525-
self.get_coverage(target, build, metadata, limits)?
526-
} else {
527-
None
528-
};
536+
529537
// If we're passed a default_target which requires a cross-compile,
530538
// cargo will put the output in `target/<target>/doc`.
531539
// However, if this is the default build, we don't want it there,

0 commit comments

Comments
 (0)