summaryrefslogtreecommitdiff
path: root/scripts/generate_rust_analyzer.py
diff options
context:
space:
mode:
authorMiguel Ojeda <ojeda@kernel.org>2025-03-08 11:05:01 +0000
committerMiguel Ojeda <ojeda@kernel.org>2025-03-16 21:59:19 +0100
commitd7659acca7a390b5830f0b67f3aa4a5f9929ab79 (patch)
tree0550bee1f3ef6ca47af75ab9624cd510a1963b1f /scripts/generate_rust_analyzer.py
parentb321b9385409800859c2be722c6141909c7221b3 (diff)
downloadlwn-d7659acca7a390b5830f0b67f3aa4a5f9929ab79.tar.gz
lwn-d7659acca7a390b5830f0b67f3aa4a5f9929ab79.zip
rust: add pin-init crate build infrastructure
Add infrastructure for moving the initialization API to its own crate. Covers all make targets such as `rust-analyzer` and `rustdoc`. The tests of pin-init are not added to `rusttest`, as they are already tested in the user-space repository [1]. Link: https://github.com/Rust-for-Linux/pin-init [1] Co-developed-by: Benno Lossin <benno.lossin@proton.me> Signed-off-by: Benno Lossin <benno.lossin@proton.me> Tested-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://lore.kernel.org/r/20250308110339.2997091-15-benno.lossin@proton.me Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
-rwxr-xr-xscripts/generate_rust_analyzer.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
index aa8ea1a4dbe5..a44a4475d11f 100755
--- a/scripts/generate_rust_analyzer.py
+++ b/scripts/generate_rust_analyzer.py
@@ -94,9 +94,24 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs):
crates[-1]["env"]["OBJTREE"] = str(objtree.resolve(True))
append_crate(
+ "pin_init_internal",
+ srctree / "rust" / "pin-init" / "internal" / "src" / "_lib.rs",
+ [],
+ cfg=["kernel"],
+ is_proc_macro=True,
+ )
+
+ append_crate(
+ "pin_init",
+ srctree / "rust" / "pin-init" / "src" / "_lib.rs",
+ ["core", "pin_init_internal", "macros"],
+ cfg=["kernel"],
+ )
+
+ append_crate(
"kernel",
srctree / "rust" / "kernel" / "lib.rs",
- ["core", "macros", "build_error", "bindings"],
+ ["core", "macros", "build_error", "bindings", "pin_init"],
cfg=cfg,
)
crates[-1]["source"] = {