lkml.org 
[lkml]   [2023]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] scripts: `make rust-analyzer` for out-of-tree modules
On Wed, Jan 18, 2023 at 5:02 PM Vinay Varma <varmavinaym@gmail.com> wrote:
>
> Adds support for out-of-tree rust modules to use the `rust-analyzer`
> make target to generate the rust-project.json file.

Thanks for sending this! A few nits below...

> When this parameter is passed, I have chosen
> not to add the non-core modules (samples and drivers) into the result
> since these are not expected to be used in third party modules.

Sounds good to me.

> changes are also made to the Makefile and rust/Makefile allowing the
> `rust-analyzer` target to be used for out-of-tree modules as well.
>
> Signed-off-by: Vinay Varma <varmavinaym@gmail.com>

A `Link: ` to the GitHub PR would be nice here:
https://github.com/Rust-for-Linux/linux/pull/914.

Possibly another one to the out-of-tree approach at
https://github.com/Rust-for-Linux/rust-out-of-tree-module/pull/2.

> import logging
> import pathlib
> import sys
> +import os

Please keep the `import`s sorted.

> - for folder in ("samples", "drivers"):
> + extra_src_dirs = ["samples", "drivers"] if external_src is None else [external_src]

If you send a v2 for the above, this could be a tuple like in the
original line, to minimize the diff.

> + if os.path.exists(path.parent / "Makefile") and f"{name}.o" not in open(path.parent / "Makefile").read():

In Python one would typically go with the EAFP style instead
(https://docs.python.org/3/glossary.html#term-EAFP), which would also
reduce the duplication of the path computation. But it would take more
lines... Not a big deal in any case.

Thanks!

Cheers,
Miguel

\
 
 \ /
  Last update: 2023-03-26 23:48    [W:0.711 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site