about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-07-14 20:29:54 -0700
committerGitHub <noreply@github.com>2016-07-14 20:29:54 -0700
commitb6c1ef3745f707a0f76f17dc2b313b831ee1bfb0 (patch)
tree11ce8f022b6ba6c9e32c49895b28186331ad816b
parent3e15fcc55e028bf10aa60cb849f3aca4f2ead20c (diff)
parent3c0c663b0e0b66b61471aac34894a3fb78aa10fa (diff)
downloadrust-b6c1ef3745f707a0f76f17dc2b313b831ee1bfb0.tar.gz
rust-b6c1ef3745f707a0f76f17dc2b313b831ee1bfb0.zip
Auto merge of #34801 - TimNN:rustbuild-doc-fixes, r=alexcrichton
rustbuild: doc fixes

This fixes two issues rustbuild currently has when building documentation:

1. It fixes standalone builds of `doc-test` and `doc-rustc`.
2. It actually builds the compiler docs if requested in the config.

Closes #34275.
-rw-r--r--src/bootstrap/doc.rs4
-rw-r--r--src/bootstrap/step.rs16
2 files changed, 15 insertions, 5 deletions
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
index ac90ab54737..c2636384dbb 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -155,6 +155,7 @@ pub fn std(build: &Build, stage: u32, target: &str, out: &Path) {
 /// is largely just a wrapper around `cargo doc`.
 pub fn test(build: &Build, stage: u32, target: &str, out: &Path) {
     println!("Documenting stage{} test ({})", stage, target);
+    t!(fs::create_dir_all(out));
     let compiler = Compiler::new(stage, &build.config.build);
     let out_dir = build.stage_out(&compiler, Mode::Libtest)
                        .join(target).join("doc");
@@ -175,11 +176,12 @@ pub fn test(build: &Build, stage: u32, target: &str, out: &Path) {
 /// dependencies. This is largely just a wrapper around `cargo doc`.
 pub fn rustc(build: &Build, stage: u32, target: &str, out: &Path) {
     println!("Documenting stage{} compiler ({})", stage, target);
+    t!(fs::create_dir_all(out));
     let compiler = Compiler::new(stage, &build.config.build);
     let out_dir = build.stage_out(&compiler, Mode::Librustc)
                        .join(target).join("doc");
     let rustdoc = build.rustdoc(&compiler);
-    if !up_to_date(&rustdoc, &out_dir.join("rustc/index.html")) {
+    if !up_to_date(&rustdoc, &out_dir.join("rustc/index.html")) && out_dir.exists() {
         t!(fs::remove_dir_all(&out_dir));
     }
     let mut cargo = build.cargo(&compiler, Mode::Librustc, target, "doc");
diff --git a/src/bootstrap/step.rs b/src/bootstrap/step.rs
index 4b3be04b57c..82ae70d22ca 100644
--- a/src/bootstrap/step.rs
+++ b/src/bootstrap/step.rs
@@ -380,10 +380,18 @@ impl<'a> Step<'a> {
                 vec![self.doc_test(stage)]
             }
             Source::Doc { stage } => {
-                vec![self.doc_book(stage), self.doc_nomicon(stage),
-                     self.doc_style(stage), self.doc_standalone(stage),
-                     self.doc_std(stage),
-                     self.doc_error_index(stage)]
+                let mut deps = vec![
+                    self.doc_book(stage), self.doc_nomicon(stage),
+                    self.doc_style(stage), self.doc_standalone(stage),
+                    self.doc_std(stage),
+                    self.doc_error_index(stage),
+                ];
+
+                if build.config.compiler_docs {
+                    deps.push(self.doc_rustc(stage));
+                }
+
+                deps
             }
             Source::Check { stage, compiler } => {
                 // Check is just a pseudo step which means check all targets,