You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The crux of the issue is that we automatically inherit the crate's version attribute (from Cargo.toml) as the version of the buildDepsOnly derivation. The value is also not stripped when cleaning the Cargo.toml file. This unfortunately means that when a crate's version is updated (e.g. to publish a new release) it will invalidate the cache and require building all dependencies from scratch.
A more cache-friendly solution would be to replace version with a static placeholder value (both when cleaning the Cargo.toml and when setting the buildDepsOnly derivation's version attribute).
One possible downside of this is if a project uses a build command which somehow relies on the version of the crate (e.g. tries to parse something like cargo tree [email protected]). I think there should be an escape hatch (such as doNotStripVersion = true; or equivalent) which would bring back the previous behavior if required
The text was updated successfully, but these errors were encountered:
Some more observations on this: changing the versions of any Cargo.toml[package] definition would also need to subsequently change the respective Cargo.lock definitions as well, otherwise cargo will complain about the lockfile being out of date (since we pass in --locked)
Originally discussed in #281
The crux of the issue is that we automatically inherit the crate's version attribute (from
Cargo.toml
) as the version of thebuildDepsOnly
derivation. The value is also not stripped when cleaning theCargo.toml
file. This unfortunately means that when a crate's version is updated (e.g. to publish a new release) it will invalidate the cache and require building all dependencies from scratch.A more cache-friendly solution would be to replace
version
with a static placeholder value (both when cleaning theCargo.toml
and when setting thebuildDepsOnly
derivation's version attribute).One possible downside of this is if a project uses a build command which somehow relies on the version of the crate (e.g. tries to parse something like
cargo tree [email protected]
). I think there should be an escape hatch (such asdoNotStripVersion = true;
or equivalent) which would bring back the previous behavior if requiredThe text was updated successfully, but these errors were encountered: