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/meson.build | |
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/meson.build')
-rw-r--r-- | rust/meson.build | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/rust/meson.build b/rust/meson.build index def7738..91e52b8 100644 --- a/rust/meson.build +++ b/rust/meson.build @@ -2,3 +2,25 @@ subdir('qemu-api-macros') subdir('qemu-api') subdir('hw') + +cargo = find_program('cargo', required: false) + +if cargo.found() + run_target('clippy', + command: [config_host['MESON'], 'devenv', + '--workdir', '@CURRENT_SOURCE_DIR@', + cargo, 'clippy', '--tests'], + depends: bindings_rs) + + run_target('rustfmt', + command: [config_host['MESON'], 'devenv', + '--workdir', '@CURRENT_SOURCE_DIR@', + cargo, 'fmt'], + depends: bindings_rs) + + run_target('rustdoc', + command: [config_host['MESON'], 'devenv', + '--workdir', '@CURRENT_SOURCE_DIR@', + cargo, 'doc', '--no-deps', '--document-private-items'], + depends: bindings_rs) +endif |