Add missing generation for test and proc_macro, remove old macro redirection
This commit is contained in:
parent
65440a3f4f
commit
397eb4f237
3 changed files with 23 additions and 17 deletions
|
@ -16,6 +16,7 @@ fn main() {
|
||||||
let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set");
|
let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set");
|
||||||
let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
|
let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
|
||||||
let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
|
let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
|
||||||
|
let mut has_unstable = false;
|
||||||
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
@ -54,9 +55,22 @@ fn main() {
|
||||||
// it up so we can make rustdoc print this into the docs
|
// it up so we can make rustdoc print this into the docs
|
||||||
if let Some(version) = env::var_os("RUSTDOC_CRATE_VERSION") {
|
if let Some(version) = env::var_os("RUSTDOC_CRATE_VERSION") {
|
||||||
// This "unstable-options" can be removed when `--crate-version` is stabilized
|
// This "unstable-options" can be removed when `--crate-version` is stabilized
|
||||||
cmd.arg("-Z")
|
if !has_unstable {
|
||||||
.arg("unstable-options")
|
cmd.arg("-Z")
|
||||||
.arg("--crate-version").arg(version);
|
.arg("unstable-options");
|
||||||
|
}
|
||||||
|
cmd.arg("--crate-version").arg(version);
|
||||||
|
has_unstable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Needed to be able to run all rustdoc tests.
|
||||||
|
if let Some(_) = env::var_os("RUSTDOC_GENERATE_REDIRECT_PAGES") {
|
||||||
|
// This "unstable-options" can be removed when `--generate-redirect-pages` is stabilized
|
||||||
|
if !has_unstable {
|
||||||
|
cmd.arg("-Z")
|
||||||
|
.arg("unstable-options");
|
||||||
|
}
|
||||||
|
cmd.arg("--generate-redirect-pages");
|
||||||
}
|
}
|
||||||
|
|
||||||
if verbose > 1 {
|
if verbose > 1 {
|
||||||
|
|
|
@ -317,8 +317,7 @@ fn invoke_rustdoc(builder: &Builder, compiler: Compiler, target: Interned<String
|
||||||
.arg("-o").arg(&out)
|
.arg("-o").arg(&out)
|
||||||
.arg(&path)
|
.arg(&path)
|
||||||
.arg("--markdown-css")
|
.arg("--markdown-css")
|
||||||
.arg("../rust.css")
|
.arg("../rust.css");
|
||||||
.arg("--generate-redirect-pages");
|
|
||||||
|
|
||||||
builder.run(&mut cmd);
|
builder.run(&mut cmd);
|
||||||
}
|
}
|
||||||
|
@ -557,7 +556,9 @@ impl Step for Test {
|
||||||
let mut cargo = builder.cargo(compiler, Mode::Test, target, "doc");
|
let mut cargo = builder.cargo(compiler, Mode::Test, target, "doc");
|
||||||
compile::test_cargo(builder, &compiler, target, &mut cargo);
|
compile::test_cargo(builder, &compiler, target, &mut cargo);
|
||||||
|
|
||||||
cargo.arg("--no-deps").arg("-p").arg("test");
|
cargo.arg("--no-deps")
|
||||||
|
.arg("-p").arg("test")
|
||||||
|
.env("RUSTDOC_GENERATE_REDIRECT_PAGES", "1");
|
||||||
|
|
||||||
builder.run(&mut cargo);
|
builder.run(&mut cargo);
|
||||||
builder.cp_r(&my_out, &out);
|
builder.cp_r(&my_out, &out);
|
||||||
|
@ -626,9 +627,9 @@ impl Step for WhitelistedRustc {
|
||||||
// We don't want to build docs for internal compiler dependencies in this
|
// We don't want to build docs for internal compiler dependencies in this
|
||||||
// step (there is another step for that). Therefore, we whitelist the crates
|
// step (there is another step for that). Therefore, we whitelist the crates
|
||||||
// for which docs must be built.
|
// for which docs must be built.
|
||||||
cargo.arg("--no-deps");
|
|
||||||
for krate in &["proc_macro"] {
|
for krate in &["proc_macro"] {
|
||||||
cargo.arg("-p").arg(krate);
|
cargo.arg("-p").arg(krate)
|
||||||
|
.env("RUSTDOC_GENERATE_REDIRECT_PAGES", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.run(&mut cargo);
|
builder.run(&mut cargo);
|
||||||
|
|
|
@ -2244,15 +2244,6 @@ impl Context {
|
||||||
let mut redirect_out = BufWriter::new(redirect_out);
|
let mut redirect_out = BufWriter::new(redirect_out);
|
||||||
try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst);
|
try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst);
|
||||||
}
|
}
|
||||||
// If the item is a macro, redirect from the old macro URL (with !)
|
|
||||||
// to the new one (without).
|
|
||||||
if item_type == ItemType::Macro {
|
|
||||||
let redir_name = format!("{}.{}!.html", item_type, name);
|
|
||||||
let redir_dst = self.dst.join(redir_name);
|
|
||||||
let redirect_out = try_err!(File::create(&redir_dst), &redir_dst);
|
|
||||||
let mut redirect_out = BufWriter::new(redirect_out);
|
|
||||||
try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue