[英]Cargo, workspace and temporary local dependency
I have two projects my_project and my_inner_project in one cargo workspace. 我在一个货物工作区中有两个项目my_project和my_inner_project。 They both depend on gfx (and gfx_core and gfx_device_gl). 它们都依赖于gfx(以及gfx_core和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. 我在gfx_device_core中发现了一个错误,因此我已经对其进行了分叉,克隆,本地修补,并希望在提交之前对其进行测试。
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: 现在,我希望货物在my_project构建期间使用gfx的本地副本:
Third approach (local path overrides): I've added gfx to paths in .cargo/config. 第三种方法(覆盖本地路径):我在.cargo / config中的路径中添加了gfx。 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. 也有必要将我的.tomls中的gfx软件包的源从crate.io更改为git仓库,因为被覆盖的软件包中的版本和.toml中引用的版本必须匹配。 This also don't work in stable rust 1.13. 这在稳定的锈蚀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. 我在项目内的Cargo.toml中指向的gfx和存储库的本地副本是相同的,因此我不明白为什么会发出此警告。
The error is fixed in rust nightly, so I've installed it and finally was able to compile project with my local gfx copy. 该错误已在每晚的rust中修复,因此我已经安装了该错误,最终能够使用本地gfx副本编译项目。
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 该讨论解决了该问题: 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. 此外,工作空间配置中没有exclude
键。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.