Skip to content

Commit 77a7041

Browse files
epageelchukc
authored andcommitted
download transitive deps of artifact deps on target platform
1 parent 24738d8 commit 77a7041

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

src/cargo/core/package.rs

+19-1
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ impl<'gctx> PackageSet<'gctx> {
519519
target_data,
520520
force_all_targets,
521521
);
522-
for (pkg_id, _dep) in filtered_deps {
522+
for (pkg_id, deps) in filtered_deps {
523523
collect_used_deps(
524524
used,
525525
resolve,
@@ -529,6 +529,24 @@ impl<'gctx> PackageSet<'gctx> {
529529
target_data,
530530
force_all_targets,
531531
)?;
532+
let artifact_kinds = deps.iter().filter_map(|dep| {
533+
Some(
534+
dep.artifact()?
535+
.target()?
536+
.to_resolved_compile_kind(*requested_kinds.iter().next().unwrap()),
537+
)
538+
});
539+
for artifact_kind in artifact_kinds {
540+
collect_used_deps(
541+
used,
542+
resolve,
543+
pkg_id,
544+
has_dev_units,
545+
artifact_kind,
546+
target_data,
547+
force_all_targets,
548+
)?;
549+
}
532550
}
533551
Ok(())
534552
}

tests/testsuite/artifact_dep.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -1646,16 +1646,17 @@ fn dep_of_artifact_dep_same_target_specified() {
16461646
.with_status(0)
16471647
.run();
16481648

1649-
// TODO This command currently fails due to a bug in cargo but it should be fixed so that it succeeds in the future.
16501649
p.cargo("tree -Z bindeps")
16511650
.masquerade_as_nightly_cargo(&["bindeps"])
1652-
.with_stderr_data(
1651+
.with_stdout_data(
16531652
r#"...
1654-
no entry found for key
1653+
foo v0.1.0 ([ROOT]/foo)
1654+
└── bar v0.1.0 ([ROOT]/foo/bar)
1655+
└── baz v0.1.0 ([ROOT]/foo/baz)
16551656
...
16561657
"#,
16571658
)
1658-
.with_status(101)
1659+
.with_status(0)
16591660
.run();
16601661
}
16611662

@@ -1827,17 +1828,17 @@ fn proc_macro_in_artifact_dep() {
18271828

18281829
p.cargo("check -Z bindeps")
18291830
.masquerade_as_nightly_cargo(&["bindeps"])
1830-
.with_stderr_data(str![[r#"
1831+
.with_stderr_data(
1832+
r#"...
18311833
[UPDATING] `dummy-registry` index
18321834
[LOCKING] 2 packages to latest compatible versions
18331835
[DOWNLOADING] crates ...
1834-
[DOWNLOADED] bin-uses-pm v1.0.0 (registry `dummy-registry`)
1835-
[DOWNLOADING] crates ...
1836-
thread 'main' panicked at src/cargo/core/compiler/unit_dependencies.rs:1035:33:
1837-
expected pm v1.0.0 to be downloaded
1838-
[NOTE] run with `RUST_BACKTRACE=1` environment variable to display a backtrace
1836+
[ERROR] failed to download from `[ROOTURL]/dl/pm/1.0.0/download`
18391837
1840-
"#]])
1838+
Caused by:
1839+
[37] Could not read a file:// file (Couldn't open file [ROOT]/dl/pm/1.0.0/download)
1840+
"#,
1841+
)
18411842
.with_status(101)
18421843
.run();
18431844
}

0 commit comments

Comments
 (0)