Skip to content
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

Enabled comments in bindgen and added doxygen pre-processor #30

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

nikarh
Copy link
Member

@nikarh nikarh commented Mar 8, 2024

Motivation

  • Rustdoc comments integrate well with IDEs and improve dev experience
  • Using docs.rs is a very convenient way to understand what things do and how things work

Implementation

Luckily, comments in the headers mostly follow Doxygen formatting. doxygen-rs crate does exactly what we need and converts them to rustdoc format.

Without additional pre-processing, doxygen_rs::transform panics due to some mistakes and unexpected things in the comments, thus the callback first fixes them.
After the transformation, some of the prefixes used for field comments in headers are stripped away, e.g. this

I've also committed the generated bindings, although I'm not sure what our workflow is with them (as in should they be updated solely by gh actions, or is committing them ok?). Anyway, the committed bindings show how the comments look like with these changes.

@nikarh nikarh requested review from pheki and zetanumbers March 8, 2024 09:05
Copy link
Member

@pheki pheki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

I've also committed the generated bindings, although I'm not sure what our workflow is with them (as in should they be updated solely by gh actions, or is committing them ok?). Anyway, the committed bindings show how the comments look like with these changes.

Yep, you should commit them, CI will check if they're correct. For now CI only commits generated bindings when creating or updating the "Update bindings" PR.

Can you add a new version to the changelog? Something like

## [0.3.4] - Unreleased

### Added

- Doc comments are now also copied from vitasdk (#30).

build-util/src/bindgen.rs Show resolved Hide resolved
@nikarh
Copy link
Member Author

nikarh commented Mar 9, 2024

I made a PR to doxygen-rs to enable code blocks that will retain the formatting - Techie-Pi/doxygen-rs/pull/9.

@pheki
Copy link
Member

pheki commented Mar 10, 2024

It seems that your last commit adds comments for deprecated fields, such as:

+ #[doc = "Others read permission. Deprecated, use ::SCE_S_IXSYS"]
  pub const SCE_S_IROTH: SceIoAccessMode = 4;

And those are good, but they're not getting generated on my end... Do you know why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants