playdate: `playdate-sys` causes rust to always rebuild everything, even when nothing has changed
Hi,
Usually, working with rust cargo only needs to recompile the crates that have changed and their dependent crates.
But it looks like playdate-sys causes a full rebuild everything, even when nothing has changed at all.
I am not sure what’s the exact cause of this. But I assume it’s due to one of the rerun-if-changed in the playdate-sys build script?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 17 (16 by maintainers)
@notpeter, IMHO, main problem is because I creating
cargo::core::compiler::build_context::BuildContextand it’s invalidating your cargo cache. I needBuildContextto get actual dependency tree withplaydate.assetsmetadata to properly build assets for the package. Previously I tried with only build-plan by cargo, but there is no so much info as needed. I have some ideas that I’ll try in nearest future.Well, now
playdate-syscauses cargo to rebuild only when there is no pre-generated bindings and/or bindgen feature. Also nowcargo-playdaterespects cargo’s cache and so doesn’t corrupts incremental builds. Also in some near future I’ll remove bindgen feature from defaults, probably. So I closing this issue. Feel free to reopen if needed.I mean that main problem is in the
cargo-playdate, butplaydate-syshas build-script that also need a “tuning”.Finally I’ve got it. It’s not a
playdate-sys, butcargo-playdatecorrupts cargo’s cache when planning units compilation. Trying to fix it… 🥵Hm… probably my mistake in this two lines:
I’ll try without it, by absolutely not sure. 🤷🏻♂️ Also I don’t remember why and for what I’ve added it.
Thanks for the help.
Here are my lines containing
cargo:rerun-:If you’re using
cargo-playdate, it causes because I have to fix inner cargo ctx configuration to do not touch cache of your real cargo.If you’re building just
playdate-sysas dependency or standalone, I’m not sure why it happening and should investigate.Little workaround to speed-up build time:
cargo install playdate-bindgen)--no-default-featuresdisable all features that requires bindgen, that is just two:bindgen-runtimebindgen-staticPD_BUILD_BINDINGS_ONCE=1to reuse generated bindings (def)So now build script will execute your installed pd-bindgen, and cargo will not compile it for
dev-deps.If you have any idea how to improve it or fix
cargo-playdate’s innercargoconfiguration to don’t touch cache - it could be great and highly welcome! ❤️