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

add option to exclude dev and build dependencies #101

Open
piotr-sk opened this issue Oct 7, 2024 · 2 comments · May be fixed by #102
Open

add option to exclude dev and build dependencies #101

piotr-sk opened this issue Oct 7, 2024 · 2 comments · May be fixed by #102

Comments

@piotr-sk
Copy link
Collaborator

piotr-sk commented Oct 7, 2024

We use this crate to filter out sources that do not need full software clearing,
so are not interested in the dev or build dependencies.

It is possible to identify these clearly with cargo tree by specifying --edges normal flag (other potentially interesting options: no-build, no-dev, no-proc-macro).
Unfortunately, the flag is not available with cargo metadata as discussed in rust-lang/cargo#10718.

Proposition: add an optional boolean flag --exclude-dev-and-build-deps to cargo vendor filterer (alternative: mimic cargo tree edges options).
If the flag is set, after removing the unwanted platforms and tiers, call cargo tree to get a list of packages required for the application with all features.
Iterate over the packages HashMap and remove all entries not present in the list received from cargo tree.

Expected behavior when running on the crate itself: when the flag is set the once_cell dev package shall be removed -> add a unit test.

By default the flag is not active for backwards compatibility.

Current workaround: manually remove development crates (it is annoying)

Let me know what you think and if you agree that this is a good extension for the current crate, I can send a PR implementing this feature.

@cgwalters
Copy link
Member

The feature generally makes sense to me, although right now this project is intending to be roughly CLI compatible with cargo vendor.

I think we should at least propose the feature there first?

@piotr-sk
Copy link
Collaborator Author

piotr-sk commented Oct 8, 2024

You're right. I've created rust-lang/cargo#14654 and will see how easy it be to get it approved and done in the cargo vendor directly.

@piotr-sk piotr-sk linked a pull request Oct 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants