summary refs log tree commit diff stats
path: root/rust/qemu-api
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-11-13 09:11:48 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2024-12-10 18:44:06 +0100
commitcab1d0bceb6d042674f6892216d1769021f73916 (patch)
tree872f6544c4dfa2e435584cc469435f859e5970b6 /rust/qemu-api
parent2f9eec8f72673f97766eba1682a75f06f16302cb (diff)
downloadfocaccia-qemu-cab1d0bceb6d042674f6892216d1769021f73916.tar.gz
focaccia-qemu-cab1d0bceb6d042674f6892216d1769021f73916.zip
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.md10
-rw-r--r--rust/qemu-api/build.rs9
2 files changed, 13 insertions, 6 deletions
diff --git a/rust/qemu-api/README.md b/rust/qemu-api/README.md
index 53810f4888..ed1b7ab263 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 40644d5e4f..471e6c633d 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."
         ));
     }