From nobody Sat Nov 23 22:03:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1731089076; cv=none; d=zohomail.com; s=zohoarc; b=E1iKRPNUJdOruIKXnCKra9j0a3XvorVNeon0iWGJc5oSfR9hryRqIwT1rpTnh0cKpuWBYJWT8pHjQqit1A1DAGjFQDMkC4FYIn1fi1lL5RIoghiG1f1BegspPZSvY7XU+iE88y0Q48vgrBD2Ds4UIeJa5ocncR4iPziWnrwODks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731089076; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=yguWnQXG15f2x+f4QNRnXEOFJJORIkMpafNaeGv6vH0=; b=BKWXZ+YfgJn6EPsJPPwcDeypmcc429E53yBa/hEPsh9OX9+eTUcC+wfUaLezAE45Z34sP6TIeSkhKETMyL/9XHt4mOkzSqptb1wahWnkO/FscB273OO61hLS3HGRw1RfwFevTKXRKTjOx1FQCxRA2O3Ddd5uaWok7O+VAQ+NYYc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731089076575949.1582808557134; Fri, 8 Nov 2024 10:04:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t9TJI-000224-6z; Fri, 08 Nov 2024 13:02:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t9TJE-0001wS-RI for qemu-devel@nongnu.org; Fri, 08 Nov 2024 13:02:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t9TJB-0001xJ-65 for qemu-devel@nongnu.org; Fri, 08 Nov 2024 13:02:12 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-652-QdOMtPJ3NEuQr7td3br4jQ-1; Fri, 08 Nov 2024 13:02:07 -0500 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-43159603c92so16424105e9.2 for ; Fri, 08 Nov 2024 10:02:07 -0800 (PST) Received: from [192.168.10.47] ([151.49.84.243]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed99a34bsm5458399f8f.54.2024.11.08.10.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 10:02:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731088928; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yguWnQXG15f2x+f4QNRnXEOFJJORIkMpafNaeGv6vH0=; b=CqECri+hqeXvWkaICgd2V3sFrPZ2pxuon8uqa78nHxw4EM/UUIRKuVEQS1sRWLLTa0n61O rzAQt1HpD+D0HzqjumIalHo7LQOKABiBjpLvcxtEm6q42GWeqHU0RgcS0bf5mqBaZRcsnr +aLsoQtFCU6bF5HwXZZPIb2kWLx8Bo0= X-MC-Unique: QdOMtPJ3NEuQr7td3br4jQ-1 X-Mimecast-MFC-AGG-ID: QdOMtPJ3NEuQr7td3br4jQ X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731088926; x=1731693726; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yguWnQXG15f2x+f4QNRnXEOFJJORIkMpafNaeGv6vH0=; b=VC5Gahk84xYvcrUiB85QXD/GxPoOrzRvkxgR4IrIhoSlZASQ1/Ly/e5t2cHzYw9dRE G9rpYuaCascW6ncsUht7mwQcBQhD/tTEsEDDfaFYgDTg/7aoguJ00FQSfYe6ePTzTmIv 2ojeszryw4Ngh6cPcOQXtpKQ8fD9/vOfKUN0czVDtbBR2kW2Vne3tkfghLCiRqeamo2V gmEAWFkN1e/jqA4o4A5fMg6aC4UXSSgj9qBG+yMLH2srWayly1PWim+HT6YNaEAuLOwk rJXy5LSa7jkB3lAz+SFFk2aeVLigsviI0IOv7hMmaEXbkq5aL2LhK4EW6H2k2KtNJsdj Z+UA== X-Gm-Message-State: AOJu0YwH2KDldrQdErDzmczj3Qg48gFq0sY0L0A8h8jPF4j2bCG28P45 tDn0aiIRFNbf5KQvy1XVqoGowtghidOlafZQLlmwSrQmaIESHWCq/qnfebghSx0cr/kvovvTrz1 V8aJxuBAatulOr2ynJDtTR07jxtKAeORs+qXMpMe2vcKW3YiPRHnzaZL5O77atjmOtRXzaB+ZZw 2FBJEjmDdnh2lpT4VU3hcoP2DsYGosQePFW2TW1+E= X-Received: by 2002:a05:6000:1869:b0:381:f0ce:d09e with SMTP id ffacd0b85a97d-381f18635f4mr3179841f8f.7.1731088925924; Fri, 08 Nov 2024 10:02:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHI1VHnlt4sb0wupEKO0ihKDfs7+WzKbqgIge8H1VNg5+78Gte/1/HoI29L4264/OuICIyW1A== X-Received: by 2002:a05:6000:1869:b0:381:f0ce:d09e with SMTP id ffacd0b85a97d-381f18635f4mr3179788f8f.7.1731088925418; Fri, 08 Nov 2024 10:02:05 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: manos.pitsidianakis@linaro.org, kwolf@redhat.com, junjie.mao@hotmail.com, zhao1.liu@intel.com, qemu-rust@nondevel.org Subject: [RFC PATCH 09/11] rust: build: add "make clippy", "make rustfmt" Date: Fri, 8 Nov 2024 19:01:37 +0100 Message-ID: <20241108180139.117112-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241108180139.117112-1-pbonzini@redhat.com> References: <20241108180139.117112-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.34, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1731089076888116600 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Paolo Bonzini Reviewed-by: Junjie Mao --- rust/meson.build | 14 ++++++++++++++ rust/qemu-api/build.rs | 8 ++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/rust/meson.build b/rust/meson.build index def77389cdd..6fa0fd54527 100644 --- a/rust/meson.build +++ b/rust/meson.build @@ -2,3 +2,17 @@ subdir('qemu-api-macros') subdir('qemu-api') =20 subdir('hw') + +cargo =3D find_program('cargo') + +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) diff --git a/rust/qemu-api/build.rs b/rust/qemu-api/build.rs index e4eab718553..d7b6d76828b 100644 --- a/rust/qemu-api/build.rs +++ b/rust/qemu-api/build.rs @@ -15,8 +15,12 @@ fn main() { let file =3D format!("{}/bindings.rs.inc", path); if !Path::new(&file).exists() { panic!(concat!( - "No generated C bindings found! If you want to run `cargo`, st= art a subshell\n", - "with `meson devenv`, or point MESON_BUILD_ROOT to the top of = the build tree." + "\n", + " No generated C bindings found! To run clippy or rustfmt, = you can use\n", + " `make clippy` or `make rustfmt`.\n", + "\n", + " For other uses of `cargo`, start a subshell with `meson d= evenv`, or\n", + " point MESON_BUILD_ROOT to the top of the build tree." )); } =20 --=20 2.47.0