diff options
| author | steveklabnik <steve@steveklabnik.com> | 2017-03-07 15:31:41 -0500 |
|---|---|---|
| committer | steveklabnik <steve@steveklabnik.com> | 2017-03-20 10:10:15 -0400 |
| commit | 5f2f3d07dc74f0c66e1d9d9c09bcaa6e9db7780c (patch) | |
| tree | 1b490d0223d3b445b3fb736e6c2a0e7ba2e3ef84 | |
| parent | 8573a1319a63fa61d1db9b9ff8239b5eeb3c1d56 (diff) | |
| download | rust-5f2f3d07dc74f0c66e1d9d9c09bcaa6e9db7780c.tar.gz rust-5f2f3d07dc74f0c66e1d9d9c09bcaa6e9db7780c.zip | |
build book index
| -rw-r--r-- | src/bootstrap/doc.rs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 3c024f4c4ef..f94db1c26c1 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -53,9 +53,58 @@ pub fn rustbook(build: &Build, target: &str, name: &str) { .arg(out)); } +/// Build the book and associated stuff. +/// +/// We need to build: +/// +/// * Book (first edition) +/// * Book (second edition) +/// * Index page +/// * Redirect pages pub fn book(build: &Build, target: &str, name: &str) { + // build book first edition rustbook(build, target, &format!("{}/first-edition", name)); + + // build book second edition rustbook(build, target, &format!("{}/second-edition", name)); + + // build the index page + let index = format!("{}/index.md", name); + invoke_rustdoc(build, target, &index); +} + +fn invoke_rustdoc(build: &Build, target: &str, markdown: &str) { + let out = build.doc_out(target); + + let compiler = Compiler::new(0, &build.config.build); + + let path = build.src.join("src/doc").join(markdown); + + let rustdoc = build.rustdoc(&compiler); + + let favicon = build.src.join("src/doc/favicon.inc"); + let footer = build.src.join("src/doc/footer.inc"); + t!(fs::copy(build.src.join("src/doc/rust.css"), out.join("rust.css"))); + + let version_info = out.join("version_info.html"); + + let mut cmd = Command::new(&rustdoc); + + build.add_rustc_lib_path(&compiler, &mut cmd); + + let out = out.join("book"); + + cmd.arg("--html-after-content").arg(&footer) + .arg("--html-before-content").arg(&version_info) + .arg("--html-in-header").arg(&favicon) + .arg("--markdown-playground-url") + .arg("https://play.rust-lang.org/") + .arg("-o").arg(&out) + .arg(&path) + .arg("--markdown-css") + .arg("rust.css"); + + build.run(&mut cmd); } /// Generates all standalone documentation as compiled by the rustdoc in `stage` |
