Messages in this thread | | | From | Miguel Ojeda <> | Date | Thu, 19 Jan 2023 20:12:56 +0100 | Subject | Re: [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
| |