Run `rustdoc` on libgkrust, and host the results somewhere
Categories
(Developer Infrastructure :: Source Documentation, enhancement)
Tracking
(Not tracked)
People
(Reporter: nika, Assigned: manuel, Mentored)
References
(Blocks 2 open bugs)
Details
(Keywords: good-first-bug, Whiteboard: [lang=python])
Attachments
(1 file)
Comment 1•8 years ago
|
||
Comment 2•8 years ago
|
||
Updated•8 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Comment 4•5 years ago
|
||
FWIW, you can locally generate and view rustdocs for a crate in m-c like so:
cd xpcom/rust/xpcom
MOZ_TOPOBJDIR=/path/to/objdir cargo doc
cd -
firefox target/doc/xpcom/index.html
Which is better than nothing.
Updated•3 years ago
|
Updated•3 years ago
|
| Assignee | ||
Updated•3 years ago
|
Comment 5•3 years ago
|
||
Recognizing that hosting is not the main effort here, searchfox could host the rendered docs which could enable a high confidence[1] "go to rustdoc for FOO" context menu option in searchfox and appropriate annotations in search results.
1: High confidence in this case meaning that searchfox could gate the availability of the context menu on having downloading the rendered rustdoc directly corresponding to the indexed revision and extracted it. It would of course always be possible for searchfox to blindly generate links to the docs hosted elsewhere, it's just harder to guarantee invariants about the links.
| Assignee | ||
Comment 6•2 years ago
|
||
When trying to compile the docs on my linux setup I get build errors regarding std::os::windows not being available. But building the docs on windows might work (I don't have a build environment available for that, but we could use the CI).
BUILDCONFIG_RS=/home/user/dev/gecko/obj-x86_64-pc-linux-gnu/build/rust/mozbuild/buildconfig.rs MOZ_TOPOBJDIR=obj-x86_64-pc-linux-gnu/ cargo doc --workspace
Andrew, is that enough for you to host the docs on searchfox? I think that'd be great. I have no experience in CI, so couldn't try running that command (modified to the windows environment) there yet. I would like to help with this bug if further work is required and someone could mentor me (as this is also marked as good-first-bug).
Comment 7•2 years ago
|
||
(I'm no longer working on searchfox, clearing need-info.)
| Assignee | ||
Comment 8•9 days ago
|
||
This is running "cargo doc" on gkrust. The results are in the object
directly. On linux the entry point of the documentation could look like:
obj-x86_64-pc-linux-gnu/x86_64-unknown-linux-gnu/doc/gkrust/index.html
The output of obj-x86_64-pc-linux-gnu/x86_64-unknown-linux-gnu/doc/
contains all the documentation of crates that can be hosted somewhere.
The documentation build takes 4:25 minutes on my computer.
Updated•9 days ago
|
| Assignee | ||
Comment 9•9 days ago
|
||
A few other steps necessary:
- create an archive with the docs https://searchfox.org/firefox-main/rev/804ffad3df416ac8418f3c0df7679a8fe3d718fa/toolkit/mozapps/installer/packager.mk#88-95 (thanks emilio for giving this example)
- retrieve this archive to host the documentation somewhere. Hosting it somewhere. Directly on searchfox feels a bit misfitting. On firefox-source-docs would probably be better. Perhaps "https://firefox-source-docs.mozilla.org/rustdoc/"?
@sylvestre: Can you mentor on after building this in CI how to put this on source-docs?
Comment 11•9 days ago
|
||
FWIW I think our docs are currently built like this
Comment 12•9 days ago
|
||
Ahal knows the upload part more than I
(but I am curious, i would like to enable https on the staging doc page :)
| Assignee | ||
Comment 13•9 days ago
|
||
I'm now considering to just build the rust doc as part of ./mach doc so that it automatically gets picked up by the current CI job instead of adding a separate archive that needs to be retrieved separately. (Leaving the needinfo for https on the staging doc page.)
Comment 14•9 days ago
•
|
||
I'm now considering to just build the rust doc as part of ./mach doc so that it automatically gets picked up by the current CI job instead of adding a separate archive that needs to be retrieved separately. (Leaving the needinfo for https on the staging doc page.)
Yes, this is what I was going to suggest. If you can find a Sphinx extension that can integrate rust docs into the existing Sphinx build, that's even better. After a quick search I found:
https://sphinxcontrib-rust.readthedocs.io/en/stable/
But I'm not familiar with Rust docs and am unsure if this satisfies the need you all are talking about here. The "Motivation" blurb certainly sounds like our use case though:
This is primarily meant for teams and projects that are already using Sphinx as a documentation build tool, and would like to include documentation for Rust projects in it along with Python, C, and other languages.
Comment 15•9 days ago
|
||
A benefit of bundling it with the current docs is the ability to use the roles and directives the above extension provides.
E.g, in any random doc file you'll be able to write:
:rust:struct:`Foo`
:rust:struct:`See Foo struct for more details <Foo>`
(or the myst_parser equivalent for markdown files)
And those will create a link directly to the API docs for the targeted item.
Comment 16•9 days ago
|
||
I'm now considering to just build the rust doc as part of ./mach doc
if it takes 4 minutes, i would rather not for now - at least in the local builds
in the ci, why not
Description
•