Re: [PATCH] scripts: `make rust-analyzer` for out-of-tree modules

From: Miguel Ojeda
Date: Fri Jan 20 2023 - 08:35:46 EST


On Fri, Jan 20, 2023 at 2:17 PM Björn Roy Baron
<bjorn3_gh@xxxxxxxxxxxxxx> wrote:
>
> I tested this with https://github.com/Rust-for-Linux/rust-out-of-tree-module using "make -C ../rust-for-linux M=$(pwd) rust-analyzer". It produces a rust-project.json file, however it misses the actual rust_out_of_tree crate. This is due to the fact that generate_rust_analyzer.py only checks Makefile to find the crate roots, but rust-out-of-tree-module defines it in Kbuild instead.

Thanks for testing it! Indeed, we should support out-of-tree modules
using the `Kbuild` + `Makefile` approach.

Having said that, I wonder if we should even attempt to perform the
search for out-of-tree modules. The search loop is a simple hack which
works fine for in-tree code because we know the structure of the code
around us, but we cannot for out-of-tree modules. For instance, they
may be using a different build system, or not mentioning the object
file, etc.

Perhaps we should simply ask them to give us the roots directly as a
list of arguments to the script or similar.

Cheers,
Miguel