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

Merge-friendly Cargo.Bazel.lock #2247

Open
alexkirsz opened this issue Nov 9, 2023 · 3 comments
Open

Merge-friendly Cargo.Bazel.lock #2247

alexkirsz opened this issue Nov 9, 2023 · 3 comments

Comments

@alexkirsz
Copy link
Contributor

alexkirsz commented Nov 9, 2023

Hey 👋

Working on a large monorepo with hundreds of Rust crates, we're seeing almost constant merge conflicts on the Cargo.Bazel.lock file. For instance, the checksum will always conflict as soon as a dependency changes.

This can lead to frustrating outcomes where you have to chain updates to Cargo.Bazel.lock during the lifetime of a PR, as other PRs get merged that also touch the lockfile. Furthermore, since Github Actions will not run workflows on PRs with merge conflicts, one must always keep their lockfile conflict-free in order to benefit from CI. For the same reasons, using merge queues is also unfortunately out of the question.

The Cargo.lock format was recently updated to optimize it for git merge conflicts. It would be very helpful for Cargo.Bazel.lock to produce as few conflicts as possible.

@alexkirsz alexkirsz changed the title Merge-friendly cargo-bazel-lock.json Merge-friendly Cargo.Bazel.lock Feb 21, 2024
@dzbarsky
Copy link
Contributor

Cargo.bazel.lock is not necessary when using bzlmod. Perhaps that's a path forward for you?

@UebelAndre
Copy link
Collaborator

Cargo.bazel.lock is not necessary when using bzlmod. Perhaps that's a path forward for you?

Can you explain why it’s not necessary? Cargo metadata doesn’t have enough information on its own to be reproducible to Bazel without doing some noticeable computation. I’m still new to bzlmod so curious how it solves this.

@DavidZbarsky-at
Copy link

My understanding is that the computation to go from Cargo.lock to Cargo.bazel.lock is pure/reproducible, right?

If so, this works because the Bazel lockfile was essentially a performance optimization, and with bzlmod, Bazel knows to only rerun the module extension when the inputs change. So the Cargo.bazel.lock is still produced, but we don't need to check it in/run the REPIN workflow.

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

No branches or pull requests

4 participants