Chapter 21: cargo-gen/src, two verbs

One file with two verbs:

cargo-gen generate <out-dir> <version> <edition> <majors> <third-party/Cargo.toml> <meta.json>...
cargo-gen write <generated-dir>

generate runs inside the buck build (:manifests). It reads every target's JSON, groups targets into packages, and writes the tree of manifests the BUCK files imply: the root workspace with its members and [workspace.dependencies] (crates.io versions from third-party/Cargo.toml, pgrx at =0.19.2 with its major feature stripped, so the per-crate pgNN features choose it), and one Cargo.toml per package, a package's unit-test target adding its dev-dependencies. write runs outside it (:update) and copies that tree into the checkout that holds the current directory.

Try it. Read the header of main.rs, then compare the root Cargo.toml: its first four lines are the warning the tool writes at the top of every file it owns.

For the people who maintain it

FileWhat
main.rsgenerate and write. Errors go to stderr as cargo-gen: … with exit code 1.

← Previous: Chapter 20, cargo-gen/ · Up: cargo-gen · Next: Chapter 22, third-party-notices/ →