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

fix: generate docs for all features on docs.rs #767

Merged
merged 3 commits into from May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 16 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -48,8 +48,22 @@ jobs:
command: clippy
args: --all-targets

- name: Check rustdoc links
run: RUSTDOCFLAGS="--deny broken_intra_doc_links" cargo doc --verbose --workspace --no-deps --document-private-items
check-docs:
name: Check rustdoc
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3

- name: Install Rust nightly toolchain
uses: actions-rs/toolchain@v1.0.7
with:
profile: minimal
toolchain: nightly
override: true

- name: Check rustdoc
run: RUSTDOCFLAGS="--cfg docsrs --deny rustdoc::broken_intra_doc_links" cargo doc --verbose --workspace --no-deps --document-private-items --all-features

check-code:
name: Check
Expand Down
7 changes: 7 additions & 0 deletions client/http-client/Cargo.toml
Expand Up @@ -29,3 +29,10 @@ tokio = { version = "1.16", features = ["net", "rt-multi-thread", "macros"] }
[features]
default = ["tls"]
tls = ["hyper-rustls/webpki-tokio"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does this do?

Copy link
Member Author

Choose a reason for hiding this comment

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

By default docs.rs only builds the docs with default-features so we want all features to be documented.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah thanks, and the --cfg docsrs bit is about making it possible to conditionally compile stuff for doc purposes I gather!

Copy link
Member Author

@niklasad1 niklasad1 May 13, 2022

Choose a reason for hiding this comment

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

should be equivalent to RUSTDOCFLAGS="--cfg docrs" cargo doc


[package.metadata.playground]
all-features = true
7 changes: 7 additions & 0 deletions client/transport/Cargo.toml
Expand Up @@ -54,3 +54,10 @@ web = [
"anyhow",
"thiserror",
]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.playground]
all-features = true
1 change: 1 addition & 0 deletions client/transport/src/lib.rs
Expand Up @@ -25,6 +25,7 @@
// DEALINGS IN THE SOFTWARE.

#![warn(missing_debug_implementations, missing_docs, unreachable_pub)]
#![cfg_attr(docsrs, feature(doc_cfg))]

//! # jsonrpsee-client-transports
//!
Expand Down
7 changes: 7 additions & 0 deletions client/ws-client/Cargo.toml
Expand Up @@ -23,3 +23,10 @@ serde_json = "1"
[features]
tls = ["jsonrpsee-client-transport/tls"]
default = ["tls"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.playground]
all-features = true
7 changes: 7 additions & 0 deletions core/Cargo.toml
Expand Up @@ -68,3 +68,10 @@ async-wasm-client = [
serde_json = "1.0"
tokio = { version = "1.16", features = ["macros", "rt"] }
jsonrpsee = { path = "../jsonrpsee", features = ["server", "macros"] }

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.playground]
all-features = true
1 change: 1 addition & 0 deletions core/src/lib.rs
Expand Up @@ -27,6 +27,7 @@
//! Shared utilities for `jsonrpsee`.

#![warn(missing_docs, missing_debug_implementations, unreachable_pub)]
#![cfg_attr(docsrs, feature(doc_cfg))]

// Macros useful internally within this crate, but not to be exposed outside of it.
#[macro_use]
Expand Down
7 changes: 7 additions & 0 deletions jsonrpsee/Cargo.toml
Expand Up @@ -37,3 +37,10 @@ macros = ["jsonrpsee-proc-macros", "jsonrpsee-types", "jsonrpsee-core/client", "
client = ["http-client", "ws-client", "wasm-client"]
server = ["http-server", "ws-server"]
full = ["client", "server", "macros", "async-client", "client-ws-transport"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.playground]
all-features = true
2 changes: 2 additions & 0 deletions jsonrpsee/src/lib.rs
Expand Up @@ -48,6 +48,8 @@
//! - **`client-ws-transport`** - Enables `ws` transport with TLS.
//! - **`client-ws-transport-no-tls`** - Enables `ws` transport without TLS.

#![cfg_attr(docsrs, feature(doc_cfg))]

// Macros useful below, but not to be exposed outside of the crate.
#[macro_use]
mod macros;
Expand Down