From cab0d2afaf8a2a5faa2d190333b1cc623c4ff3a3 Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Thu, 3 Oct 2024 12:47:09 +0200 Subject: [PATCH 1/4] docs(iroh): Enable iroh_docsrs feature This uses the same iroh_docsrs cfg as the other crates and updates the preview CI job to also use this. Now we get the features documented everywhere and get to see it in the preview. --- .github/workflows/docs.yaml | 2 +- iroh/Cargo.toml | 4 +--- iroh/src/lib.rs | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 403731b4ca..c83ea28f38 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -39,7 +39,7 @@ jobs: - name: Generate Docs run: cargo doc --workspace --all-features --no-deps env: - RUSTDOCFLAGS: --cfg docsrs + RUSTDOCFLAGS: --cfg iroh_docsrs - name: Deploy Docs to Preview Branch uses: peaceiris/actions-gh-pages@v4 diff --git a/iroh/Cargo.toml b/iroh/Cargo.toml index 6ef27b308e..b87689545e 100644 --- a/iroh/Cargo.toml +++ b/iroh/Cargo.toml @@ -87,9 +87,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] } [package.metadata.docs.rs] all-features = true -# enable unstable features in the documentation -rustdoc-args = ["--cfg", "docsrs"] - +rustdoc-args = ["--cfg", "iroh_docsrs"] [[example]] name = "hello-world-provide" diff --git a/iroh/src/lib.rs b/iroh/src/lib.rs index 72957bc66b..44283db692 100644 --- a/iroh/src/lib.rs +++ b/iroh/src/lib.rs @@ -88,7 +88,7 @@ //! - `metrics`: Enable metrics collection. Enabled by default. //! - `fs-store`: Enables the disk based storage backend for `iroh-blobs`. Enabled by default. //! -#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(iroh_docsrs, feature(doc_cfg))] #![deny(missing_docs, rustdoc::broken_intra_doc_links)] // re-export the iroh crates @@ -111,5 +111,5 @@ mod rpc_protocol; /// Expose metrics module #[cfg(feature = "metrics")] -#[cfg_attr(all(docsrs, feature = "metrics"), doc(cfg(feature = "metrics")))] +#[cfg_attr(all(iroh_docsrs, feature = "metrics"), doc(cfg(feature = "metrics")))] pub mod metrics; From 065ba591e32632d656fdf122f6e8b483ea1c5b8e Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Fri, 4 Oct 2024 16:34:38 +0200 Subject: [PATCH 2/4] Some missing bits --- iroh/src/lib.rs | 2 +- iroh/src/node/builder.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/iroh/src/lib.rs b/iroh/src/lib.rs index 44283db692..90f372c3ba 100644 --- a/iroh/src/lib.rs +++ b/iroh/src/lib.rs @@ -111,5 +111,5 @@ mod rpc_protocol; /// Expose metrics module #[cfg(feature = "metrics")] -#[cfg_attr(all(iroh_docsrs, feature = "metrics"), doc(cfg(feature = "metrics")))] +#[cfg_attr(iroh_docsrs, doc(cfg(feature = "metrics")))] pub mod metrics; diff --git a/iroh/src/node/builder.rs b/iroh/src/node/builder.rs index 4bf07e3346..3641a6b138 100644 --- a/iroh/src/node/builder.rs +++ b/iroh/src/node/builder.rs @@ -121,6 +121,7 @@ where node_discovery: DiscoveryConfig, docs_storage: DocsStorage, #[cfg(any(test, feature = "test-utils"))] + #[cfg_attr(iroh_docsrs, doc(cfg(any(test, feature = "test-utils"))))] insecure_skip_relay_cert_verify: bool, /// Callback to register when a gc loop is done #[debug("callback")] @@ -509,6 +510,7 @@ where /// /// May only be used in tests. #[cfg(any(test, feature = "test-utils"))] + #[cfg_attr(iroh_docsrs, doc(cfg(any(test, feature = "test-utils"))))] pub fn insecure_skip_relay_cert_verify(mut self, skip_verify: bool) -> Self { self.insecure_skip_relay_cert_verify = skip_verify; self @@ -516,6 +518,7 @@ where /// Register a callback for when GC is done. #[cfg(any(test, feature = "test-utils"))] + #[cfg_attr(iroh_docsrs, doc(cfg(any(test, feature = "test-utils"))))] pub fn register_gc_done_cb(mut self, cb: Box) -> Self { self.gc_done_callback.replace(cb); self From 0418a21ed6e21b22a846b0ac758cbbb5aa53e04e Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Fri, 4 Oct 2024 16:40:19 +0200 Subject: [PATCH 3/4] just provide this flag wherever we can --- .github/workflows/docs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index c83ea28f38..d69d7fc831 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -40,6 +40,7 @@ jobs: run: cargo doc --workspace --all-features --no-deps env: RUSTDOCFLAGS: --cfg iroh_docsrs + RUSTFLAGS: --cfg iroh_docsrs - name: Deploy Docs to Preview Branch uses: peaceiris/actions-gh-pages@v4 From 8a2677d4bc1b775c183ea6a18c628b329ebdfa23 Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Fri, 4 Oct 2024 16:50:04 +0200 Subject: [PATCH 4/4] reverse this --- .github/workflows/docs.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index d69d7fc831..c83ea28f38 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -40,7 +40,6 @@ jobs: run: cargo doc --workspace --all-features --no-deps env: RUSTDOCFLAGS: --cfg iroh_docsrs - RUSTFLAGS: --cfg iroh_docsrs - name: Deploy Docs to Preview Branch uses: peaceiris/actions-gh-pages@v4