-
-
Notifications
You must be signed in to change notification settings - Fork 140
/
doc.rs
43 lines (35 loc) · 1.06 KB
/
doc.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use clap::Args;
use crate::{cmd, Result};
#[derive(Args)]
#[allow(deprecated)]
pub struct DocTask {
/// Open the browser when the docs are built.
#[clap(long)]
pub open: bool,
/// Fail on warnings.
#[clap(long)]
pub deny_warnings: bool,
}
impl DocTask {
pub(crate) fn run(self) -> Result<()> {
let mut rustdocflags = "--enable-index-page -Zunstable-options --cfg docsrs".to_owned();
if self.deny_warnings {
rustdocflags += " -Dwarnings";
}
// Keep in sync with .github/workflows/docs.yml
let mut cmd = cmd!(
"
rustup run nightly cargo doc --all-features --no-deps --workspace
--exclude ruma-macros --exclude ruma-identifiers-validation --exclude xtask
"
)
// Work around https://github.com/rust-lang/cargo/issues/10744
.env("CARGO_TARGET_APPLIES_TO_HOST", "true")
.env("RUSTDOCFLAGS", rustdocflags);
if self.open {
cmd = cmd.arg("--open");
}
cmd.run()?;
Ok(())
}
}