Skip to content

There's no documented way to bootstrap Cargo.lock, Cargo.Bazel.lock #2280

@the80srobot

Description

@the80srobot

Following the documentation for crate_universe, you will get build errors similar to this one:

ERROR: Error computing the main repository mapping: no such package '@crate_index//': Not a regular file: /Users/adam/code/santa/Cargo.lock

And the same error for Cargo.Bazel.lock.

As far as I can tell:

  1. If you're using a Cargo.toml, you bootstrap Cargo.lock using cargo. If you're not using Cargo.toml you there is no clear way to bootstrap it.
  2. If you're specifying Cargo.Bazel.lock, then the docs don't tell you how to bootstrap it. CARGO_BAZEL_REPIN=1 bazel ... will not do it. By experimenting, I've figured out that if you touch Cargo.Bazel.lock before running bazel, it'll work.

I would suggest the documentation page should mention:

  • How to bootstrap cargo_lockfile without a Cargo.toml (I don't know, actually)
  • That lockfile will be bootstrapped with touch LOCKFILE && CARGO_BAZEL_REPIN=1 bazel test //
  • Add comments to the first example ("Cargo Workspaces") next to the lines specifying the lockfiles, telling the reader to bootstrap those files.

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