Skip to content

Commit

Permalink
run coverage before doc-build so it doesn't delete the docs that were…
Browse files Browse the repository at this point in the history
… just built

related issue: rust-lang/cargo#9447
  • Loading branch information
syphar committed May 2, 2021
1 parent 4ef69ca commit d6098bc
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/docbuilder/rustwide_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,16 +516,24 @@ impl RustwideBuilder {
let mut storage = LogStorage::new(LevelFilter::Info);
storage.set_max_size(limits.max_log_size());

// we have to run coverage before the doc-build because currently it
// deletes the doc-target folder.
// https://github.com/rust-lang/cargo/issues/9447
let doc_coverage = match self.get_coverage(target, build, metadata, limits) {
Ok(cov) => cov,
Err(err) => {
log::info!("error when trying to get coverage: {}", err);
log::info!("continuing anyways.");
None
}
};

let successful = logging::capture(&storage, || {
self.prepare_command(build, target, metadata, limits, rustdoc_flags)
.and_then(|command| command.run().map_err(failure::Error::from))
.is_ok()
});
let doc_coverage = if successful {
self.get_coverage(target, build, metadata, limits)?
} else {
None
};

// If we're passed a default_target which requires a cross-compile,
// cargo will put the output in `target/<target>/doc`.
// However, if this is the default build, we don't want it there,
Expand Down

0 comments on commit d6098bc

Please sign in to comment.