Open andrewpollack opened 2 years ago
I think I'm running into this when trying to change a crate dependency from being from a repository to being from a path. We have a bunch of crates in a cargo-based repository, and I'm trying to iterate on some work where I need to change the cargo crate source and then see if the fix works for the bazel-based rust code. How can I do this? I don't want to/cannot bring the cargo-based crate code all the way into bazel and create BUILD files for it all and everything, but I would like to be able to temporarily point cargo-bazel at a path to it while I am working on it, then when everything is prepped, revert back to the published crate.
This seems like a pretty common use case, how do people do it?
Using
[patch.crates-io]
in yourCargo.toml
to patch to local copies of a crate viaCRATE_NAME = { path = "path/to/crate"}
is currently failing with an error of style:Error: The package 'Name("zerocopy") Version { major: 0, minor: 6, patch: 1 }' has no source info so no annotation can be made
. This fails for patching both primary and transitive dependencies.The error is coming from this line, referencing the package's
Package.source
being None, which is expected for a local project.This same workflow functions for its
CRATE_NAME = { git = "git_repository"}
equivalent.Minimal repro:
Command:
bazel run //:crates_vendor
Directory structure:
WORKSPACE
BUILD
Cargo.toml
src/lib.rs
empty/zerocopy/Cargo.toml
empty/zerocopy/src/lib.rs