-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Introduce --all-features
flag to cargo vendor
#12596
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
Comments
(Please let me know if this isn't the right place to discuss this.) Especially the recursive option could be quite valuable. There's already something called |
I'm assuming we already vendor dependencies in that mode because we generate lockfiles in that mode. iiuc whats being wanted here is instead "enable all features for all of my transitive dependencies". I believe If you are ok with |
Thanks for the suggestion! The cargo team discussed this and decided to close for now. We had some concerns about the complexity of implementing such a feature since cargo wouldn't know which versions of those optional dependencies to include (in particular, versions that would result in a valid resolve). There were also concerns about vendoring things that weren't already tracked in We recommend that if you are interested to try to create an external command that is capable of generating those extra vendored packages, or just create a dummy workspace that has all dependencies with all features. With external tooling you can iterate and gather feedback on it. |
Uh oh!
There was an error while loading. Please reload this page.
Problem
When using cargo vendor, the only transitive dependencies that get vendored are the ones of enabled features at the original time of vendoring. This is an issue when a user that only has access to the vendored crates later tries to enable a feature of a crate that was not originally enabled. Example flow:
cargo add tokio --features full
cargo vendor vendor_dir
mio
feature (not underfull
feature flag), but transitive dependencies were not included in vendored directory and is unable to buildProposed Solution
I propose introducing an
--all-features
flag tocargo vendor
that would vendor all optional dependencies behind any feature flags for any dependencies of a project. This is simply a convenience so that not all features have to be manually specified.Another possibility would be to have different levels for vendoring for "all features":
--all-features=top
would only vendor dependencies for all features for top level dependencies (all optional dependencies fortokio
in previous example)--all-features=recursive
would recursively vendor dependencies for all features for all dependencies (all optional depencies fortokio
andmio
and so on, in previous example)Notes
Cargo seems to have an all-features flag that is similar to what I am thinking of.
I'd be glad to contribute to this! 😃
The text was updated successfully, but these errors were encountered: