scripts/generate_rust_analyzer.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
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@gmail.com>
---
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
On Mon, Oct 7, 2024 at 1:03 AM Luna Xin <luna.xin.lx@gmail.com> wrote: > > 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@gmail.com> > --- > 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)) This says that uapi only depends on core, but how does that interact with this patch? https://lore.kernel.org/all/20240913213041.395655-1-gary@garyguo.net/ Alice
© 2016 - 2024 Red Hat, Inc.