Conversation
I think it would cause rebuilds to also be skipped if environment variables change (that would normally cause cargo to rebuild).
That sounds quite complex to me tbh. I'm not sure if it feasible here. For hostbuild I think we could remove the generator expression, and require that hostbuild is passed only via corrosion_import_crate. I think there is typically only one / very few hostbuild programs in a project, so this shouldn't cause much code churn / added verbosity. For the profile I'm less sure what an alternative could be. Perhaps we could use switch to a global genex instead, that maps cmake build types to rust profiles (e.g. |
This is not complete yet, but wanted to gauge interest before polishing up.
An annoying thing about corrosion is that it doesn't use ninja's dependency tracking at all, instead depending on cargo's. This means that cargo has to be invoked for every call of ninja, regardless of if anything needs to be done or not.
Cargo outputs depfiles that are exactly for this purpose, so this PR hooks that up. This lets ninja do nothing when there is no work to do, but otherwise do work.
This required temporarily disabling the hostbuild & profile features, as those are 'target' generator features which are not allowed in this context.
Do you think it would be acceptable to replace the generator expressions with a DEFER call like is done for the byproducts?