cargo-chef icon indicating copy to clipboard operation
cargo-chef copied to clipboard

Feature request: `cargo-chef` support for patches

Open prestontw opened this issue 4 years ago • 4 comments

Howdy! I work in a medium-large workspace that includes patches to a couple of dependencies (can provide a minimal example if that would be helpful). When trying to use cargo chef cook, it doesn't seem like the patches are included or applied---I'm seeing compilation errors.

Would it be possible to add rust-patches support to cargo-chef?

prestontw avatar Jun 01 '21 00:06 prestontw

I think the only thing that is necessary is adding --offline support to the cargo command that is run, which I've attempted to do in https://github.com/LukeMathWalker/cargo-chef/pull/65

prestontw avatar Jun 01 '21 01:06 prestontw

I am still running into problems even with --offline support. I think it's because cargo chef is overwriting the rust-patches' lib.rs files. These should still be treated as dependencies---they should not be overwritten. I verified locally that lib.rs is getting replaced with an empty file. My first thought would be to allow a list of directories not to replace, and make the default include rust-patches. I'll try this locally and see if this solves the problem.

prestontw avatar Jun 05 '21 18:06 prestontw

A minimal example would really help here to understand what the issue is and the best way forward to solve it (if possible).

LukeMathWalker avatar Jun 05 '21 18:06 LukeMathWalker

@LukeMathWalker I've verified that https://github.com/prestontw/cargo-chef/commit/582504172902260d648e701431d252ebc925c579 fixes the problem for me. I'm planning on making this customizable and reproducing a minimal example. I wanted to show you what worked first, though, in case you had thoughts.

prestontw avatar Jun 07 '21 19:06 prestontw