mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 06:51:01 +01:00
Change process of building docs
- introduce `docs` alias that does the right thing (tm) - use `-Zrustdoc-scrape-examples`
This commit is contained in:
parent
8556256e89
commit
dde40e613f
4 changed files with 22 additions and 5 deletions
13
.cargo/config.toml
Normal file
13
.cargo/config.toml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[alias]
|
||||||
|
# Using `--features=full --features=nightly` instead of `--all-features` because of
|
||||||
|
# https://github.com/rust-lang/cargo/issues/10333
|
||||||
|
#
|
||||||
|
# "tokio/macros" and "tokio/rt-multi-thread" are required for examples
|
||||||
|
docs = """doc
|
||||||
|
-Zrustdoc-scrape-examples=examples
|
||||||
|
--features=full --features=nightly
|
||||||
|
--features=tokio/macros --features=tokio/rt-multi-thread
|
||||||
|
"""
|
||||||
|
|
||||||
|
# We pass "--cfg docsrs" when building docs to add `This is supported on feature="..." only.`
|
||||||
|
rustdocflags = ["--cfg", "docsrs", "-Znormalize-docs"]
|
|
@ -80,12 +80,16 @@ cache_me = []
|
||||||
# AutoSend bot adaptor
|
# AutoSend bot adaptor
|
||||||
auto_send = []
|
auto_send = []
|
||||||
|
|
||||||
|
# All features except nightly and tls-related
|
||||||
full = ["throttle", "trace_adaptor", "erased", "cache_me", "auto_send"]
|
full = ["throttle", "trace_adaptor", "erased", "cache_me", "auto_send"]
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
features = ["full", "nightly", "tokio/macros", "tokio/rt-multi-thread"]
|
||||||
rustdoc-args = ["--cfg", "docsrs", "-Znormalize-docs"]
|
rustdoc-args = ["--cfg", "docsrs", "-Znormalize-docs"]
|
||||||
|
|
||||||
|
# https://github.com/rust-lang/rust/issues/88791
|
||||||
|
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples=examples"]
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "self_info"
|
name = "self_info"
|
||||||
required-features = ["tokio/macros", "tokio/rt-multi-thread", "auto_send"]
|
required-features = ["tokio/macros", "tokio/rt-multi-thread", "auto_send"]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[build]
|
[build]
|
||||||
command = "rustup install nightly --profile minimal && cargo +nightly doc --all-features --no-deps && cp -r target/doc _netlify_out"
|
command = "rustup install nightly --profile minimal && cargo +nightly docs --no-deps && cp -r target/doc _netlify_out"
|
||||||
environment = { RUSTDOCFLAGS= "--cfg docsrs -Znormalize-docs" }
|
|
||||||
publish = "_netlify_out"
|
publish = "_netlify_out"
|
||||||
|
|
||||||
[[redirects]]
|
[[redirects]]
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
//! - `erased` — enables [`ErasedRequester`] bot adaptor
|
//! - `erased` — enables [`ErasedRequester`] bot adaptor
|
||||||
//! - `throttle` — enables [`Throttle`] bot adaptor
|
//! - `throttle` — enables [`Throttle`] bot adaptor
|
||||||
//! - `cache_me` — enables [`CacheMe`] bot adaptor
|
//! - `cache_me` — enables [`CacheMe`] bot adaptor
|
||||||
//! - `full` — enables all features except `nigthly`
|
//! - `full` — enables all features except `nigthly` and tls-related
|
||||||
//! - `nightly` — enables nigthly-only features, currently:
|
//! - `nightly` — enables nigthly-only features, currently:
|
||||||
//! - Removes some future boxing using `#![feature(type_alias_impl_trait)]`
|
//! - Removes some future boxing using `#![feature(type_alias_impl_trait)]`
|
||||||
//! - Used to built docs (`#![feature(doc_cfg, doc_notable_trait)]`)
|
//! - Used to built docs (`#![feature(doc_cfg, doc_notable_trait)]`)
|
||||||
|
@ -74,8 +74,9 @@
|
||||||
//
|
//
|
||||||
// To properly build docs of this crate run
|
// To properly build docs of this crate run
|
||||||
// ```console
|
// ```console
|
||||||
// $ RUSTDOCFLAGS="--cfg docsrs -Znormalize-docs" cargo doc --open --all-features
|
// $ cargo docs
|
||||||
// ```
|
// ```
|
||||||
|
// (docs alias is defined in `.cargo/config.toml`)
|
||||||
//
|
//
|
||||||
// `dep_docsrs` is used for the same purpose, but when `teloxide-core` is built as a dependency
|
// `dep_docsrs` is used for the same purpose, but when `teloxide-core` is built as a dependency
|
||||||
// (see: `teloxide`). We can't use `docsrs` as it breaks tokio compilation in this case.
|
// (see: `teloxide`). We can't use `docsrs` as it breaks tokio compilation in this case.
|
||||||
|
|
Loading…
Reference in a new issue