Rollup merge of #56441 - ollie27:rustbuild_compiler_docs, r=alexcrichton

rustbuild: Fix issues with compiler docs

* Create output directories for crates beforehand so rustdoc uses relative links (fixes #56107)
* Readd rustc_codegen_ssa (fixes #56196)
* Don't build out of tree dependencies for rustdoc like we don't for rustc
This commit is contained in:
Pietro Albini 2018-12-06 07:48:55 +01:00 committed by GitHub
commit 0be8537e23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -697,9 +697,6 @@ fn run(self, builder: &Builder) {
return;
}
// Build libstd docs so that we generate relative links.
builder.ensure(Std { stage, target });
// Build rustc.
builder.ensure(compile::Rustc { compiler, target });
@ -718,12 +715,16 @@ fn run(self, builder: &Builder) {
// Find dependencies for top level crates.
let mut compiler_crates = HashSet::new();
for root_crate in &["rustc", "rustc_driver", "rustc_codegen_llvm"] {
for root_crate in &["rustc_driver", "rustc_codegen_llvm", "rustc_codegen_ssa"] {
let interned_root_crate = INTERNER.intern_str(root_crate);
find_compiler_crates(builder, &interned_root_crate, &mut compiler_crates);
}
for krate in &compiler_crates {
// Create all crate output directories first to make sure rustdoc uses
// relative links.
// FIXME: Cargo should probably do this itself.
t!(fs::create_dir_all(out_dir.join(krate)));
cargo.arg("-p").arg(krate);
}
@ -797,8 +798,8 @@ fn run(self, builder: &Builder) {
return;
}
// Build libstd docs so that we generate relative links.
builder.ensure(Std { stage, target });
// Build rustc docs so that we generate relative links.
builder.ensure(Rustc { stage, target });
// Build rustdoc.
builder.ensure(tool::Rustdoc { host: compiler.host });
@ -822,6 +823,10 @@ fn run(self, builder: &Builder) {
&[]
);
// Only include compiler crates, no dependencies of those, such as `libc`.
cargo.arg("--no-deps");
cargo.arg("-p").arg("rustdoc");
cargo.env("RUSTDOCFLAGS", "--document-private-items");
builder.run(&mut cargo);
}