Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/cargo/ops/cargo_compile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,14 @@ pub fn create_bcx<'a, 'gctx>(

for (index, unit) in units.into_iter().enumerate() {
let index = index as u64;
let dependencies = unit_graph
.get(unit)
.map(|deps| {
deps.iter()
.filter_map(|dep| unit_to_index.get(&dep.unit).copied())
.collect()
})
.unwrap_or_default();
logger.log(LogMessage::UnitRegistered {
package_id: unit.pkg.package_id().to_spec(),
target: (&unit.target).into(),
Expand All @@ -547,6 +555,7 @@ pub fn create_bcx<'a, 'gctx>(
.map(|s| s.as_str().to_owned())
.collect(),
requested: root_unit_indexes.contains(&index),
dependencies,
});
}
let elapsed = ws.gctx().creation_time().elapsed().as_secs_f64();
Expand Down
1 change: 1 addition & 0 deletions src/cargo/ops/cargo_report/timings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ fn prepare_context(log: &Path, run_id: &RunId) -> CargoResult<RenderContext<'sta
index,
features,
requested,
dependencies: _,
} => {
if requested {
requested_units.insert(index);
Expand Down
3 changes: 3 additions & 0 deletions src/cargo/util/log_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ pub enum LogMessage {
/// like via the `-p` flag or the default workspace members.
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
requested: bool,
/// Unit indices that this unit depends on.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
dependencies: Vec<u64>,
},
/// Emitted when a compilation unit starts.
UnitStarted {
Expand Down
8 changes: 8 additions & 0 deletions tests/testsuite/build_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,11 @@ fn log_msg_unit_graph() {
"timestamp": "[..]T[..]Z"
},
{
"dependencies": [
0,
1,
4
],
"index": 2,
"mode": "doc",
"package_id": "path+[ROOTURL]/foo#0.0.0",
Expand Down Expand Up @@ -633,6 +638,9 @@ fn log_msg_unit_graph() {
"timestamp": "[..]T[..]Z"
},
{
"dependencies": [
3
],
"index": 4,
"mode": "run-custom-build",
"package_id": "path+[ROOTURL]/foo#0.0.0",
Expand Down