-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PackageId to "dependencies" in cargo metadata #7289
Comments
Possibly related to #5583? |
This is the expected behavior. The It may be possible to place the resolved package ID into the package Can you say more about what you're trying to do? Why do you need to correlate the resolve with the Dependency? More information is being added in #7132, which may help. |
Hm, yeah, it looks like my scheme isn't working for The specific goal is to match the resolved dependencies to a particular target by matching up the dep kind against the target kind. #7132 will help with that, but it would still be nice to be able to unambiguously match the resolved dependency with its corresponding unresolved dependency. |
I guess I can map the resolved dep's pkgid -> manifest -> name, and match that against dependency -> name. |
Can you say more about why you want to match them up? Perhaps explain your use case? |
I'm writing a tool to automatically generate Buck build rules from Cargo.toml so we can import things from crates.io and build from source with Buck. I need the target info so I can generate the appropriate corresponding Buck rule. In general I've found it useful to fully grok the Cargo metadata in doing this. |
I think the best solution here may be too add something like a |
I would like that as well to be able to operate over all the packages at once regardless of whether they are dependencies or local crates. I'm currently parsing the
But building the dependency graph that way doesn't account for features and target and is quite error-prone. Being able to ask |
Problem
In cargo metadata, the
name
field indeps
has-
transformed to_
, which means you need to normalize -/_ in order to compare it with thename
field independencies
.For example:
Steps
proc-macro2
as a dependencycargo metadata
and compare thedependency
anddeps
fieldsPossible Solution(s)
The
deps
entries should have some field which directly corresponds to a field independencies
.Notes
Output of
cargo version
:cargo 1.38.0-nightly (e853aa9 2019-08-09)
The text was updated successfully, but these errors were encountered: