From c3c85135839e8924f9a8e06bcb308553c5c66920 Mon Sep 17 00:00:00 2001 From: Nuke Date: Mon, 15 Jan 2024 13:41:27 -0700 Subject: [PATCH 1/6] move all docs deps to feature gate in cargo.toml --- docs/sdk/Cargo.toml | 101 +++++++++++++++++++----------- docs/sdk/src/meta_contributing.rs | 8 ++- 2 files changed, 72 insertions(+), 37 deletions(-) diff --git a/docs/sdk/Cargo.toml b/docs/sdk/Cargo.toml index 246da2cd68c6..b9c441e38906 100644 --- a/docs/sdk/Cargo.toml +++ b/docs/sdk/Cargo.toml @@ -15,55 +15,86 @@ workspace = true [dependencies] # Needed for all FRAME-based code -parity-scale-codec = { version = "3.0.0", default-features = false } -scale-info = { version = "2.6.0", default-features = false } -frame = { path = "../../substrate/frame", features = ["experimental", "runtime"] } -pallet-examples = { path = "../../substrate/frame/examples" } -pallet-default-config-example = { path = "../../substrate/frame/examples/default-config" } +parity-scale-codec = { version = "3.0.0", default-features = false, optional = true } +scale-info = { version = "2.6.0", default-features = false, optional = true } +frame = { path = "../../substrate/frame", features = ["experimental", "runtime"], optional = true } +pallet-examples = { path = "../../substrate/frame/examples", optional = true } +pallet-default-config-example = { path = "../../substrate/frame/examples/default-config", optional = true } # How we build docs in rust-docs simple-mermaid = { git = "https://github.com/kianenigma/simple-mermaid.git", rev = "e48b187bcfd5cc75111acd9d241f1bd36604344b" } docify = "0.2.6" # Polkadot SDK deps, typically all should only be in scope such that we can link to their doc item. -node-cli = { package = "staging-node-cli", path = "../../substrate/bin/node/cli" } -kitchensink-runtime = { path = "../../substrate/bin/node/runtime" } -chain-spec-builder = { package = "staging-chain-spec-builder", path = "../../substrate/bin/utils/chain-spec-builder" } -subkey = { path = "../../substrate/bin/utils/subkey" } +node-cli = { package = "staging-node-cli", path = "../../substrate/bin/node/cli", optional = true } +kitchensink-runtime = { path = "../../substrate/bin/node/runtime", optional = true } +chain-spec-builder = { package = "staging-chain-spec-builder", path = "../../substrate/bin/utils/chain-spec-builder", optional = true } +subkey = { path = "../../substrate/bin/utils/subkey", optional = true } # Substrate -sc-network = { path = "../../substrate/client/network" } -sc-rpc-api = { path = "../../substrate/client/rpc-api" } -sc-rpc = { path = "../../substrate/client/rpc" } -sc-client-db = { path = "../../substrate/client/db" } -sc-cli = { path = "../../substrate/client/cli" } -sc-consensus-aura = { path = "../../substrate/client/consensus/aura" } -sc-consensus-babe = { path = "../../substrate/client/consensus/babe" } -sc-consensus-grandpa = { path = "../../substrate/client/consensus/grandpa" } -sc-consensus-beefy = { path = "../../substrate/client/consensus/beefy" } -sc-consensus-manual-seal = { path = "../../substrate/client/consensus/manual-seal" } -sc-consensus-pow = { path = "../../substrate/client/consensus/pow" } -substrate-wasm-builder = { path = "../../substrate/utils/wasm-builder" } +sc-network = { path = "../../substrate/client/network", optional = true } +sc-rpc-api = { path = "../../substrate/client/rpc-api", optional = true } +sc-rpc = { path = "../../substrate/client/rpc", optional = true } +sc-client-db = { path = "../../substrate/client/db", optional = true } +sc-cli = { path = "../../substrate/client/cli", optional = true } +sc-consensus-aura = { path = "../../substrate/client/consensus/aura", optional = true } +sc-consensus-babe = { path = "../../substrate/client/consensus/babe", optional = true } +sc-consensus-grandpa = { path = "../../substrate/client/consensus/grandpa", optional = true } +sc-consensus-beefy = { path = "../../substrate/client/consensus/beefy", optional = true } +sc-consensus-manual-seal = { path = "../../substrate/client/consensus/manual-seal", optional = true } +sc-consensus-pow = { path = "../../substrate/client/consensus/pow", optional = true } +substrate-wasm-builder = { path = "../../substrate/utils/wasm-builder", optional = true } # Cumulus -cumulus-pallet-aura-ext = { path = "../../cumulus/pallets/aura-ext" } +cumulus-pallet-aura-ext = { path = "../../cumulus/pallets/aura-ext", optional = true } cumulus-pallet-parachain-system = { path = "../../cumulus/pallets/parachain-system", features = [ "parameterized-consensus-hook", -] } -parachain-info = { package = "staging-parachain-info", path = "../../cumulus/parachains/pallets/parachain-info" } -pallet-aura = { path = "../../substrate/frame/aura", default-features = false } -pallet-timestamp = { path = "../../substrate/frame/timestamp" } +], optional = true } +parachain-info = { package = "staging-parachain-info", path = "../../cumulus/parachains/pallets/parachain-info", optional = true } +pallet-aura = { path = "../../substrate/frame/aura", default-features = false, optional = true } +pallet-timestamp = { path = "../../substrate/frame/timestamp", optional = true } # Primitives -sp-io = { path = "../../substrate/primitives/io" } -sp-api = { path = "../../substrate/primitives/api" } -sp-core = { path = "../../substrate/primitives/core" } -sp-keyring = { path = "../../substrate/primitives/keyring" } -sp-runtime = { path = "../../substrate/primitives/runtime" } - -[dev-dependencies] -parity-scale-codec = "3.6.5" -scale-info = "2.9.0" +sp-io = { path = "../../substrate/primitives/io", optional = true } +sp-api = { path = "../../substrate/primitives/api", optional = true } +sp-core = { path = "../../substrate/primitives/core", optional = true } +sp-keyring = { path = "../../substrate/primitives/keyring", optional = true } +sp-runtime = { path = "../../substrate/primitives/runtime", optional = true } [features] +default = ["build-deps"] +build-deps = [ + "sp-io", + "parity-scale-codec", + "scale-info", + "frame", + "pallet-examples", + "pallet-default-config-example", + "node-cli", + "kitchensink-runtime", + "chain-spec-builder", + "subkey", + "sc-network", + "sc-rpc-api", + "sc-rpc", + "sc-client-db", + "sc-cli", + "sc-consensus-aura", + "sc-consensus-babe", + "sc-consensus-grandpa", + "sc-consensus-beefy", + "sc-consensus-manual-seal", + "sc-consensus-pow", + "substrate-wasm-builder", + "cumulus-pallet-aura-ext", + "cumulus-pallet-parachain-system", + "parachain-info", + "pallet-aura", + "pallet-timestamp", + "sp-io", + "sp-api", + "sp-core", + "sp-keyring", + "sp-runtime", +] experimental = ["pallet-aura/experimental"] diff --git a/docs/sdk/src/meta_contributing.rs b/docs/sdk/src/meta_contributing.rs index bff475f8e6bf..253a0aae621c 100644 --- a/docs/sdk/src/meta_contributing.rs +++ b/docs/sdk/src/meta_contributing.rs @@ -134,10 +134,14 @@ //! //! ## How to Develop Locally //! -//! To view the docs specific [`crate`] locally for development, including the correct HTML headers -//! injected, run: +//! To expedite documentation development and view _only_ the docs specific [`crate`] locally for development, including the correct HTML headers injected, run: //! //! ```sh +//! # (Fastest) Only build the documentation crate +//! SKIP_WASM_BUILD=1 RUSTDOCFLAGS="--html-in-header $(pwd)/docs/sdk/headers/toc.html" cargo doc -p polkadot-sdk-docs --no-deps --open +//! # (Full SDK) All documentation, no deps +//! SKIP_WASM_BUILD=1 RUSTDOCFLAGS="--html-in-header $(pwd)/docs/sdk/headers/toc.html" cargo doc -p polkadot-sdk-docs --no-deps --open +//! # (Full SDK) All documentation, with external deps //! SKIP_WASM_BUILD=1 RUSTDOCFLAGS="--html-in-header $(pwd)/docs/sdk/headers/toc.html" cargo doc -p polkadot-sdk-docs --no-deps --open //! ``` //! From 29824b54b2afbfe83e4b1ba8c930fe2be4e550fd Mon Sep 17 00:00:00 2001 From: Nuke Date: Mon, 15 Jan 2024 15:20:18 -0700 Subject: [PATCH 2/6] feature gate building anything not needed for sdk docs HTML --- docs/sdk/Cargo.toml | 11 ++++++++--- docs/sdk/src/guides/your_first_pallet/mod.rs | 3 +++ docs/sdk/src/lib.rs | 17 ++++++++++++----- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/docs/sdk/Cargo.toml b/docs/sdk/Cargo.toml index b9c441e38906..e3f8bea6b3c4 100644 --- a/docs/sdk/Cargo.toml +++ b/docs/sdk/Cargo.toml @@ -22,8 +22,9 @@ pallet-examples = { path = "../../substrate/frame/examples", optional = true } pallet-default-config-example = { path = "../../substrate/frame/examples/default-config", optional = true } # How we build docs in rust-docs -simple-mermaid = { git = "https://github.com/kianenigma/simple-mermaid.git", rev = "e48b187bcfd5cc75111acd9d241f1bd36604344b" } -docify = "0.2.6" +simple-mermaid = { git = "https://github.com/kianenigma/simple-mermaid.git", rev = "e48b187bcfd5cc75111acd9d241f1bd36604344b" , optional = true } +docify = { version = "0.2.6", optional = true } + # Polkadot SDK deps, typically all should only be in scope such that we can link to their doc item. node-cli = { package = "staging-node-cli", path = "../../substrate/bin/node/cli", optional = true } @@ -62,7 +63,11 @@ sp-keyring = { path = "../../substrate/primitives/keyring", optional = true } sp-runtime = { path = "../../substrate/primitives/runtime", optional = true } [features] -default = ["build-deps"] +default = ["min-docs", "build-deps"] +min-docs = [ + "simple-mermaid", + "docify", +] build-deps = [ "sp-io", "parity-scale-codec", diff --git a/docs/sdk/src/guides/your_first_pallet/mod.rs b/docs/sdk/src/guides/your_first_pallet/mod.rs index 24eada44a83a..9adddde45545 100644 --- a/docs/sdk/src/guides/your_first_pallet/mod.rs +++ b/docs/sdk/src/guides/your_first_pallet/mod.rs @@ -299,6 +299,7 @@ //! - Learn more about the individual pallet items/macros, such as event and errors and call, in //! [`frame::pallet_macros`]. +#[cfg(feature = "build-deps")] #[docify::export] #[frame::pallet(dev_mode)] pub mod shell_pallet { @@ -311,6 +312,7 @@ pub mod shell_pallet { pub struct Pallet(_); } +#[cfg(feature = "build-deps")] #[frame::pallet(dev_mode)] pub mod pallet { use frame::prelude::*; @@ -630,6 +632,7 @@ pub mod pallet { } } +#[cfg(feature = "build-deps")] #[frame::pallet(dev_mode)] pub mod pallet_v2 { use super::pallet::Balance; diff --git a/docs/sdk/src/lib.rs b/docs/sdk/src/lib.rs index 075d9ddaffe5..bda1d4a013a3 100644 --- a/docs/sdk/src/lib.rs +++ b/docs/sdk/src/lib.rs @@ -23,8 +23,15 @@ //! //! This section paints a picture over the high-level information architecture of this crate. #![doc = simple_mermaid::mermaid!("../../mermaid/IA.mmd")] -#![warn(rustdoc::broken_intra_doc_links)] -#![warn(rustdoc::private_intra_doc_links)] + +#![cfg(feature = "min-docs")] +#![allow(rustdoc::broken_intra_doc_links)] +#![allow(rustdoc::private_intra_doc_links)] + + +// #![cfg(feature = "build-deps")] +// #![deny(rustdoc::broken_intra_doc_links)] +// #![deny(rustdoc::private_intra_doc_links)] /// Meta information about this crate, how it is built, what principles dictates its evolution and /// how one can contribute to it. @@ -36,6 +43,6 @@ pub mod guides; /// An introduction to the Polkadot SDK. Read this module to learn about the structure of the SDK, /// the tools that are provided as a part of it, and to gain a high level understanding of each. pub mod polkadot_sdk; -/// Reference documents covering in-depth topics across the Polkadot SDK. It is suggested to read -/// these on-demand, while you are going through the [`guides`] or other content. -pub mod reference_docs; +// /// Reference documents covering in-depth topics across the Polkadot SDK. It is suggested to read +// /// these on-demand, while you are going through the [`guides`] or other content. +// pub mod reference_docs; From 8b476f88dc6f476598e440181f089982d8595e42 Mon Sep 17 00:00:00 2001 From: Nuke Date: Mon, 15 Jan 2024 15:54:05 -0700 Subject: [PATCH 3/6] feature gate all docs, skip deny lint if only HTML generation --- docs/sdk/src/lib.rs | 15 +++++++-------- docs/sdk/src/meta_contributing.rs | 15 +++++++-------- docs/sdk/src/reference_docs/extrinsic_encoding.rs | 2 ++ docs/sdk/src/reference_docs/signed_extensions.rs | 1 + .../src/reference_docs/trait_based_programming.rs | 7 +++++++ 5 files changed, 24 insertions(+), 16 deletions(-) diff --git a/docs/sdk/src/lib.rs b/docs/sdk/src/lib.rs index bda1d4a013a3..714aea51ca34 100644 --- a/docs/sdk/src/lib.rs +++ b/docs/sdk/src/lib.rs @@ -24,15 +24,14 @@ //! This section paints a picture over the high-level information architecture of this crate. #![doc = simple_mermaid::mermaid!("../../mermaid/IA.mmd")] -#![cfg(feature = "min-docs")] +#![deny(rustdoc::broken_intra_doc_links)] +#![deny(rustdoc::private_intra_doc_links)] +// Overide above deny if no deps are being built +#![cfg(not(feature = "build-deps"))] #![allow(rustdoc::broken_intra_doc_links)] #![allow(rustdoc::private_intra_doc_links)] -// #![cfg(feature = "build-deps")] -// #![deny(rustdoc::broken_intra_doc_links)] -// #![deny(rustdoc::private_intra_doc_links)] - /// Meta information about this crate, how it is built, what principles dictates its evolution and /// how one can contribute to it. pub mod meta_contributing; @@ -43,6 +42,6 @@ pub mod guides; /// An introduction to the Polkadot SDK. Read this module to learn about the structure of the SDK, /// the tools that are provided as a part of it, and to gain a high level understanding of each. pub mod polkadot_sdk; -// /// Reference documents covering in-depth topics across the Polkadot SDK. It is suggested to read -// /// these on-demand, while you are going through the [`guides`] or other content. -// pub mod reference_docs; +/// Reference documents covering in-depth topics across the Polkadot SDK. It is suggested to read +/// these on-demand, while you are going through the [`guides`] or other content. +pub mod reference_docs; diff --git a/docs/sdk/src/meta_contributing.rs b/docs/sdk/src/meta_contributing.rs index 253a0aae621c..8e1e22d42c77 100644 --- a/docs/sdk/src/meta_contributing.rs +++ b/docs/sdk/src/meta_contributing.rs @@ -137,15 +137,14 @@ //! To expedite documentation development and view _only_ the docs specific [`crate`] locally for development, including the correct HTML headers injected, run: //! //! ```sh -//! # (Fastest) Only build the documentation crate -//! SKIP_WASM_BUILD=1 RUSTDOCFLAGS="--html-in-header $(pwd)/docs/sdk/headers/toc.html" cargo doc -p polkadot-sdk-docs --no-deps --open -//! # (Full SDK) All documentation, no deps -//! SKIP_WASM_BUILD=1 RUSTDOCFLAGS="--html-in-header $(pwd)/docs/sdk/headers/toc.html" cargo doc -p polkadot-sdk-docs --no-deps --open -//! # (Full SDK) All documentation, with external deps +//! # (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 -//! ``` //! -//! If even faster build time for docs is needed, you can temporarily remove most of the -//! substrate/cumulus dependencies that are only used for linking purposes. +//! # All docs, with external deps +//! SKIP_WASM_BUILD=1 RUSTDOCFLAGS="--html-in-header $(pwd)/docs/sdk/headers/toc.html" cargo doc --open +//! ``` //! //! For more on local development, see [`crate::reference_docs::development_environment_advice`]. diff --git a/docs/sdk/src/reference_docs/extrinsic_encoding.rs b/docs/sdk/src/reference_docs/extrinsic_encoding.rs index 89c7cfe983c1..b3acc87030fd 100644 --- a/docs/sdk/src/reference_docs/extrinsic_encoding.rs +++ b/docs/sdk/src/reference_docs/extrinsic_encoding.rs @@ -189,6 +189,7 @@ //! as follows: #![doc = docify::embed!("./src/reference_docs/extrinsic_encoding.rs", encoding_example)] +#[cfg(feature = "build-deps")] #[docify::export] pub mod call_data { use parity_scale_codec::{Decode, Encode}; @@ -220,6 +221,7 @@ pub mod call_data { } } +#[cfg(feature = "build-deps")] #[docify::export] pub mod encoding_example { use super::call_data::{Call, PalletACall}; diff --git a/docs/sdk/src/reference_docs/signed_extensions.rs b/docs/sdk/src/reference_docs/signed_extensions.rs index 28b1426536bc..89048686f1c7 100644 --- a/docs/sdk/src/reference_docs/signed_extensions.rs +++ b/docs/sdk/src/reference_docs/signed_extensions.rs @@ -6,6 +6,7 @@ //! Defining a couple of very simple signed extensions looks like the following: #![doc = docify::embed!("./src/reference_docs/signed_extensions.rs", signed_extensions_example)] +#[cfg(feature = "build-deps")] #[docify::export] pub mod signed_extensions_example { use parity_scale_codec::{Decode, Encode}; diff --git a/docs/sdk/src/reference_docs/trait_based_programming.rs b/docs/sdk/src/reference_docs/trait_based_programming.rs index ace313880707..78d3dcc826d5 100644 --- a/docs/sdk/src/reference_docs/trait_based_programming.rs +++ b/docs/sdk/src/reference_docs/trait_based_programming.rs @@ -113,8 +113,10 @@ //! - #![allow(unused)] +#[cfg(feature = "build-deps")] use frame::traits::Get; +#[cfg(feature = "build-deps")] #[docify::export] mod basic { struct Pallet; @@ -130,6 +132,7 @@ mod basic { } } +#[cfg(feature = "build-deps")] #[docify::export] mod generic { use super::*; @@ -151,6 +154,7 @@ mod generic { } } +#[cfg(feature = "build-deps")] #[docify::export] mod trait_based { use super::*; @@ -170,6 +174,7 @@ mod trait_based { } } +#[cfg(feature = "build-deps")] #[docify::export] mod with_system { use super::*; @@ -192,6 +197,7 @@ mod with_system { } } +#[cfg(feature = "build-deps")] #[docify::export] mod fully_qualified { use super::with_system::*; @@ -200,6 +206,7 @@ mod fully_qualified { type AccountIdOf = ::AccountId; } +#[cfg(feature = "build-deps")] #[docify::export] mod fully_qualified_complicated { use super::with_system::*; From 643733a0a26a1103c51b04b61d0e79a16eb7f46d Mon Sep 17 00:00:00 2001 From: Nuke Date: Mon, 15 Jan 2024 16:11:59 -0700 Subject: [PATCH 4/6] working MVP of feature gate on minimal HTML only docs and full compiled docs --- docs/sdk/Cargo.toml | 4 ++-- docs/sdk/src/guides/your_first_pallet/mod.rs | 6 +++--- docs/sdk/src/meta_contributing.rs | 4 ++-- docs/sdk/src/polkadot_sdk/cumulus.rs | 1 - docs/sdk/src/reference_docs/extrinsic_encoding.rs | 4 ++-- docs/sdk/src/reference_docs/signed_extensions.rs | 2 +- .../src/reference_docs/trait_based_programming.rs | 14 +++++++------- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/docs/sdk/Cargo.toml b/docs/sdk/Cargo.toml index e3f8bea6b3c4..20414505210c 100644 --- a/docs/sdk/Cargo.toml +++ b/docs/sdk/Cargo.toml @@ -63,12 +63,12 @@ sp-keyring = { path = "../../substrate/primitives/keyring", optional = true } sp-runtime = { path = "../../substrate/primitives/runtime", optional = true } [features] -default = ["min-docs", "build-deps"] +default = ["min-docs", "docs-build-deps"] min-docs = [ "simple-mermaid", "docify", ] -build-deps = [ +docs-build-deps = [ "sp-io", "parity-scale-codec", "scale-info", diff --git a/docs/sdk/src/guides/your_first_pallet/mod.rs b/docs/sdk/src/guides/your_first_pallet/mod.rs index 9adddde45545..9fd5cfa05cd4 100644 --- a/docs/sdk/src/guides/your_first_pallet/mod.rs +++ b/docs/sdk/src/guides/your_first_pallet/mod.rs @@ -299,7 +299,7 @@ //! - Learn more about the individual pallet items/macros, such as event and errors and call, in //! [`frame::pallet_macros`]. -#[cfg(feature = "build-deps")] +#[cfg(feature = "docs-build-deps")] #[docify::export] #[frame::pallet(dev_mode)] pub mod shell_pallet { @@ -312,7 +312,7 @@ pub mod shell_pallet { pub struct Pallet(_); } -#[cfg(feature = "build-deps")] +#[cfg(feature = "docs-build-deps")] #[frame::pallet(dev_mode)] pub mod pallet { use frame::prelude::*; @@ -632,7 +632,7 @@ pub mod pallet { } } -#[cfg(feature = "build-deps")] +#[cfg(feature = "docs-build-deps")] #[frame::pallet(dev_mode)] pub mod pallet_v2 { use super::pallet::Balance; diff --git a/docs/sdk/src/meta_contributing.rs b/docs/sdk/src/meta_contributing.rs index 8e1e22d42c77..2e4df5f922cc 100644 --- a/docs/sdk/src/meta_contributing.rs +++ b/docs/sdk/src/meta_contributing.rs @@ -138,13 +138,13 @@ //! //! ```sh //! # (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 +//! 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 //! //! # All docs, with external deps -//! SKIP_WASM_BUILD=1 RUSTDOCFLAGS="--html-in-header $(pwd)/docs/sdk/headers/toc.html" cargo doc --open +//! SKIP_WASM_BUILD=1 RUSTDOCFLAGS="--html-in-header $(pwd)/docs/sdk/headers/toc.html" cargo doc --no-deps --open //! ``` //! //! For more on local development, see [`crate::reference_docs::development_environment_advice`]. diff --git a/docs/sdk/src/polkadot_sdk/cumulus.rs b/docs/sdk/src/polkadot_sdk/cumulus.rs index 07a48c92d807..b55640ee9451 100644 --- a/docs/sdk/src/polkadot_sdk/cumulus.rs +++ b/docs/sdk/src/polkadot_sdk/cumulus.rs @@ -42,7 +42,6 @@ //! //! [FRAME]: crate::polkadot_sdk::frame_runtime -#![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] #[cfg(test)] diff --git a/docs/sdk/src/reference_docs/extrinsic_encoding.rs b/docs/sdk/src/reference_docs/extrinsic_encoding.rs index b3acc87030fd..13700ba11d03 100644 --- a/docs/sdk/src/reference_docs/extrinsic_encoding.rs +++ b/docs/sdk/src/reference_docs/extrinsic_encoding.rs @@ -189,7 +189,7 @@ //! as follows: #![doc = docify::embed!("./src/reference_docs/extrinsic_encoding.rs", encoding_example)] -#[cfg(feature = "build-deps")] +#[cfg(feature = "docs-build-deps")] #[docify::export] pub mod call_data { use parity_scale_codec::{Decode, Encode}; @@ -221,7 +221,7 @@ pub mod call_data { } } -#[cfg(feature = "build-deps")] +#[cfg(feature = "docs-build-deps")] #[docify::export] pub mod encoding_example { use super::call_data::{Call, PalletACall}; diff --git a/docs/sdk/src/reference_docs/signed_extensions.rs b/docs/sdk/src/reference_docs/signed_extensions.rs index 89048686f1c7..9c13417e30e6 100644 --- a/docs/sdk/src/reference_docs/signed_extensions.rs +++ b/docs/sdk/src/reference_docs/signed_extensions.rs @@ -6,7 +6,7 @@ //! Defining a couple of very simple signed extensions looks like the following: #![doc = docify::embed!("./src/reference_docs/signed_extensions.rs", signed_extensions_example)] -#[cfg(feature = "build-deps")] +#[cfg(feature = "docs-build-deps")] #[docify::export] pub mod signed_extensions_example { use parity_scale_codec::{Decode, Encode}; diff --git a/docs/sdk/src/reference_docs/trait_based_programming.rs b/docs/sdk/src/reference_docs/trait_based_programming.rs index 78d3dcc826d5..61afc2fbd556 100644 --- a/docs/sdk/src/reference_docs/trait_based_programming.rs +++ b/docs/sdk/src/reference_docs/trait_based_programming.rs @@ -113,10 +113,10 @@ //! - #![allow(unused)] -#[cfg(feature = "build-deps")] +#[cfg(feature = "docs-build-deps")] use frame::traits::Get; -#[cfg(feature = "build-deps")] +#[cfg(feature = "docs-build-deps")] #[docify::export] mod basic { struct Pallet; @@ -132,7 +132,7 @@ mod basic { } } -#[cfg(feature = "build-deps")] +#[cfg(feature = "docs-build-deps")] #[docify::export] mod generic { use super::*; @@ -154,7 +154,7 @@ mod generic { } } -#[cfg(feature = "build-deps")] +#[cfg(feature = "docs-build-deps")] #[docify::export] mod trait_based { use super::*; @@ -174,7 +174,7 @@ mod trait_based { } } -#[cfg(feature = "build-deps")] +#[cfg(feature = "docs-build-deps")] #[docify::export] mod with_system { use super::*; @@ -197,7 +197,7 @@ mod with_system { } } -#[cfg(feature = "build-deps")] +#[cfg(feature = "docs-build-deps")] #[docify::export] mod fully_qualified { use super::with_system::*; @@ -206,7 +206,7 @@ mod fully_qualified { type AccountIdOf = ::AccountId; } -#[cfg(feature = "build-deps")] +#[cfg(feature = "docs-build-deps")] #[docify::export] mod fully_qualified_complicated { use super::with_system::*; From 94875f4c504b97c5654ecba4801eedc248a77bc8 Mon Sep 17 00:00:00 2001 From: Nuke Date: Mon, 15 Jan 2024 16:41:01 -0700 Subject: [PATCH 5/6] feature gate correct on lint --- docs/sdk/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/src/lib.rs b/docs/sdk/src/lib.rs index 714aea51ca34..a8ac60de498b 100644 --- a/docs/sdk/src/lib.rs +++ b/docs/sdk/src/lib.rs @@ -27,7 +27,7 @@ #![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] // Overide above deny if no deps are being built -#![cfg(not(feature = "build-deps"))] +#![cfg(not(feature = "docs-build-deps"))] #![allow(rustdoc::broken_intra_doc_links)] #![allow(rustdoc::private_intra_doc_links)] From acfabc81872e8158d8580a8d5c2fdde3c73ca335 Mon Sep 17 00:00:00 2001 From: Nuke Date: Mon, 15 Jan 2024 16:43:16 -0700 Subject: [PATCH 6/6] fmt --- docs/sdk/src/lib.rs | 2 -- docs/sdk/src/meta_contributing.rs | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/sdk/src/lib.rs b/docs/sdk/src/lib.rs index a8ac60de498b..44b720acdaaf 100644 --- a/docs/sdk/src/lib.rs +++ b/docs/sdk/src/lib.rs @@ -23,7 +23,6 @@ //! //! This section paints a picture over the high-level information architecture of this crate. #![doc = simple_mermaid::mermaid!("../../mermaid/IA.mmd")] - #![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] // Overide above deny if no deps are being built @@ -31,7 +30,6 @@ #![allow(rustdoc::broken_intra_doc_links)] #![allow(rustdoc::private_intra_doc_links)] - /// Meta information about this crate, how it is built, what principles dictates its evolution and /// how one can contribute to it. pub mod meta_contributing; diff --git a/docs/sdk/src/meta_contributing.rs b/docs/sdk/src/meta_contributing.rs index 2e4df5f922cc..4511eb06dd02 100644 --- a/docs/sdk/src/meta_contributing.rs +++ b/docs/sdk/src/meta_contributing.rs @@ -134,13 +134,14 @@ //! //! ## How to Develop Locally //! -//! To expedite documentation development and view _only_ the docs specific [`crate`] locally for development, including the correct HTML headers injected, run: +//! To expedite documentation development and view _only_ the docs specific [`crate`] locally for +//! development, including the correct HTML headers injected, run: //! //! ```sh //! # (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. +//! # 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 //! //! # All docs, with external deps