I have two projects my_project and my_inner_project in one cargo workspace. They both depend on gfx (and gfx_core and gfx_device_gl). I've found a bug in gfx_device_core, so I've forked it, cloned, patched locally and want to test it before commit.
Projects structure:
-my_project
--my_inner_project
---Cargo.toml
--Cargo.toml
-gfx
--src
---core
----Cargo.toml #package gfx_core
---backend
----gl
-----Cargo.toml #package gfx_device_gl
---render
----Cargo.toml #package gfx
--Cargo.toml
Now I want cargo to use local copy of gfx during my_project build:
Third approach (local path overrides): I've added gfx to paths in .cargo/config. It was also necessary to change source of gfx package in my .tomls from crate.io, to git repository, because version in overriden package and version referrenced in .toml must match. This also don't work in stable rust 1.13. I get warning:
warning: path override for crate `gfx_device_gl` has altered the original list of dependencies; the dependency on `gfx_core` was either added or modified to not match the previously resolved version
This is currently allowed but is known to produce buggy behavior with spurious recompiles and changes to the crate graph. Path overrides unfortunately were never intended to support this feature, so for now this message is just a warning. In the future, however, this message will become a hard error.
To change the dependency graph via an override it's recommended to use the `[replace]` feature of Cargo instead of the path override feature. This is documented online at the url below for more information.
And error:
error: failed to find lock source of gfx_core
My local copy of gfx and repository pointed in Cargo.toml inside my projects are identical, so I don't understand why this warning is emited.
The error is fixed in rust nightly, so I've installed it and finally was able to compile project with my local gfx copy.
So after a day of struggling with relatively basic task, I have a solution, which works only in nightly and promises it will not work in feature releases.
My questions:
To close the topic; This discussion resolves the issue: https://github.com/rust-lang/cargo/issues/3192
Now, paths pointing outside workspace directory are not implicitly included into workspace. Moreover there is exclude
key in workspace configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With