I’m trying to publish my first crate (!!) and encountered the following error:
error: crates cannot be published to crates.io with dependencies sourced from a repository either publish `cpuprofiler` as its own crate on crates.io and specify a crates.io version as a dependency or pull it into this repository and specify it with a path and version (crate `cpuprofiler` has repository path `https://github.com/jmmv/cpuprofiler.git?rev=a852024d6aed7202863dc43a3348e793aa432d54`)
I understand that this is because I’m specifying the dependency as something that doesn’t live within crates.io and crates.io wants to ensure that the build is self-contained within that domain (right?). I’m wondering what the alternative is.
One option I can think of is just vendoring the crate in my own repository and point at it with
path from the
Cargo.toml specification. But… that seems ugly: the code already lives elsewhere and can be referenced with a unique identifier, so it’d be nice to use that copy…
But do I have alternatives? From the Specifying dependencies documentation, I thought
[patch.crates-io] would work, but it doesn’t either.