bazelbuild / bazelbuild/rules_rust
There's no documented way to bootstrap Cargo.lock, Cargo.Bazel.lock
- Dominant language
- Starlark
- Stars
- 843
- Forks
- 651
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 15
Description
Following the documentation for [crate_universe](http://bazelbuild.github.io/rules_rust/crate_universe.html), 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.
Contributor guide
Assessment
This issue has not been assessed yet.