Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 7f39c94

Browse files
committed
Add some traces
1 parent 4de9136 commit 7f39c94

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/build/cargo.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ fn run_cargo(
171171
let pkg_names = spec.into_package_id_specs(&ws)?.iter()
172172
.map(|pkg_spec| pkg_spec.name().to_owned())
173173
.collect();
174+
trace!("Specified packages to be built by Cargo: {:#?}", pkg_names);
174175

175176
// Since Cargo build routine will try to regenerate the unit dep graph,
176177
// we need to clear the existing dep graph.

src/build/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,8 @@ impl Internals {
548548
};
549549
cx.build_plan.prepare_work(&manifest_path, &modified, needs_to_run_cargo)
550550
};
551+
trace!("Specified work: {:?}", work);
552+
551553
match work {
552554
// Cargo performs the full build and returns
553555
// appropriate diagnostics/analysis data

src/build/plan.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
//! build scripts).
2626
2727
use std::collections::{HashMap, HashSet};
28+
use std::ffi::OsStr;
2829
use std::fmt;
2930
use std::path::{Path, PathBuf};
3031
use std::sync::{Arc, Mutex};
@@ -468,7 +469,6 @@ impl PackageMap {
468469
}
469470
}
470471

471-
#[derive(Debug)]
472472
crate struct JobQueue(Vec<ProcessBuilder>);
473473

474474
fn proc_arg<T: AsRef<OsStr>>(prc: &ProcessBuilder, key: T) -> Option<&std::ffi::OsStr> {
@@ -480,6 +480,19 @@ fn proc_arg<T: AsRef<OsStr>>(prc: &ProcessBuilder, key: T) -> Option<&std::ffi::
480480
.map(|x| x.as_os_str())
481481
}
482482

483+
impl fmt::Debug for JobQueue {
484+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
485+
write!(f, "JobQueue: [")?;
486+
for prog in self.0.iter().rev() {
487+
let name = proc_arg(prog, "--crate-name").unwrap();
488+
let typ_ = proc_arg(prog, "--crate-type").unwrap_or_else(|| OsStr::new("<unknown>"));
489+
write!(f, "{:?} ({:?}), ", name, typ_);
490+
}
491+
write!(f, "]")?;
492+
Ok(())
493+
}
494+
}
495+
483496
impl JobQueue {
484497
crate fn dequeue(&mut self) -> Option<ProcessBuilder> {
485498
self.0.pop()

0 commit comments

Comments
 (0)