Skip to content

MODULE.bazel.lock contains os-specific information #3297

Closed
@kyleconroy

Description

@kyleconroy

We're using Bazel 7.4.1, bzlmod, and rules_rust 0.57.0.

I'm currently running into an issues where the MODULE.bazel.lock file is different for macOS and Linux. Our development team is split across operating systems. We commit the lock file into git. After doing a build, this is the output.

diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock
index e469d34c..5a4e577b 100644
--- a/MODULE.bazel.lock
+++ b/MODULE.bazel.lock
@@ -2450,13 +2450,13 @@
         "bzlTransitiveDigest": "EdXtlrLdE7Da59jNE81dWF8Gtmkk/k+t7HQipinlkys=",
         "usagesDigest": "s984p4lEI8oILLOAsSJoxCw9XxONrc+GZDviDKss1zo=",
         "recordedFileInputs": {
-          "@@rules_rust~~rust_host_tools~rust_host_tools//bin/rustc": "241027b94ad67beb36d0356f7cc05180daaa9966b2958cfba1d4de089d2e521c",
+          "@@rules_rust~~rust_host_tools~rust_host_tools//bin/rustc": "b953c69e6f682bf55e39bdd55bdcbd3e1cc0cbdf9dfda24b9c6478ee2c38359b",
           "@@//tools/protoc-gen-rust/Cargo.lock": "8fa0f54c3148432f7fc8f9ca965a99a8d68b63e287b70b988fc4c8bc80ef20e3",
           "@@//code/Cargo.toml": "7f74cfc4b2e5cb5498ea299be71ae53ad45b2fc3dd81b90e3360fe2004c70b19",
           "@@//tools/protoc-gen-rust/Cargo.toml": "43ce3024fafb7937c5cdf5b3ff5da955cc3ba949b4e3461a2d4108903244f57e",
           "@@//code/Cargo.lock": "83cbfba676ff03848c866bfe55bee28e4ea4cdd254a4791c5ba20a47f26515fa",
-          "@@//MODULE.bazel": "0ea6c3b67b68921e1650b9d0332b7a3bf1490e2d1f4c3d7e0233565283f9aabc",
-          "@@rules_rust~~rust_host_tools~rust_host_tools//bin/cargo": "35099f3b7b9497b3ae95aa00886ac6839343488e5cdb958e69c16c9b58c3afb2"
+          "@@//MODULE.bazel": "21b7f26f2e1130e2f2b145b234ca20a877df056063c2e94acef247dccb1ce3db",
+          "@@rules_rust~~rust_host_tools~rust_host_tools//bin/cargo": "be459aeefa634aa6693a9a4741cfa4d63dd8a50af2d1a8ff221b7565e7eb4e4c"
         },
         "recordedDirentsInputs": {},
         "envVariables": {

The previous values for rustc are for Linux, the new ones are for macOS.

Our MODULE.bazel contains the following rust configuration

rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
    edition = "2021",
    versions = ["1.83.0"],
)
use_repo(rust, "rust_toolchains")
register_toolchains("@rust_toolchains//:all")

# Option 1: Fully transient (Cargo.toml / Cargo.lock as source of truth).
crate = use_extension(
    "@rules_rust//crate_universe:extension.bzl",
    "crate",
)

crate.from_cargo(
    name = "crates",
    cargo_lockfile = "//code:Cargo.lock",
    manifests = ["//code:Cargo.toml"],
)

use_repo(crate, "crates", "crates_protoc")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions