Optional local dependencies

Imagine the situation that you have a monorepo that is split unto the different github repos. The problem with this is that you have to always push the changes dependencies to the upstream for other deps to be seen. It'll be great having a machinery that allows for overwriting the remote dependencies with local ones without rewriting every toml file manually.

I imagine it be something like

path = "../lib"

path = "0.8.2"

The problem with that, stated

The same applies to cfg(debug_assertions), cfg(test) and cfg(proc_macro). These values will not work as expected and will always have the default value returned by rustc --print=cfg. There is currently no way to add dependencies based on these configuration values.

I also tried using patches

blah = { git = "https://github.com/blahblah" }

blah = { path = "../" }

but cargo always uses the remote dep for some reason.

Any suggestions on this one?

The patch approach should work. Double-check that the syntax and URLs match.

The patch can also be added to the local .cargo/config.toml.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.