-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support to generate rust-project.json #2
Adding support to generate rust-project.json #2
Conversation
I am using the script for out of tree modules and it works fantastic. However, I am encountering a proc-macro error for the
Curious if you have seen it before? |
@jordanisaacs I haven't seen that before. Do you see that when running |
It is a rust-analyzer diagnostic error. Everything else works great (docs, go to, completion, etc). Only difference from how this PR does it is rather than calling |
…e linux/rust Makefile
a75095a
to
615f4f2
Compare
Ah, you found a bug (well two), thank you @jordanisaacs. Updated the script to not typo "include_dirs", and also actually updating the list with the new fully-qualified paths. |
Can confirm that fixed it @thepacketgeek thanks, this script is fantastic! |
Related: Rust-for-Linux/linux#914 |
Even better, nicer that module writers don't need to duplicate this effort for every module. I'll close this PR, Thank you! |
Thanks to you, Mat, for sending the PR! :) If you have time, please take a look at the other PR, and perhaps give a |
(And of course you can review it too: |
Adds support for out-of-tree rust modules to use the `rust-analyzer` make target to generate the rust-project.json file. The change involves adding an optional parameter `external_src` to the `generate_rust_analyzer.py` which expects the path to the out-of-tree module's source directory. 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. Related 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. Link: Rust-for-Linux#914 Link: Rust-for-Linux/rust-out-of-tree-module#2 Signed-off-by: Vinay Varma <varmavinaym@gmail.com>
Adds support for out-of-tree rust modules to use the `rust-analyzer` make target to generate the rust-project.json file. The change involves adding an optional parameter `external_src` to the `generate_rust_analyzer.py` which expects the path to the out-of-tree module's source directory. 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. Related 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. Link: Rust-for-Linux#914 Link: Rust-for-Linux/rust-out-of-tree-module#2 Signed-off-by: Vinay Varma <varmavinaym@gmail.com>
Adds support for out-of-tree rust modules to use the `rust-analyzer` make target to generate the rust-project.json file. The change involves adding an optional parameter `external_src` to the `generate_rust_analyzer.py` which expects the path to the out-of-tree module's source directory. 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. Related 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. Link: Rust-for-Linux#914 Link: Rust-for-Linux/rust-out-of-tree-module#2 Signed-off-by: Vinay Varma <varmavinaym@gmail.com>
Adds support for out-of-tree rust modules to use the `rust-analyzer` make target to generate the rust-project.json file. The change involves adding an optional parameter `external_src` to the `generate_rust_analyzer.py` which expects the path to the out-of-tree module's source directory. 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. Related 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. Link: Rust-for-Linux#914 Link: Rust-for-Linux/rust-out-of-tree-module#2 Signed-off-by: Vinay Varma <varmavinaym@gmail.com>
Adds support for out-of-tree rust modules to use the `rust-analyzer` make target to generate the rust-project.json file. The change involves adding an optional parameter `external_src` to the `generate_rust_analyzer.py` which expects the path to the out-of-tree module's source directory. 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. Related 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. Link: Rust-for-Linux#914 Link: Rust-for-Linux/rust-out-of-tree-module#2 Signed-off-by: Vinay Varma <varmavinaym@gmail.com>
Adds support for out-of-tree rust modules to use the `rust-analyzer` make target to generate the rust-project.json file. The change involves adding an optional parameter `external_src` to the `generate_rust_analyzer.py` which expects the path to the out-of-tree module's source directory. 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. Related 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. Link: #914 Link: Rust-for-Linux/rust-out-of-tree-module#2 Signed-off-by: Vinay Varma <varmavinaym@gmail.com> Link: https://lore.kernel.org/r/20230411091714.130525-1-varmavinaym@gmail.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Adds support for out-of-tree rust modules to use the `rust-analyzer` make target to generate the rust-project.json file. The change involves adding an optional parameter `external_src` to the `generate_rust_analyzer.py` which expects the path to the out-of-tree module's source directory. 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. Related 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. Link: #914 Link: Rust-for-Linux/rust-out-of-tree-module#2 Signed-off-by: Vinay Varma <varmavinaym@gmail.com> Link: https://lore.kernel.org/r/20230411091714.130525-1-varmavinaym@gmail.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Adds support for out-of-tree rust modules to use the `rust-analyzer` make target to generate the rust-project.json file. The change involves adding an optional parameter `external_src` to the `generate_rust_analyzer.py` which expects the path to the out-of-tree module's source directory. 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. Related 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. Link: Rust-for-Linux#914 Link: Rust-for-Linux/rust-out-of-tree-module#2 Signed-off-by: Vinay Varma <varmavinaym@gmail.com> Link: https://lore.kernel.org/r/20230411091714.130525-1-varmavinaym@gmail.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Adds support for out-of-tree rust modules to use the `rust-analyzer` make target to generate the rust-project.json file. The change involves adding an optional parameter `external_src` to the `generate_rust_analyzer.py` which expects the path to the out-of-tree module's source directory. 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. Related 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. Link: Rust-for-Linux#914 Link: Rust-for-Linux/rust-out-of-tree-module#2
Using the
linux/scripts/generate_rust_analyzer.py
script as inspiration to add amake rust-analyzer
target for an out-of-tree module.Process:
$KDIR
rust-project by issuingmake rust-analyzer
rust-project.json
in the module directoryHere's an example of the added module crate config:
And the updated
kernel
crate config (pointing at my KDIR of ../rust_for_linux):===
One janky thing I'm not currently a fan of is getting the
root_module
and rust source file name. This script currently only supports one file/module. I'd prefer to get it from the Kbuild file by readingobj-m
but I'm not sure how to do that, any suggestions here are welcome.