cargo-hack icon indicating copy to clipboard operation
cargo-hack copied to clipboard

Compatibility with `cargo publish --workspace`

Open leighmcculloch opened this issue 3 months ago • 2 comments

Now that cargo publish supports the --workspace flag, it would be helpful if cargo-hack interoperated with the publish command and supported calling it with --dry-run to run verification on the feature powerset for the crates in the repo.

Today the cargo-hack command will only call individual crates with cargo publish rather than the workspace in one call, but with different features enabled.

leighmcculloch avatar Sep 24 '25 10:09 leighmcculloch

Um, what kind of behavior are we actually looking for here?

  • To properly check the combination of features, compilation per crate is required.
  • If you want to handle dev-dependencies without cargo-hack's workspace behavior, cargo-no-dev-deps is the appropriate tool.

However, are you actually suggesting that cargo-hack perform a build for each package at target/package created by cargo publish --dry-run?

taiki-e avatar Sep 24 '25 14:09 taiki-e

  • To properly check the combination of features, compilation per crate is required.

That's a good point, because otherwise cargo will unify them. Thanks for calling that out.

However, are you actually suggesting that cargo-hack perform a build for each package at target/package created by cargo publish --dry-run?

I wasn't suggesting this, I was just trying to run the cargo publish --workspace command multiple times, each with a different feature set specified. But I guess how you describe it here is what it would do? That way it was running on one package at a time.

leighmcculloch avatar Sep 29 '25 06:09 leighmcculloch