-
Notifications
You must be signed in to change notification settings - Fork 36
docgen/website: show deprecated function warnings on docs website #584
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
base: main
Are you sure you want to change the base?
Conversation
Maybe we should start checking in the data JSON and set up CI to verify that a fresh That way we could review the JSON diffs alongside code updates (both to the tool & the lib) to see if we accidentally lose items/comments/etc. |
Thanks for the review 🌠 I'll iterate this weekend. |
746a69e
to
968640d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for all the nitty feedback...
Will try to return to this soon. The weather has been too nice to spend weekends indoors 😆 |
This way we can review updates to the website documentation data alongside code changes. ``` $ git rev-parse HEAD 3f5b127 $ cargo run --manifest-path tools/Cargo.toml --bin docgen > ./website/static/api.json Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.06s Running `target/debug/docgen` ```
Now that we're checking in the `api.json` content generated by the `docgen` tool the expectation is that there shouldn't be any uncommitted diffs when running the tool fresh in CI.
But update the package/upload and deploy steps to only happen for rustls-ffi's main branch.
Also rename some bindings for clarity. The input node is the previous sibling node for a to-be-documented item so call it `prev`. We also look at `prev`'s previous sibling node, so call those instances `prev_prev`.
We also only care about named (not anonymous) sibling nodes, so use just `prev_named_sibling()` instead of the mix of `prev_sibling()` and `prev_named_sibling()`.
Handle the simple case up-front.
We can handle the case where prev is an expression_statement by recursing with `prev_prev`.
When we know prev wasn't a comment or an expression statement preceded by a comment.
The `api.json` data is updated to add the newly parsed deprecation messages.
968640d
to
f349f0d
Compare
Updates the
docgen
tool from thetools
crate to parse theDEPRECATED_FUNC
macro invocations ahead of function declarations. Once parsed we can pull out the argument message and include that in the JSON data generated by the tool.With the deprecated messages the
website
Zola templates can reference them to add a note of the deprecation in the TOC and to add a warning banner to the item's docs rendering.Resolves #582
Examples: