如何货物仅建立目标但不建立依赖性
我从事一个生锈项目,该项目具有大量的显式或隐式依赖项(〜420)。更改.env
文件后,我想重建目标(将IP之类的内容配置为从中下载文件)时,我只想重建我撰写的软件包,而不是所有依赖项。
我如何告诉货物构建
使用先前编译的依赖项,但不能使用先前编译的软件包,该软件包使用.env
文件作为输入?
Ideally, cargo build
would realize that the .env
file has changed and automatically decide to rebuild only the parts that use the .env
file, but不幸的是,情况似乎并非如此。
因此,第二好的解决方案是手动告诉货物构建
在构建图中的哪个点以重新开始。
We're using the dotenv crate https://crates.io/crates/dotenv crate to read the .env
文件。
我尝试了货物清洁-P NextClade
告诉它仅清洁我正在处理的相关软件包 - 但这仍然清理所有依赖项,这会导致我的构建需要5分钟,而不是2分钟分钟(如果使用编译依赖项)。
一个问题似乎提出了一个类似的问题,但是这个问题实际上是一个不同的用例/设置,因此这不是重复:货物如何决定是否重建DEPS?
I work on a Rust project that has a lot of packages as explicit or implicit dependencies (~420). When I want to rebuild the target after changing the .env
file (that configures things like IP to download files from), I would like to rebuild only the packages that I authored, not all the dependencies.
How can I tell cargo build
to use the previously compiled dependencies, but not use the previously compiled package that uses the .env
file as input?
Ideally, cargo build
would realize that the .env
file has changed and automatically decide to rebuild only the parts that use the .env
file, but unfortunately this doesn't seem to be the case.
So the second best solution is to manually tell cargo build
at which point in the build graph to start off again.
We're using the dotenv crate https://crates.io/crates/dotenv crate to read the .env
file.
I tried cargo clean -p nextclade
to tell it to clean only the package in question that I'm working on - but that still cleans up all the dependencies which cause my build to take 5 minutes rather than 2 minutes (if using compiled dependencies).
There's a question that seems to ask a similar question, but that question is actually a different use case/set up, so it's not a duplicate: How does cargo decide whether to rebuild the deps or not?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论