-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
C-bugCategory: bugCategory: bugCommand-metadataS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Description
Problem
If on one platform a crate enables a feature which enables a transitive dependency, and on another it doesn't, there's no way to capture this from the output of cargo metadata
.
Steps
- In this repo run
cargo metadata
orcargo metadata --filter-platform=x86_64-unknown-linux-gnu
. In this crate,serde
'sderive
feature is enabled forx86_64-apple-darwin
but not forx86_64-unknown-linux-gnu
, which means it depends onserde-derive
onx86_64-apple-darwin
but not onx86_64-unknown-linux-gnu
. - Try to work out whether
serde-derive
should be built onx86_64-unknown-linux-gnu
. - Find that there's not enough information to determine this.
Possible Solution(s)
- We could populate
DepKindInfo.target
for these dependencies, such that they can be identified as platform-specific - When running with
--filter-platform
for a non-matching platform, we could omit these dependencies. That may require callers to runcargo metadata
multiple times and splice the results, which would be a bit unfortunate.
Notes
Output of cargo version
: cargo 1.54.0 (5ae8d74b3 2021-06-22)
, also cargo 1.56.0-nightly (f559c109c 2021-08-26)
This issue makes it hard to translate crates.io packages for building with non-cargo build systems.
UebelAndre, sayrer, weihanglo, matthiasbeyer, gferon and 3 more
Metadata
Metadata
Assignees
Labels
C-bugCategory: bugCategory: bugCommand-metadataS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.