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

Feature gate to minimize polkadot-sdk-docs build time #2937

Closed
wants to merge 6 commits into from

Conversation

nuke-web3
Copy link
Contributor

@nuke-web3 nuke-web3 commented Jan 15, 2024

Typically in webdev and docsdev, instant rendering of HTML in "dev" or "watching" mode is possible. Sadly AFAIK rustdocs does not support this kind of workflow and requires code compilation simply to view HTML. Rendering HTML only should not require building the universe. Without any ability prior to this PR to optionally build the crates referenced in the polkadot-sdk-docs crate, you would need to have a successful build of all deps.

This PR introduces a feature gate to allow minimal HTML only development of the polkadot-sdk-docs crate independent of it's internally referenced crates, taking the startup time to open the rendered HTML for it from many minutes to seconds on my machine.

Only the docs crate now is ~35 crate deps for mermaid and docify, and building all deps is ~1716 in total.

Todo

It still takes SOOOOO long to build, even with SKIP_WASM_BUILD=1 hangs on:

@nuke-web3 nuke-web3 added A1-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). R0-silent Changes should not be mentioned in any release notes I5-enhancement An additional feature request. T11-documentation This PR/Issue is related to documentation. labels Jan 15, 2024
@nuke-web3 nuke-web3 requested a review from juangirini January 15, 2024 23:23
@nuke-web3 nuke-web3 self-assigned this Jan 15, 2024
@nuke-web3 nuke-web3 marked this pull request as draft January 15, 2024 23:27
@@ -42,7 +42,6 @@
//!
//! [FRAME]: crate::polkadot_sdk::frame_runtime

#![deny(rustdoc::broken_intra_doc_links)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unclear if this lint must live here, if so it may need to be feature gated as it breaks the minimal docs build

@kianenigma
Copy link
Contributor

I have to inspect what is done here a bit further, but fwiw if you run cargo doc -p polkadot-sdk-docs --no-deps it is pretty fast (except for the first time) to recompile, and I doubt if it gets any faster than that as this will ignore all dependencies (again, except for the first run).

With this workflow, I do most of my writing with --no-deps, and only when I want to check my linking I will remove the --no-dep to see if all links work.

In general, if this is only an improvement on the first build, assuming you don't have any target dir cached, I don't think it is worth it.

//! # (Fastest) HTML ONLY - Only build the documentation crate, with MINIMAL code compilation.
//! RUSTDOCFLAGS="--html-in-header $(pwd)/docs/sdk/headers/toc.html" cargo doc -p polkadot-sdk-docs --no-default-features -F min-docs --no-deps --open
//!
//! # SDK Docs only - Minimal build - Only build the documentation crate, including code compilation for examples.
//! SKIP_WASM_BUILD=1 RUSTDOCFLAGS="--html-in-header $(pwd)/docs/sdk/headers/toc.html" cargo doc -p polkadot-sdk-docs --no-deps --open
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the command suggested to get the minimal docs build. I did try this again on present master, and what I was experiencing was what I think was very long linking times in the stage of building the full kitchensink runtime and node... I can't seem to reproduce now, so I agree this extra complexity isn't worth it to get fast HTML output to inspect while doing docs dev.

@nuke-web3 nuke-web3 closed this Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A1-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). I5-enhancement An additional feature request. R0-silent Changes should not be mentioned in any release notes T11-documentation This PR/Issue is related to documentation.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants