Rename output of -ebpf crate - #146
Conversation
|
I chose Other than that, if you have any other suggestions for a better output name, feel free to change it. |
|
Can you add doc generation to CI so we can ensure it doesn't break? |
|
I have just tried the solution in the PR and I have the {{project_name}}_ebpf in the "crates" section, but the content in this new menu is empty. |
|
@miniduikboot can you address @ErrorTeaPot's comment? |
|
Hi Tamir, I think I understand the comment: when you generate the cargo docs, it uses the source code of the library, which is not interesting compared to the source code of the bin target. It does however add the dependencies of the {{project_name}}-ebpf crate, which I found interesting enough to PR this in. ErrorTeaPot wanted me to take this second step, and add the bin source code to the docs. It looks like cargo does this because the binary and library targets have the same name: https://github.com/rust-lang/cargo/blob/3b379fcc541b39321a7758552d37e5e0cc4277b9/src/doc/src/reference/cargo-targets.md#the-doc-field Setting doc = false on the library target leads to no docs at all, so this is not an option. Removing the library target is also not an option, as this throws the warning If I rename the library target and also set doc = false, it adds the app source code to rustdoc and skips the lib source. I however don't know what the further consequences are of this wrt the dependency to the ebpf crate in {{project_name}}/Cargo.toml: renaming it to {{project_name}}_ebpf_dummy is not possible as that package doesn't exist. I have no clue however why this works like this. I see two options:
|
|
I think rename the library makes sense. How come you added |
This makes it possible to run `cargo doc --workspace` and get both the eBPF and normal crate and their dependencies in the output docs. Fixes: aya-rs/aya#1260
If a crate has both a lib and a bin target, cargo will prefer to generate for the library target[1]. By renaming the library target, we force cargo to document the binary instead. [1]: https://github.com/rust-lang/cargo/blob/3b379fcc541b39321a7758552d37e5e0cc4277b9/src/doc/src/reference/cargo-targets.md#the-doc-field
|
I'll rebase to see if the issue goes away |
|
Ah it seems a real issue caused by this change. The panic handler is now defined twice (lib and bin) |
|
Yeah, but I'm not sure why it's triggered now and only on this example, as I didn't change anything wrt the definition of the panic handler |
|
Ah, it's because of unification. See aya-rs/aya@3078e5a.
aya-template/{{project-name}}-ebpf/src/main.rs Lines 116 to 123 in 0158e1b |
This makes it possible to run
cargo doc --workspaceand get both the eBPF and normal crate and their dependencies in the output docs.Fixes: aya-rs/aya#1260
This change is