corrosion-rs/corrosion

Projects with multiple Rust targets have broken incremental compilation

2xsaiko opened this issue · 4 comments

After updating Corrosion from 0.3.0 to 0.3.5, I noticed every time I build my whole project, it rebuilds all Rust crates including dependencies, instead of building the project incrementally as before. When building the same Rust target twice, the second time does not cause a rebuild (as expected). When building one Rust target, then another, then the first one again, all three times all dependencies are rebuilt from scratch. This makes me think that building a target causes incremental builds to get invalidated for all the other targets.

I tracked it down to commit 798fc95 (introduced between 0.3.1 and 0.3.2), reverting the commit in my project fixes the issue.

jschwe commented

Have you also tried if this still happens on current master? I just checked, and the code in question, which did not set CARGO_TARGET_<target>_LINKER for staticlibs, is not there anymore on master (after a larger refactor).

I am considering releasing a bugfix release, which reverts the commit in question, but I'd have to take some time first and doublecheck what the original issue was, to make sure I don't break something else by reverting.

Ah sorry, I forgot to test master. It does indeed not happen there anymore. Thanks!

jschwe commented

Do you need a fix for the v0.3 branch, or would releasing v0.4 be sufficient?

Having the fix in 0.4 is fine by me. Applying a patch until then is not an issue :)