2016-12-07 159 views
4

我在一个货物工作区中有两个项目my_project和my_inner_project。它们都依赖于gfx(以及gfx_core和gfx_device_gl)。 我在gfx_device_core中发现了一个错误,所以我分叉了它,克隆,在本地进行了修补,并且希望在提交之前对它进行测试。货物,工作区和临时本地依赖项

项目结构:

-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 

现在我想货物MY_PROJECT构建过程中使用GFX的本地副本:

  1. 第一种方法(在Cargo.toml本地路径):我已经改变了源所有gfx软件包都包含在我的项目的Cargo.tomls中的本地路径中。\ 不幸的是,货物隐含地假设(这对我来说有点疯狂),所有由“path”指向的依赖项都是工作区的一部分,但工作区成员必须位于文件系统中的工作区根目录下。所以它拒绝构建项目,抱怨gfx *是工作区的一部分,但它不在工作区的根下。 AFAIK,目前没有办法改变这种隐含的“一切都在工作空间中”的行为。
  2. 第二种方法([替换]):此方法导致与上述相同的行为。 [replace]中指定的路径也隐式添加到工作区中。
  3. 第三种方法(本地路径覆盖):我已将gfx添加到.cargo/config中的路径。还有必要将我的.tomls中的gfx包的源代码从crate.io更改为git存储库,因为overriden包中的版本和.toml中引用的版本必须匹配。这也不适用于稳定的铁锈1.13。我得到警告:

    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. 
    

    和错误:

    error: failed to find lock source of gfx_core 
    

    我的地方GFX和存储库的副本Cargo.toml指出在我的项目是完全相同的,所以我不明白为什么这个警告emited 。

    该错误在每晚生锈的情况下得到修复,所以我安装了它并最终能够使用本地gfx副本编译项目。

所以相对基本任务挣扎了一天之后,我有一个解决方案,它只能在夜间,并承诺不会在功能发布工作。

我的问题:

  1. 那应该怎么办呢?
  2. 如何摆脱此警告?

回答