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

Allow configuring rustdoc --disable-minification in config.toml #83059

Merged
merged 2 commits into from
Mar 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ changelog-seen = 2
# documentation.
#docs = true

# Flag to specify whether CSS, JavaScript, and HTML are minified when
# docs are generated. JSON is always minified, because it's enormous,
# and generated in already-minified form from the beginning.
#docs-minification = true

# Indicate whether the compiler should be documented in addition to the standard
# library and facade crates.
#compiler-docs = false
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub struct Config {
pub submodules: bool,
pub fast_submodules: bool,
pub compiler_docs: bool,
pub docs_minification: bool,
pub docs: bool,
pub locked_deps: bool,
pub vendor: bool,
Expand Down Expand Up @@ -362,6 +363,7 @@ struct Build {
rustfmt: Option<PathBuf>,
docs: Option<bool>,
compiler_docs: Option<bool>,
docs_minification: Option<bool>,
submodules: Option<bool>,
fast_submodules: Option<bool>,
gdb: Option<String>,
Expand Down Expand Up @@ -663,6 +665,7 @@ impl Config {
config.python = build.python.map(PathBuf::from);
set(&mut config.low_priority, build.low_priority);
set(&mut config.compiler_docs, build.compiler_docs);
set(&mut config.docs_minification, build.docs_minification);
notriddle marked this conversation as resolved.
Show resolved Hide resolved
set(&mut config.docs, build.docs);
set(&mut config.submodules, build.submodules);
set(&mut config.fast_submodules, build.fast_submodules);
Expand Down
12 changes: 12 additions & 0 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ fn invoke_rustdoc(
.arg("--markdown-css")
.arg("../rust.css");

if !builder.config.docs_minification {
cmd.arg("-Z").arg("unstable-options").arg("--disable-minification");
}

builder.run(&mut cmd);
}

Expand Down Expand Up @@ -365,6 +369,10 @@ impl Step for Standalone {
.arg(&out)
.arg(&path);

if !builder.config.docs_minification {
cmd.arg("--disable-minification");
}

if filename == "not_found.md" {
cmd.arg("--markdown-css").arg("https://doc.rust-lang.org/rust.css");
} else {
Expand Down Expand Up @@ -437,6 +445,10 @@ impl Step for Std {
.arg("--index-page")
.arg(&builder.src.join("src/doc/index.md"));

if !builder.config.docs_minification {
cargo.arg("--disable-minification");
}

builder.run(&mut cargo.into());
};
// Only build the following crates. While we could just iterate over the
Expand Down