From 38ddb446b9da85532fc4a1540eff45509b0b9289 Mon Sep 17 00:00:00 2001 From: est31 Date: Sun, 14 Jan 2018 08:25:18 +0100 Subject: [PATCH] Check for deadlinks from the summary during book generation Previously, any deadlinks from a book's SUMMARY.md wouldn't cause any errors or warnings or similar but mdbook would simply create a page with blank content. This has kept bug #47394 hidden. It should have been detected back in the PR when those wrongly named files got added to the book. PR #47414 was one component of the solution. This change is a second line of defense for the unstable book and a first line of defense for any other book. We also update mdbook to the most recent version. --- src/Cargo.lock | 6 +++--- src/tools/rustbook/Cargo.toml | 2 +- src/tools/rustbook/src/main.rs | 12 +++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index 8fbf3535264fc..249fabea411cd 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -1114,7 +1114,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "mdbook" -version = "0.0.26" +version = "0.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1697,7 +1697,7 @@ name = "rustbook" version = "0.1.0" dependencies = [ "clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)", - "mdbook 0.0.26 (registry+https://github.com/rust-lang/crates.io-index)", + "mdbook 0.0.28 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2882,7 +2882,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" "checksum markup5ever 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "047150a0e03b57e638fc45af33a0b63a0362305d5b9f92ecef81df472a4cceb0" "checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" -"checksum mdbook 0.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "8a1ac668292d1e5c7b1c6fd64f70d3a85105b8069a89558a0d67bdb2ff298ca1" +"checksum mdbook 0.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "1ee8ba20c002000546681dc78d7f7e91fd35832058b1e2fdd492ca842bb6e9be" "checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" "checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d" diff --git a/src/tools/rustbook/Cargo.toml b/src/tools/rustbook/Cargo.toml index 4aa096246bcf3..bc35cbe9fbba6 100644 --- a/src/tools/rustbook/Cargo.toml +++ b/src/tools/rustbook/Cargo.toml @@ -8,5 +8,5 @@ license = "MIT/Apache-2.0" clap = "2.25.0" [dependencies.mdbook] -version = "0.0.26" +version = "0.0.28" default-features = false diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs index a0c3e811a7aa2..50f4364e448f7 100644 --- a/src/tools/rustbook/src/main.rs +++ b/src/tools/rustbook/src/main.rs @@ -52,12 +52,14 @@ fn main() { // Build command implementation pub fn build(args: &ArgMatches) -> Result<()> { let book_dir = get_book_dir(args); - let book = MDBook::new(&book_dir).read_config()?; + let mut book = MDBook::new(&book_dir).read_config()?; - let mut book = match args.value_of("dest-dir") { - Some(dest_dir) => book.with_destination(dest_dir), - None => book, - }; + // Set this to allow us to catch bugs in advance. + book.config.build.create_missing = false; + + if let Some(dest_dir) = args.value_of("dest-dir") { + book.config.build.build_dir = PathBuf::from(dest_dir); + } book.build()?;