Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider stripping the crate version when building dependencies #288

Open
ipetkov opened this issue Apr 2, 2023 · 1 comment
Open

Consider stripping the crate version when building dependencies #288

ipetkov opened this issue Apr 2, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@ipetkov
Copy link
Owner

ipetkov commented Apr 2, 2023

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 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

@ipetkov
Copy link
Owner Author

ipetkov commented Nov 5, 2023

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant