Don't update Cargo.lock when re-pinning
When doing something that requires updating cargo-bazel-lock.json, for example changing the rust version or even the initial setup of bazel, the only option is to do a full cargo update, which updates a lot of versions in the Cargo.lock. However, it would be nice if there was a way of generating the cargo-bazel-lock.json only, using the versions of the packages defined in the Cargo.lock.
Is there any technical reason that it is required to tie together the updating of cargo-bazel-lock.json and Cargo.lock?
This is similar to https://github.com/bazelbuild/rules_rust/issues/1231.
See https://bazelbuild.github.io/rules_rust/crate_universe.html#repinning--updating-dependencies
You can currently use CARGO_BAZEL_REPIN=workspace to generate the file without updating any dependencies - does this work for you?
Thanks for the info, this does indeed work. This is not the most intuitive naming, unless you know the behaviour of cargo update --workspace.
Yeah, I agree... @UebelAndre how would you feel about a breaking change where we make CARGO_BAZEL_REPIN no longer take a truthy value, and instead require either setting CARGO_BAZEL_REPIN=update-all or CARGO_BAZEL_REPIN=regenerate-lockfile?
I'll re-open this if there is a potential change here.
Yeah, I agree... @UebelAndre how would you feel about a breaking change where we make
CARGO_BAZEL_REPINno longer take a truthy value, and instead require either settingCARGO_BAZEL_REPIN=update-allorCARGO_BAZEL_REPIN=regenerate-lockfile?
I'm totally fine with any kind of aliasing folks want to add to represent some flag combination but I'd still like there to be some default behavior for a truthy value. What the truthy value evaluates to I'm also fairly flexible on. It should be the most common of the values users would otherwise set to CARGO_BAZEL_REPIN but I don't want to be the one to choose since I'm already familiar with how it currently works and a change would take some getting used to.
My vote would be for making workspace/generate-lockfile the default, as I think that's the least surprising: https://github.com/bazelbuild/rules_rust/issues/1535#issuecomment-1236650916
My vote would be for making workspace/generate-lockfile the default, as I think that's the least surprising: #1535 (comment)
Pull requests would be welcome 😄