build: add Rust crate vendoring #3
45
README.md
45
README.md
@@ -2,16 +2,49 @@
|
||||
|
||||
This is my monorepo, started in 2026.
|
||||
|
||||
## Monorepo Structure
|
||||
```
|
||||
## Monorepo structure
|
||||
|
||||
```text
|
||||
dev/ Monorepo root
|
||||
├── .archive/ Archived projects
|
||||
├── bazel/ Bazel support files
|
||||
├── configs/ Declarative configuration
|
||||
│ └── nixos/ NixOS hosts, modules, guests, registry, and secrets
|
||||
├── docs/ Obsidian vault / Second brain
|
||||
├── docs/ Repository documentation
|
||||
├── src/ Projects
|
||||
│ └── tools/ Projects that are tools
|
||||
└── third_party/ Open source tools, libraries or otherwise
|
||||
│ ├── dotfiles/ Home and system configuration
|
||||
│ └── machoke/ Rust application
|
||||
├── third_party/ External source and vendoring support
|
||||
│ └── crates/ Generated Rust crate sources and Bazel targets
|
||||
├── Cargo.lock Shared Rust dependency lockfile
|
||||
├── Cargo.toml Rust workspace manifest
|
||||
└── MODULE.bazel Bazel module definition
|
||||
```
|
||||
|
||||
## Rust dependencies
|
||||
|
||||
The repository root contains one Cargo dependency graph.
|
||||
Each Rust project declares its dependencies in its local `Cargo.toml` file.
|
||||
Add each Rust project to the `members` list in the root `Cargo.toml` file.
|
||||
Use explicit member paths because the Bazel generator does not expand workspace globs.
|
||||
|
||||
Update the shared lockfile after changing a project manifest:
|
||||
|
||||
```sh
|
||||
cargo generate-lockfile
|
||||
```
|
||||
|
||||
Regenerate local crate sources and Bazel targets:
|
||||
|
||||
```sh
|
||||
bazel run //third_party:vendor_crates
|
||||
```
|
||||
|
||||
Reference each dependency with an explicit local Bazel label:
|
||||
|
||||
```starlark
|
||||
deps = ["//third_party/crates:crate_name"]
|
||||
```
|
||||
|
||||
Commit the generated files under `third_party/crates/`.
|
||||
Do not edit generated files manually.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user