Added --generate-lockfile for generating a new lockfile#341
Conversation
|
@acmcarther Hey, do you have time to take a look at this today? Would hugely appreciate it 🙏 😅 |
acmcarther
left a comment
There was a problem hiding this comment.
LG, but I'm still not completely clear why just using Cargo.lock doesn't work. Can you explain that again?
You said above
This will always generate a Cargo.raze.lock file which will take precedence over an existing Cargo.lock file. As a reminder, this file exists because to allow projects using binary_deps to have a lockfile that doesn't conflict with the standard lockfile. I'm hoping to one day delete the need for this file and standardize on the canonical Cargo.lock file, but for now, the use of Cargo.raze.lock makes the outputs of cargo-raze more consistent.
But I'm not clear why this "[allows] projects using binary_deps to have a lockfile that doesn't conflict with the standard lockfile". What happens if you just used Cargo.lock?
Currently, binary dependencies are being added to manifests during the cargo-raze/impl/src/metadata.rs Lines 328 to 364 in 0cb6178 This will cause the lockfile to contain content not reproducible via canonical Cargo commands. To avoid any conflicts with things like rust-analyzer that might update the Users can use However, Maybe I can be smarter about detecting which lockfile is relevant, the custom |
|
Given what you've said above, I prefer always using our weird cargo.raze.lock, rather than conditionally using it when we need to. |
This PR adds a new argument
--generate-lockfilewhich will force a new lockfile to be generated.CargoWorkspaceFileswas deletedCargo.tomlandCargo.lockwere basically never used for anything other than finding the cargo workspace. It's simpler to pass around aPathand allow the underlying cargo command to handle finding the correct metadata.--generate-lockfileThis will always generate a
Cargo.raze.lockfile which will take precedence over an existingCargo.lockfile. As a reminder, this file exists because to allow projects usingbinary_depsto have a lockfile that doesn't conflict with the standard lockfile. I'm hoping to one day delete the need for this file and standardize on the canonicalCargo.lockfile, but for now, the use ofCargo.raze.lockmakes the outputs ofcargo-razemore consistent.Running this command against the
examples/remote/cargo_workspaceexample yields the following changes to the workspaceNote the addition of
cargo/Cargo.raze.lockhere.cargo-razewill use this for subsequent runs. It's also worth noting that if noCargo.lockorCargo.raze.lockfiles exist, aCargo.raze.lockfile will be generated.New warning for missing checksum
There's a new warning in the
checksmodule that will print a warning for when a crates.io crate is missing a checksum:With the following diff
The following error is produced