-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Properly handle hybrid packages #10905
Comments
Is this a duplicate of #1982? |
While not strictly necessary, this seems like it would be a well-fitting feature — a Might be a duplicate of #1982 but the most recent discussion there seems to propose enabling features in the library from the binary, which would work for this (and has its own use cases) but is a more indirect way of specifying what you want, which has two disadvantages:
|
docs.rs has a convention to hide |
@kpreid something like:
|
Going to go ahead and close this as the topic is the same. If there are dissenting opinions or alternative proposals, let's have that all in one place rather than spread across issues. |
bin+lib
packages
@epage I am blasted away, this is unresolved since 2015 |
Yes, understandable. We see that response to a lot of our issues. The scope of cargo makes it so there are a lot of high interest areas that make it hard to get to all of them. For example, this isn't a priority to me as I've found I prefer to have separate crates for bin/lib. A lot of work ends up being user-driven. Lately, the cargo team has also been even more limited, see https://blog.rust-lang.org/inside-rust/2022/03/31/cargo-team-changes.html. |
I understand teams are busy, theres no question here |
Problem
There is no way to properly maintain a hybrid package (bin+lib). If a developer wants to deploy such package, he/she is forced to pollute the platform with each crate in this package's workspace [1] since this is the only way to separate
bin
andlib
dependencies. Using features sounds like a workaround since one should be able to build a binary without telling compiler about the target twice.Proposed Solution
Utilize attributes/etc to group/tag dependencies for binary or library usage. the compiler/cargo must know that when binary target is built there is no need to touch library dependencies.
Notes
If you publish the crates in the workspace to crates.io, each crate in the workspace will need to be published separately.
https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.htmlThe text was updated successfully, but these errors were encountered: