diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2024-11-13 09:11:48 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-12-10 18:44:06 +0100 |
commit | cab1d0bceb6d042674f6892216d1769021f73916 (patch) | |
tree | 872f6544c4dfa2e435584cc469435f859e5970b6 /rust/qemu-api | |
parent | 2f9eec8f72673f97766eba1682a75f06f16302cb (diff) | |
download | qemu-cab1d0bceb6d042674f6892216d1769021f73916.zip qemu-cab1d0bceb6d042674f6892216d1769021f73916.tar.gz qemu-cab1d0bceb6d042674f6892216d1769021f73916.tar.bz2 |
rust: build: add "make clippy", "make rustfmt", "make rustdoc"
Abstract common invocations of "cargo", that do not require copying
the generated bindgen file or setting up MESON_BUILD_ROOT.
In the future these could also do completely without cargo and invoke
the underlying programs directly.
Reviewed-by: Junjie Mao <junjie.mao@hotmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust/qemu-api')
-rw-r--r-- | rust/qemu-api/README.md | 10 | ||||
-rw-r--r-- | rust/qemu-api/build.rs | 9 |
2 files changed, 13 insertions, 6 deletions
diff --git a/rust/qemu-api/README.md b/rust/qemu-api/README.md index 53810f4..ed1b7ab 100644 --- a/rust/qemu-api/README.md +++ b/rust/qemu-api/README.md @@ -5,13 +5,15 @@ This library exports helper Rust types, Rust macros and C FFI bindings for inter The C bindings can be generated with `bindgen`, using this build target: ```console -$ ninja bindings.inc.rs +$ make bindings.inc.rs ``` ## Generate Rust documentation -To generate docs for this crate, including private items: +Common Cargo tasks can be performed from the QEMU build directory -```sh -pyvenv/bin/meson devenv -w ../rust cargo doc --no-deps --document-private-items +```console +$ make clippy +$ make rustfmt +$ make rustdoc ``` diff --git a/rust/qemu-api/build.rs b/rust/qemu-api/build.rs index 40644d5..471e6c6 100644 --- a/rust/qemu-api/build.rs +++ b/rust/qemu-api/build.rs @@ -20,8 +20,13 @@ fn main() -> Result<()> { let file = Path::new(&file); if !Path::new(&file).exists() { panic!(concat!( - "No generated C bindings found! If you want to run `cargo`, start a subshell\n", - "with `meson devenv`, or point MESON_BUILD_ROOT to the top of the build tree." + "\n", + " No generated C bindings found! Maybe you wanted one of\n", + " `make clippy`, `make rustfmt`, `make rustdoc`?\n", + "\n", + " For other uses of `cargo`, start a subshell with\n", + " `pyvenv/bin/meson devenv`, or point MESON_BUILD_ROOT to\n", + " the top of the build tree." )); } |