rustbuild: Fix compiler docs
* Make sure std docs are generated before compiler docs so rustdoc uses relative links. * Don't document the rustc and rustdoc binary crates as they overwrite the real rustc and rustdoc crates.
This commit is contained in:
parent
5d0be0d72a
commit
7b04f7fa63
@ -168,9 +168,7 @@ pub fn std(build: &Build, stage: u32, target: &str) {
|
|||||||
// We don't want to build docs for internal std dependencies unless
|
// We don't want to build docs for internal std dependencies unless
|
||||||
// in compiler-docs mode. When not in that mode, we whitelist the crates
|
// in compiler-docs mode. When not in that mode, we whitelist the crates
|
||||||
// for which docs must be built.
|
// for which docs must be built.
|
||||||
if build.config.compiler_docs {
|
if !build.config.compiler_docs {
|
||||||
cargo.arg("-p").arg("std");
|
|
||||||
} else {
|
|
||||||
cargo.arg("--no-deps");
|
cargo.arg("--no-deps");
|
||||||
for krate in &["alloc", "collections", "core", "std", "std_unicode"] {
|
for krate in &["alloc", "collections", "core", "std", "std_unicode"] {
|
||||||
cargo.arg("-p").arg(krate);
|
cargo.arg("-p").arg(krate);
|
||||||
@ -244,9 +242,15 @@ pub fn rustc(build: &Build, stage: u32, target: &str) {
|
|||||||
.arg(build.src.join("src/rustc/Cargo.toml"))
|
.arg(build.src.join("src/rustc/Cargo.toml"))
|
||||||
.arg("--features").arg(build.rustc_features());
|
.arg("--features").arg(build.rustc_features());
|
||||||
|
|
||||||
// Like with libstd above if compiler docs aren't enabled then we're not
|
if build.config.compiler_docs {
|
||||||
// documenting internal dependencies, so we have a whitelist.
|
// src/rustc/Cargo.toml contains bin crates called rustc and rustdoc
|
||||||
if !build.config.compiler_docs {
|
// which would otherwise overwrite the docs for the real rustc and
|
||||||
|
// rustdoc lib crates.
|
||||||
|
cargo.arg("-p").arg("rustc_driver")
|
||||||
|
.arg("-p").arg("rustdoc");
|
||||||
|
} else {
|
||||||
|
// Like with libstd above if compiler docs aren't enabled then we're not
|
||||||
|
// documenting internal dependencies, so we have a whitelist.
|
||||||
cargo.arg("--no-deps");
|
cargo.arg("--no-deps");
|
||||||
for krate in &["proc_macro"] {
|
for krate in &["proc_macro"] {
|
||||||
cargo.arg("-p").arg(krate);
|
cargo.arg("-p").arg(krate);
|
||||||
|
@ -633,12 +633,16 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||||||
for (krate, path, default) in krates("test") {
|
for (krate, path, default) in krates("test") {
|
||||||
rules.doc(&krate.doc_step, path)
|
rules.doc(&krate.doc_step, path)
|
||||||
.dep(|s| s.name("libtest-link"))
|
.dep(|s| s.name("libtest-link"))
|
||||||
|
// Needed so rustdoc generates relative links to std.
|
||||||
|
.dep(|s| s.name("doc-crate-std"))
|
||||||
.default(default && build.config.compiler_docs)
|
.default(default && build.config.compiler_docs)
|
||||||
.run(move |s| doc::test(build, s.stage, s.target));
|
.run(move |s| doc::test(build, s.stage, s.target));
|
||||||
}
|
}
|
||||||
for (krate, path, default) in krates("rustc-main") {
|
for (krate, path, default) in krates("rustc-main") {
|
||||||
rules.doc(&krate.doc_step, path)
|
rules.doc(&krate.doc_step, path)
|
||||||
.dep(|s| s.name("librustc-link"))
|
.dep(|s| s.name("librustc-link"))
|
||||||
|
// Needed so rustdoc generates relative links to std.
|
||||||
|
.dep(|s| s.name("doc-crate-std"))
|
||||||
.host(true)
|
.host(true)
|
||||||
.default(default && build.config.docs)
|
.default(default && build.config.docs)
|
||||||
.run(move |s| doc::rustc(build, s.stage, s.target));
|
.run(move |s| doc::rustc(build, s.stage, s.target));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user