Skip to content

Commit

Permalink
rustbuild: Fix issues with compiler docs
Browse files Browse the repository at this point in the history
* Create output directories for crates beforehand so rustdoc uses relative links
* Readd rustc_codegen_ssa
* Don't build out of tree dependencies for rustdoc like we don't for rustc
  • Loading branch information
ollie27 committed Dec 2, 2018
1 parent 0c1dc62 commit 3b705a0
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,6 @@ impl Step for Rustc {
return;
}

// Build libstd docs so that we generate relative links.
builder.ensure(Std { stage, target });

// Build rustc.
builder.ensure(compile::Rustc { compiler, target });

Expand All @@ -717,12 +714,16 @@ impl Step for Rustc {

// 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);
}

Expand Down Expand Up @@ -796,8 +797,8 @@ impl Step for Rustdoc {
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 });
Expand All @@ -821,6 +822,10 @@ impl Step for Rustdoc {
&[]
);

// 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);
}
Expand Down

0 comments on commit 3b705a0

Please sign in to comment.