Skip to content
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

Support graph pruning by target #63

Closed
Jake-Shadle opened this issue Dec 17, 2019 · 8 comments · Fixed by #93
Closed

Support graph pruning by target #63

Jake-Shadle opened this issue Dec 17, 2019 · 8 comments · Fixed by #93
Labels
enhancement New feature or request

Comments

@Jake-Shadle
Copy link
Member

cargo-metadata has added support for kind/target for dependencies rust-lang/cargo#7132, this would allow users to specify which targets they actually care about, rather than...all of them.

For example, the ring crate has a dependency on web-sys which pulls in a ton of additional dependencies, but they are only relevant if you are building ring for wasm, however you currently can't determine that is the case with cargo-metadata, so cargo-deny considers web-sys and all of its transitive dependencies for licensing, multiple versions, and security vulnerabilities, even if the crate is never actually built for wasm.

@repi
Copy link
Contributor

repi commented Dec 24, 2019

Looks like this target cfg expressions actually is in the current 1.40 stable version also, got this when running cargo metadata:

image

@Jake-Shadle
Copy link
Member Author

Ahh nice!

@repi
Copy link
Contributor

repi commented Dec 24, 2019

We would need to build a small cfg expression parser, but that is a pretty simple syntax :)

@Jake-Shadle
Copy link
Member Author

https://docs.rs/parse_cfg/2.0.0/parse_cfg/ 😉

@repi
Copy link
Contributor

repi commented Dec 24, 2019

Nice! Except CC0 for code, not nice

@Jake-Shadle
Copy link
Member Author

Yah, I think maybe rolling our own, similar to how spdx works, where it can both parse, as well as evaluate, would probably make sense.

@repi
Copy link
Contributor

repi commented Dec 24, 2019

Agreed, and sounds like fun also. Would be useful in multiple projects also, definitely in cargo-about but anything that parses cargo.lock and wants accurate results given specific platform and set of features.

@briansmith
Copy link

I have a pretty large project for which I use cargo deny currently to report dependencies. I would very much like to report dependencies that apply to the current target (OS and arch) only. Actually, we support about 8 platforms in our product and we want separately-pruned dependencies reports for each one. I would be very happy to test this and report back, or review code, or otherwise help with this.

Also, based on briansmith/ring#904 I think others have similar needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants