]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/doc.rs
Move rule configs out of step
[rust.git] / src / bootstrap / doc.rs
index 23a38f6a8969395faeaa9bf7b3a3e2fc3520025a..432fdb6a3cb8c682de94af2a92c75cb109ced0c1 100644 (file)
 use util::{cp_r, symlink_dir};
 use build_helper::up_to_date;
 
+// rules.doc("doc-nomicon", "src/doc/nomicon")
+//      .dep(move |s| {
+//          s.name("tool-rustbook")
+//           .host(&build.build)
+//           .target(&build.build)
+//           .stage(0)
+//      })
+//      .default(build.config.docs)
+//      .run(move |s| doc::rustbook(build, s.target, "nomicon"));
+// rules.doc("doc-reference", "src/doc/reference")
+//      .dep(move |s| {
+//          s.name("tool-rustbook")
+//           .host(&build.build)
+//           .target(&build.build)
+//           .stage(0)
+//      })
+//      .default(build.config.docs)
+//      .run(move |s| doc::rustbook(build, s.target, "reference"));
 /// Invoke `rustbook` for `target` for the doc book `name`.
 ///
 /// This will not actually generate any documentation if the documentation has
@@ -36,6 +54,21 @@ pub fn rustbook(build: &Build, target: &str, name: &str) {
     rustbook_src(build, target, name, &src);
 }
 
+//rules.doc("doc-unstable-book", "src/doc/unstable-book")
+//     .dep(move |s| {
+//         s.name("tool-rustbook")
+//          .host(&build.build)
+//          .target(&build.build)
+//          .stage(0)
+//     })
+//     .dep(move |s| s.name("doc-unstable-book-gen"))
+//     .default(build.config.docs)
+//     .run(move |s| doc::rustbook_src(build,
+//                                     s.target,
+//                                     "unstable-book",
+//                                     &build.md_doc_out(s.target)));
+
+
 /// Invoke `rustbook` for `target` for the doc book `name` from the `src` path.
 ///
 /// This will not actually generate any documentation if the documentation has
@@ -45,7 +78,7 @@ pub fn rustbook_src(build: &Build, target: &str, name: &str, src: &Path) {
     t!(fs::create_dir_all(&out));
 
     let out = out.join(name);
-    let compiler = Compiler::new(0, &build.config.build);
+    let compiler = Compiler::new(0, &build.build);
     let src = src.join(name);
     let index = out.join("index.html");
     let rustbook = build.tool(&compiler, "rustbook");
@@ -61,6 +94,15 @@ pub fn rustbook_src(build: &Build, target: &str, name: &str, src: &Path) {
                    .arg(out));
 }
 
+// rules.doc("doc-book", "src/doc/book")
+//      .dep(move |s| {
+//          s.name("tool-rustbook")
+//           .host(&build.build)
+//           .target(&build.build)
+//           .stage(0)
+//      })
+//      .default(build.config.docs)
+//      .run(move |s| doc::book(build, s.target, "book"));
 /// Build the book and associated stuff.
 ///
 /// We need to build:
@@ -95,7 +137,7 @@ pub fn book(build: &Build, target: &str, name: &str) {
 fn invoke_rustdoc(build: &Build, target: &str, markdown: &str) {
     let out = build.doc_out(target);
 
-    let compiler = Compiler::new(0, &build.config.build);
+    let compiler = Compiler::new(0, &build.build);
 
     let path = build.src.join("src/doc").join(markdown);
 
@@ -137,6 +179,15 @@ fn invoke_rustdoc(build: &Build, target: &str, markdown: &str) {
     build.run(&mut cmd);
 }
 
+// rules.doc("doc-standalone", "src/doc")
+//      .dep(move |s| {
+//          s.name("rustc")
+//           .host(&build.build)
+//           .target(&build.build)
+//           .stage(0)
+//      })
+//      .default(build.config.docs)
+//      .run(move |s| doc::standalone(build, s.target));
 /// Generates all standalone documentation as compiled by the rustdoc in `stage`
 /// for the `target` into `out`.
 ///
@@ -150,7 +201,7 @@ pub fn standalone(build: &Build, target: &str) {
     let out = build.doc_out(target);
     t!(fs::create_dir_all(&out));
 
-    let compiler = Compiler::new(0, &build.config.build);
+    let compiler = Compiler::new(0, &build.build);
 
     let favicon = build.src.join("src/doc/favicon.inc");
     let footer = build.src.join("src/doc/footer.inc");
@@ -209,6 +260,12 @@ pub fn standalone(build: &Build, target: &str) {
     }
 }
 
+// for (krate, path, default) in krates("std") {
+//     rules.doc(&krate.doc_step, path)
+//          .dep(|s| s.name("libstd-link"))
+//          .default(default && build.config.docs)
+//          .run(move |s| doc::std(build, s.stage, s.target));
+// }
 /// Compile all standard library documentation.
 ///
 /// This will generate all documentation for the standard library and its
@@ -217,7 +274,7 @@ pub fn std(build: &Build, stage: u32, target: &str) {
     println!("Documenting stage{} std ({})", stage, target);
     let out = build.doc_out(target);
     t!(fs::create_dir_all(&out));
-    let compiler = Compiler::new(stage, &build.config.build);
+    let compiler = Compiler::new(stage, &build.build);
     let compiler = if build.force_use_stage1(&compiler, target) {
         Compiler::new(1, compiler.host)
     } else {
@@ -254,7 +311,7 @@ pub fn std(build: &Build, stage: u32, target: &str) {
     // for which docs must be built.
     if !build.config.compiler_docs {
         cargo.arg("--no-deps");
-        for krate in &["alloc", "core", "std", "std_unicode"] {
+        for krate in &["alloc", "collections", "core", "std", "std_unicode"] {
             cargo.arg("-p").arg(krate);
             // Create all crate output directories first to make sure rustdoc uses
             // relative links.
@@ -268,6 +325,14 @@ pub fn std(build: &Build, stage: u32, target: &str) {
     cp_r(&my_out, &out);
 }
 
+// for (krate, path, default) in krates("test") {
+//     rules.doc(&krate.doc_step, path)
+//          .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)
+//          .run(move |s| doc::test(build, s.stage, s.target));
+// }
 /// Compile all libtest documentation.
 ///
 /// This will generate all documentation for libtest and its dependencies. This
@@ -276,7 +341,7 @@ pub fn test(build: &Build, stage: u32, target: &str) {
     println!("Documenting stage{} test ({})", stage, target);
     let out = build.doc_out(target);
     t!(fs::create_dir_all(&out));
-    let compiler = Compiler::new(stage, &build.config.build);
+    let compiler = Compiler::new(stage, &build.build);
     let compiler = if build.force_use_stage1(&compiler, target) {
         Compiler::new(1, compiler.host)
     } else {
@@ -298,6 +363,17 @@ pub fn test(build: &Build, stage: u32, target: &str) {
     cp_r(&my_out, &out);
 }
 
+
+// for (krate, path, default) in krates("rustc-main") {
+//     rules.doc(&krate.doc_step, path)
+//          .dep(|s| s.name("librustc-link"))
+//          // Needed so rustdoc generates relative links to std.
+//          .dep(|s| s.name("doc-crate-std"))
+//          .host(true)
+//          .default(default && build.config.docs)
+//          .run(move |s| doc::rustc(build, s.stage, s.target));
+// }
+//
 /// Generate all compiler documentation.
 ///
 /// This will generate all documentation for the compiler libraries and their
@@ -306,7 +382,7 @@ pub fn rustc(build: &Build, stage: u32, target: &str) {
     println!("Documenting stage{} compiler ({})", stage, target);
     let out = build.doc_out(target);
     t!(fs::create_dir_all(&out));
-    let compiler = Compiler::new(stage, &build.config.build);
+    let compiler = Compiler::new(stage, &build.build);
     let compiler = if build.force_use_stage1(&compiler, target) {
         Compiler::new(1, compiler.host)
     } else {
@@ -345,29 +421,48 @@ pub fn rustc(build: &Build, stage: u32, target: &str) {
     cp_r(&my_out, &out);
 }
 
+// rules.doc("doc-error-index", "src/tools/error_index_generator")
+//      .dep(move |s| s.name("tool-error-index").target(&build.build).stage(0))
+//      .dep(move |s| s.name("librustc-link"))
+//      .default(build.config.docs)
+//      .host(true)
+//      .run(move |s| doc::error_index(build, s.target));
+
 /// Generates the HTML rendered error-index by running the
 /// `error_index_generator` tool.
 pub fn error_index(build: &Build, target: &str) {
     println!("Documenting error index ({})", target);
     let out = build.doc_out(target);
     t!(fs::create_dir_all(&out));
-    let compiler = Compiler::new(0, &build.config.build);
+    let compiler = Compiler::new(0, &build.build);
     let mut index = build.tool_cmd(&compiler, "error_index_generator");
     index.arg("html");
     index.arg(out.join("error-index.html"));
 
     // FIXME: shouldn't have to pass this env var
-    index.env("CFG_BUILD", &build.config.build);
+    index.env("CFG_BUILD", &build.build);
 
     build.run(&mut index);
 }
 
+// rules.doc("doc-unstable-book-gen", "src/tools/unstable-book-gen")
+//      .dep(move |s| {
+//          s.name("tool-unstable-book-gen")
+//           .host(&build.build)
+//           .target(&build.build)
+//           .stage(0)
+//      })
+//      .dep(move |s| s.name("libstd-link"))
+//      .default(build.config.docs)
+//      .host(true)
+//      .run(move |s| doc::unstable_book_gen(build, s.target));
+
 pub fn unstable_book_gen(build: &Build, target: &str) {
     println!("Generating unstable book md files ({})", target);
     let out = build.md_doc_out(target).join("unstable-book");
     t!(fs::create_dir_all(&out));
     t!(fs::remove_dir_all(&out));
-    let compiler = Compiler::new(0, &build.config.build);
+    let compiler = Compiler::new(0, &build.build);
     let mut cmd = build.tool_cmd(&compiler, "unstable-book-gen");
     cmd.arg(build.src.join("src"));
     cmd.arg(out);