[PATCH] scripts: add `uapi` crate to `generate_rust_analyzer.py`

From: Luna Xin
Date: Sun Oct 06 2024 - 19:03:15 EST


This patch updates the `generate_rust_analyzer.py` script to include
the `uapi` crate.

This allows a proper `rust-project.json` to be generated by the script
so that driver developers can take advantage of rust-analyzer code
completions when interfacing with `uapi`.

Signed-off-by: Luna Xin <luna.xin.lx@xxxxxxxxx>
---
scripts/generate_rust_analyzer.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
index d2bc63cde..61214fd2f 100755
--- a/scripts/generate_rust_analyzer.py
+++ b/scripts/generate_rust_analyzer.py
@@ -93,10 +93,18 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs):
)
crates[-1]["env"]["OBJTREE"] = str(objtree.resolve(True))

+ append_crate(
+ "uapi",
+ srctree / "rust"/ "uapi" / "lib.rs",
+ ["core"],
+ cfg=cfg,
+ )
+ crates[-1]["env"]["OBJTREE"] = str(objtree.resolve(True))
+
append_crate(
"kernel",
srctree / "rust" / "kernel" / "lib.rs",
- ["core", "alloc", "macros", "build_error", "bindings"],
+ ["core", "alloc", "macros", "build_error", "bindings", "uapi"],
cfg=cfg,
)
crates[-1]["source"] = {

base-commit: f5e50614e39e74401b492a2fa125f2e2b6458bab
--
2.46.2