-
Notifications
You must be signed in to change notification settings - Fork 2.6k
cargo publish
should optionally skip unpublishable packages
#15006
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
cargo publish
should *optionally* skip unpublishable packagescargo publish
should optionally skip unpublishable packages
This gets into the question of how much |
This was discussed at #1169 (comment) Currently, In #1169 (comment), @kpreid also added
|
There is also interest in making If we tie logic to |
All three options involve magic in a way and a concern I have with that is the defaults for |
This is also an issue for Bevy workspace |
|
Thought of a good analogy for how to model the behavior: My assumption would be that would mean
The main risk remaining would be for weird multi-registry scenarios which is probably fine. Going to go ahead and mark this as accepted. |
This is about the unstable
-Zpackage-workspace
feature. Discussion branched from #1169 (comment).Problem
In a large workspace, there might be many packages to publish, and many packages that should not be published (for development only, or applications that are distributed by means other than Cargo).
cargo publish -Zpackage-workspace
will attempt to publish the workspace’s default members, whether or not they are marked unpublishable withpackage.publish = false
, and error out if any of them are.This seems to me a missing feature; it should be possible to choose to use
package.publish
metadata to control whether a package is selected for publishing.Proposed Solution
Alternative 1: Add a new flag (with what name?) which selects packages, from members or default-members, as follows:
package.publish = false
, it is not selected.package.publish = true
, it is selected.This flag would be compatible with
--workspace
but incompatible with--package
.This version encourages workspace authors to explicitly think about whether each package should be published if they wish to use this feature, which seems to me the best outcome. However, it gives new semantics to
package.publish = true
, which was previously identical to the field being absent. I think this is a good thing (publishing should be more opt-in, since it is close to irrevocable), but it would be new.Alternative 2: Add a new flag
--exclude-unpublishable
.default-members
or due to--workspace
being passed, and it haspackage.publish = false
, then it is excluded from selection as if by--exclude
.--package
and it haspackage.publish = false
, this is still an error.Alternative 3: Automatically skip
publish = false
packages without any specific flag.This might be too “DWIM” but it is the behavior I was implicitly expecting when I tried out
-Zpackage-workspace
for the first time.Notes
In the status quo, it would be possible to use the workspace’s
default-members
to control which packages are published. I think this is not sufficient, becausedefault-members
should be a package selection which is appropriate for routine development, which will usually be much more common than publishing. In particular, a package whose job is entirely tests should not be published, but should be run by default withcargo test
.@rustbot label +Z-package-workspace
The text was updated successfully, but these errors were encountered: