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

[hakari] [feature request]: only add workspace-hack crate as dependency to crate that need it #162

Open
cmtm opened this issue Nov 18, 2023 · 2 comments

Comments

@cmtm
Copy link

cmtm commented Nov 18, 2023

cargo hakari manage-deps currently adds the workspace-hack crate to all crates in the workspace. This means that even crates that have no dependencies now get a dependency on the workspace-hack crate.

If I understand correctly, the workspace-hack only needs to be added to crates that directly depend on one of the crates in the workspace-hack crate's dependencies. More clearly, the workspace hack depends on a set of third party crates S. The manage-deps step only needs to add the workspace hack to crates that directly depend on at least one member of S.

The benefit of this change would be that it reduces the footprint of using hakari.

Thoughts?

@sunshowers
Copy link
Member

sunshowers commented Feb 28, 2024

Hi, thanks for the report! Sorry to have missed it earlier, I've been busy with other projects.

That's definitely an interesting idea. We don't do it automatically at the moment, but can you achieve it with traversal-excludes or final-excludes? Both of them should cause the crate to no longer be counted in cargo hakari manage-deps.

@sunshowers
Copy link
Member

More clearly, the workspace hack depends on a set of third party crates S. The manage-deps step only needs to add the workspace hack to crates that directly depend on at least one member of S.

Hm, this is not quite true as you've specified it -- if a package has third-party dependencies for which there are transitive dependencies in S, it could need the workspace-hack for feature unification as well. This is pretty common with crates like syn -- few crates directly depend on it, but in large projects, many crates transitively depend on it.

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

No branches or pull requests

2 participants