Cargo builds directly from vendored source?

I’m using cargo build --build-plan to generate build rules for a different build system (Buck). These builds will be from a complete set of vendored sources.

At present cargo shows all paths relative to ~/.cargo/registry/src/... which means I need to remap those paths back to my vendored sources. Given that all the sources are right there, it would be useful to be able to tell Cargo to just use them in place. Even for normal cargo builds it would save having to copy all the sources.

You might want to check cargo-vendor wich is now shipped with cargo itself.

So you should be able to just run cargo-vendor

Yeah, I’ve already vendored the sources, and updated .cargo/config.toml to use them. It’s just that cargo will copy from my vendor dir into ~/.cargo before building. I want it to use the sources directly from my vendor dir.

In my build plan, dependencies that are specified via

dep = {path = "../dep" }

get relative paths to their own location.

I guess if you’re overriding a registry, then it makes sense for Cargo to still “download” the sources from your registry.

It does work as I'd expect. My confusion was that it searches for .cargo/config from the current working directory, not relative to the manifest path.