[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250424-rust-analyzer-host-v6-12-40e67fe5c38a@gmail.com>
Date: Thu, 24 Apr 2025 06:38:40 -0400
From: Tamir Duberstein <tamird@...il.com>
To: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>,
Boris-Chengbiao Zhou <bobo1239@....de>, Kees Cook <kees@...nel.org>,
Fiona Behrens <me@...enk.dev>
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
Lukas Wirth <lukas.wirth@...rous-systems.com>,
Tamir Duberstein <tamird@...il.com>,
Daniel Almeida <daniel.almeida@...labora.com>
Subject: [PATCH v6 12/13] scripts: generate_rust_analyzer.py: define
scripts
Generate rust-project.json entries for scripts written in Rust. This is
possible now that we have a definition for `std` built for the host.
Use `Pathlib.path.stem` for consistency.
Reviewed-by: Daniel Almeida <daniel.almeida@...labora.com>
Tested-by: Daniel Almeida <daniel.almeida@...labora.com>
Reviewed-by: Fiona Behrens <me@...enk.dev>
Reviewed-by: Trevor Gross <tmgross@...ch.edu>
Signed-off-by: Tamir Duberstein <tamird@...il.com>
---
scripts/generate_rust_analyzer.py | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
index 93b96b219a42..5f04e3785854 100755
--- a/scripts/generate_rust_analyzer.py
+++ b/scripts/generate_rust_analyzer.py
@@ -257,6 +257,19 @@ def generate_crates(
cfg=[],
)
+ scripts = srctree / "scripts"
+ makefile = (scripts / "Makefile").read_text()
+ for path in scripts.glob("*.rs"):
+ name = path.stem
+ if f"{name}-rust" not in makefile:
+ continue
+ _script = append_crate(
+ name,
+ path,
+ deps=[host_std],
+ cfg=[],
+ )
+
def is_root_crate(build_file: pathlib.Path, target: str) -> bool:
try:
with open(build_file) as f:
@@ -273,7 +286,7 @@ def generate_crates(
for folder in extra_dirs:
for path in folder.rglob("*.rs"):
logging.info("Checking %s", path)
- name = path.name.replace(".rs", "")
+ name = path.stem
# Skip those that are not crate roots.
if not is_root_crate(path.parent / "Makefile", name) and \
--
2.49.0
Powered by blists - more mailing lists