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

Make Rust builds respect Cargo.lock when present #202

Merged
merged 2 commits into from
Feb 27, 2024

Conversation

jonhoo
Copy link
Contributor

@jonhoo jonhoo commented Feb 20, 2024

Kraken should, by default, respect the Cargo.lock present in the current Cargo project rather than silently pull down dependencies not explicitly noted in the initial Cargo.lock. If the lockfile is out of date, the underlying package should be updated to reflect that change if Cargo.lock is checked in.

To avoid breaking existing workflows that don't check in Cargo.lock, the default behavior is to only pass --locked if a Cargo.lock exists in the parent directory tree of the current working directory.

The flag only really matters to CargoBuildTask, CargoTestTask, and CargoManifest, but is also propagated to CargoPublishTask so that it isn't allowed to silently update the lockfile if it happens to be called first. Clippy doesn't take --locked, and so remains unmodified.

Note also that checking in Cargo.lock is now recommended by the Rust project: https://blog.rust-lang.org/2023/08/29/committing-lockfiles.html

Kraken should, by default, respect the `Cargo.lock` present in the
current Cargo project rather than silently pull down dependencies not
explicitly noted in the initial `Cargo.lock`. This is accomplished by
passing `--locked` to `cargo. If the lockfile is out of date, the
underlying package should be updated to reflect that change if
`Cargo.lock` is checked in.

To avoid breaking existing workflows that don't check in `Cargo.lock`,
the default behavior is to only pass `--locked` if a `Cargo.lock` exists
in the parent directory tree of the current working directory.

The flag only really matters to CargoBuildTask, CargoTestTask, and
CargoMetadata, but is also propagated to CargoPublishTask so that it
isn't allowed to silently update the lockfile if it happens to be called
first. Clippy doesn't take `--locked`, and so remains unmodified.

Note also that checking in `Cargo.lock` is now recommended by the Rust
project: https://blog.rust-lang.org/2023/08/29/committing-lockfiles.html
@jonhoo jonhoo force-pushed the jon/locked-by-default branch from d26eca6 to cbaec4e Compare February 20, 2024 16:16
@jonhoo jonhoo changed the title Pass --locked by default Make Rust builds respect Cargo.lock when present Feb 20, 2024
@NiklasRosenstein NiklasRosenstein enabled auto-merge (squash) February 27, 2024 12:19
@NiklasRosenstein NiklasRosenstein merged commit 7c94c73 into kraken-build:develop Feb 27, 2024
16 checks passed
@jonhoo jonhoo deleted the jon/locked-by-default branch February 27, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants