-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Optional Dependencies #766
Comments
Hmm, we should have support for this already with Could you provide specific steps to reproduce the issue so I could investigate? |
Here are the steps to reproduce: mkdir foo && cd foo
cargo init
cargo add sqlx --features sqlite
cargo tree | grep mysql
# No match because mysql is only an optional dependency of sqlx which is not activated here in foo
cargo cyclonedx
cat foo.cdx.xml | grep mysql
# It shows up here, even if the feature is not activated |
Hey @guenhter/@Shnatsel I was checking the cargo tree implementation to understand how are they handling such cases. Is that a good starting point to resolve this issue? I have narrowed it down to this method -> https://github.com/rust-lang/cargo/blob/d8cb5fb7f8f66fc9b4ba3d80b089474164a8a83d/src/cargo/ops/resolve.rs#L137 Let me know your thoughts on this. |
We should be passing the right feature combinations to Note that |
Okay so ideally this should be handled as part of |
Hi,
when I use a create in my library which has many optional features like
sqlx
(https://github.com/launchbadge/sqlx), and I create a sbom for my project, it also considers all the dependencies of the features which are actually not active.Running cargo tree only lists the dependencies of activated features and lets the rest away. This would be very nice also to have for the sbom. For me personally this currently makes some problems because I process the sbom further (e.g. for vulnerability testing) and that one fails because of dependencies which are in actually not used by me.
It would be nice to consider those optional dependencies and filter them out in case they are not used.
The text was updated successfully, but these errors were encountered: