Auto merge of #73671 - ehuss:update-mdbook, r=Mark-Simulacrum

Update mdbook

This updates mdbook to 0.4.  The list of changes can be found at https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-040.  I think the most important one is the change to include fonts with the book instead of using the Google Fonts CDN. This adds a few megabytes of fonts to the docs component.  It may be possible to share the fonts across the books, but would take a fair bit of work to make that happen, so I'm not sure if it is necessary.

This also removes mdbook-linkcheck. It is currently not being used, and I don't foresee it going back into use anytime soon. I would prefer not to maintain something that isn't being used, and it removes a very large number of dependencies.
This commit is contained in:
bors 2020-06-27 20:14:34 +00:00
commit 9bdd2db3a6
6 changed files with 24 additions and 647 deletions

View File

@ -65,9 +65,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.26"
version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7825f6833612eb2414095684fcf6c635becf3ce97fe48cf6421321e93bfbd53c"
checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f"
[[package]]
name = "arc-swap"
@ -143,15 +143,6 @@ dependencies = [
"rustc-std-workspace-core",
]
[[package]]
name = "base64"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
dependencies = [
"byteorder",
]
[[package]]
name = "bitflags"
version = "1.2.1"
@ -270,7 +261,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa"
dependencies = [
"byteorder",
"either",
"iovec",
]
@ -291,7 +281,7 @@ dependencies = [
"cargo-test-macro",
"cargo-test-support",
"clap",
"core-foundation 0.7.0",
"core-foundation",
"crates-io",
"crossbeam-utils 0.7.2",
"crypto-hash",
@ -539,7 +529,7 @@ dependencies = [
"if_chain",
"itertools 0.9.0",
"lazy_static",
"pulldown-cmark 0.7.1",
"pulldown-cmark",
"quine-mc_cluskey",
"quote 1.0.2",
"regex-syntax",
@ -570,26 +560,6 @@ dependencies = [
"cc",
]
[[package]]
name = "codespan"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de67bdcd653002a6dba3eb53850ce3a485547225d81cb6c2bbdbc5a0cba5d15d"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "codespan-reporting"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efd1d915d9e2b2ad696b2cd73215a84823ef3f0e3084d90304204415921b62c6"
dependencies = [
"codespan",
"termcolor",
"unicode-width",
]
[[package]]
name = "colored"
version = "1.9.3"
@ -676,34 +646,6 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e"
[[package]]
name = "cookie"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5"
dependencies = [
"time",
"url 1.7.2",
]
[[package]]
name = "cookie_store"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46750b3f362965f197996c4448e4a0935e791bf7d6631bfce9ee0af3d24c919c"
dependencies = [
"cookie",
"failure",
"idna 0.1.5",
"log",
"publicsuffix",
"serde",
"serde_json",
"time",
"try_from",
"url 1.7.2",
]
[[package]]
name = "core"
version = "0.0.0"
@ -711,32 +653,16 @@ dependencies = [
"rand 0.7.3",
]
[[package]]
name = "core-foundation"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e2640d6d0bf22e82bed1b73c6aef8d5dd31e5abe6666c57e6d45e2649f4f887"
dependencies = [
"core-foundation-sys 0.6.2",
"libc",
]
[[package]]
name = "core-foundation"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171"
dependencies = [
"core-foundation-sys 0.7.0",
"core-foundation-sys",
"libc",
]
[[package]]
name = "core-foundation-sys"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
[[package]]
name = "core-foundation-sys"
version = "0.7.0"
@ -881,40 +807,6 @@ dependencies = [
"winapi 0.3.8",
]
[[package]]
name = "darling"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9158d690bc62a3a57c3e45b85e4d50de2008b39345592c64efd79345c7e24be0"
dependencies = [
"darling_core",
"darling_macro",
]
[[package]]
name = "darling_core"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2a368589465391e127e10c9e3a08efc8df66fd49b87dc8524c764bbe7f2ef82"
dependencies = [
"fnv",
"ident_case",
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
]
[[package]]
name = "darling_macro"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "244e8987bd4e174385240cde20a3657f607fb0797563c28255c353b5819a07b1"
dependencies = [
"darling_core",
"quote 0.6.12",
"syn 0.15.35",
]
[[package]]
name = "datafrog"
version = "2.0.1"
@ -1007,18 +899,6 @@ dependencies = [
"rustc-std-workspace-core",
]
[[package]]
name = "dtoa"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e"
[[package]]
name = "dunce"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0ad6bf6a88548d1126045c413548df1453d9be094a8ab9fd59bf1fdd338da4f"
[[package]]
name = "either"
version = "1.5.0"
@ -1049,15 +929,6 @@ dependencies = [
"log",
]
[[package]]
name = "encoding_rs"
version = "0.8.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4155785c79f2f6701f185eb2e6b4caf0555ec03477cb4c70db67b465311620ed"
dependencies = [
"cfg-if",
]
[[package]]
name = "env_logger"
version = "0.6.2"
@ -1084,15 +955,6 @@ dependencies = [
"termcolor",
]
[[package]]
name = "error-chain"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
dependencies = [
"backtrace",
]
[[package]]
name = "error_index_generator"
version = "0.0.0"
@ -1252,16 +1114,6 @@ version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45dc39533a6cae6da2b56da48edae506bb767ec07370f86f70fc062e9d435869"
[[package]]
name = "futures-cpupool"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4"
dependencies = [
"futures",
"num_cpus",
]
[[package]]
name = "fwdansi"
version = "1.0.1"
@ -1349,24 +1201,6 @@ dependencies = [
"regex",
]
[[package]]
name = "h2"
version = "0.1.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a539b63339fbbb00e081e84b6e11bd1d9634a82d91da2984a18ac74a8823f392"
dependencies = [
"byteorder",
"bytes",
"fnv",
"futures",
"http",
"indexmap",
"log",
"slab",
"string",
"tokio-io",
]
[[package]]
name = "handlebars"
version = "3.0.1"
@ -1449,35 +1283,6 @@ dependencies = [
"syn 1.0.11",
]
[[package]]
name = "http"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7e06e336150b178206af098a055e3621e8336027e2b4d126bda0bc64824baaf"
dependencies = [
"bytes",
"fnv",
"itoa",
]
[[package]]
name = "http-body"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d"
dependencies = [
"bytes",
"futures",
"http",
"tokio-buf",
]
[[package]]
name = "httparse"
version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9"
[[package]]
name = "humantime"
version = "1.3.0"
@ -1493,55 +1298,6 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9b6c53306532d3c8e8087b44e6580e10db51a023cf9b433cea2ac38066b92da"
[[package]]
name = "hyper"
version = "0.12.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6481fff8269772d4463253ca83c788104a7305cb3fb9136bc651a6211e46e03f"
dependencies = [
"bytes",
"futures",
"futures-cpupool",
"h2",
"http",
"http-body",
"httparse",
"iovec",
"itoa",
"log",
"net2",
"rustc_version",
"time",
"tokio",
"tokio-buf",
"tokio-executor",
"tokio-io",
"tokio-reactor",
"tokio-tcp",
"tokio-threadpool",
"tokio-timer",
"want",
]
[[package]]
name = "hyper-tls"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a800d6aa50af4b5850b2b0f659625ce9504df908e9733b635720483be26174f"
dependencies = [
"bytes",
"futures",
"hyper",
"native-tls",
"tokio-io",
]
[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "idna"
version = "0.1.5"
@ -1634,12 +1390,6 @@ dependencies = [
"libc",
]
[[package]]
name = "is-match"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e5b386aef33a1c677be65237cb9d32c3f3ef56bd035949710c4bb13083eb053"
[[package]]
name = "itertools"
version = "0.8.0"
@ -1992,23 +1742,22 @@ dependencies = [
[[package]]
name = "mdbook"
version = "0.3.7"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7ec525f7ebccc2dd935c263717250cd37f9a4b264a77c5dbc950ea2734d8159"
checksum = "2567ffadc0fd26fe15d6f6e0a80639f19f6a50082fdb460d0ae5d1f7298181be"
dependencies = [
"ammonia",
"anyhow",
"chrono",
"clap",
"elasticlunr-rs",
"env_logger 0.6.2",
"error-chain",
"env_logger 0.7.1",
"handlebars",
"itertools 0.8.0",
"lazy_static",
"log",
"memchr",
"open",
"pulldown-cmark 0.6.1",
"pulldown-cmark",
"regex",
"serde",
"serde_derive",
@ -2016,34 +1765,6 @@ dependencies = [
"shlex",
"tempfile",
"toml",
"toml-query",
]
[[package]]
name = "mdbook-linkcheck"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0a04db564ca37c47771f8455c825dc941ea851ff0deffcf55a04c512406b409"
dependencies = [
"codespan",
"codespan-reporting",
"dunce",
"either",
"env_logger 0.7.1",
"failure",
"http",
"log",
"mdbook",
"percent-encoding 2.1.0",
"pulldown-cmark 0.6.1",
"rayon",
"regex",
"reqwest",
"semver 0.9.0",
"serde",
"serde_derive",
"serde_json",
"structopt",
]
[[package]]
@ -2083,25 +1804,6 @@ dependencies = [
"rustc_version",
]
[[package]]
name = "mime"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e27ca21f40a310bd06d9031785f4801710d566c184a6e15bad4f1d9b65f9425"
dependencies = [
"unicase",
]
[[package]]
name = "mime_guess"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a0ed03949aef72dbdf3116a383d7b38b4768e6f960528cd6a6044aa9ed68599"
dependencies = [
"mime",
"unicase",
]
[[package]]
name = "minifier"
version = "0.0.33"
@ -2202,24 +1904,6 @@ dependencies = [
"shell-escape",
]
[[package]]
name = "native-tls"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b2df1a4c22fd44a62147fd8f13dd0f95c9d8ca7b2610299b2a2f9cf8964274e"
dependencies = [
"lazy_static",
"libc",
"log",
"openssl",
"openssl-probe",
"openssl-sys",
"schannel",
"security-framework",
"security-framework-sys",
"tempfile",
]
[[package]]
name = "net2"
version = "0.2.33"
@ -2670,31 +2354,6 @@ dependencies = [
"cc",
]
[[package]]
name = "publicsuffix"
version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bf259a81de2b2eb9850ec990ec78e6a25319715584fd7652b9b26f96fcb1510"
dependencies = [
"error-chain",
"idna 0.2.0",
"lazy_static",
"regex",
"url 2.1.0",
]
[[package]]
name = "pulldown-cmark"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c205cc82214f3594e2d50686730314f817c67ffa80fe800cf0db78c3c2b9d9e"
dependencies = [
"bitflags",
"getopts",
"memchr",
"unicase",
]
[[package]]
name = "pulldown-cmark"
version = "0.7.1"
@ -2702,6 +2361,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e142c3b8f49d2200605ee6ba0b1d757310e9e7a72afe78c36ee2ef67300ee00"
dependencies = [
"bitflags",
"getopts",
"memchr",
"unicase",
]
@ -3002,40 +2662,6 @@ dependencies = [
"winapi 0.3.8",
]
[[package]]
name = "reqwest"
version = "0.9.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c2064233e442ce85c77231ebd67d9eca395207dec2127fe0bbedde4bd29a650"
dependencies = [
"base64",
"bytes",
"cookie",
"cookie_store",
"encoding_rs",
"flate2",
"futures",
"http",
"hyper",
"hyper-tls",
"log",
"mime",
"mime_guess",
"native-tls",
"serde",
"serde_json",
"serde_urlencoded",
"time",
"tokio",
"tokio-executor",
"tokio-io",
"tokio-threadpool",
"tokio-timer",
"url 1.7.2",
"uuid",
"winreg",
]
[[package]]
name = "rls"
version = "1.41.0"
@ -3162,12 +2788,7 @@ name = "rustbook"
version = "0.1.0"
dependencies = [
"clap",
"codespan",
"codespan-reporting",
"failure",
"mdbook",
"mdbook-linkcheck",
"rustc-workspace-hack",
]
[[package]]
@ -4402,7 +4023,7 @@ version = "0.0.0"
dependencies = [
"itertools 0.8.0",
"minifier",
"pulldown-cmark 0.7.1",
"pulldown-cmark",
"rustc-rayon",
"serde",
"serde_json",
@ -4525,27 +4146,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d"
[[package]]
name = "security-framework"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eee63d0f4a9ec776eeb30e220f0bc1e092c3ad744b2a379e3993070364d3adc2"
dependencies = [
"core-foundation 0.6.3",
"core-foundation-sys 0.6.2",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9636f8989cbf61385ae4824b98c1aaa54c994d7d8b41f11c601ed799f0549a56"
dependencies = [
"core-foundation-sys 0.6.2",
]
[[package]]
name = "semver"
version = "0.9.0"
@ -4623,18 +4223,6 @@ dependencies = [
"syn 1.0.11",
]
[[package]]
name = "serde_urlencoded"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a"
dependencies = [
"dtoa",
"itoa",
"serde",
"url 1.7.2",
]
[[package]]
name = "sha-1"
version = "0.8.2"
@ -4756,15 +4344,6 @@ dependencies = [
"wasi",
]
[[package]]
name = "string"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d"
dependencies = [
"bytes",
]
[[package]]
name = "string_cache"
version = "0.7.3"
@ -5072,17 +4651,6 @@ dependencies = [
"tokio-uds",
]
[[package]]
name = "tokio-buf"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46"
dependencies = [
"bytes",
"either",
"futures",
]
[[package]]
name = "tokio-codec"
version = "0.1.1"
@ -5308,32 +4876,6 @@ dependencies = [
"serde",
]
[[package]]
name = "toml-query"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a24369a1894ac8224efcfd567c3d141aea360292f49888e7ec7dcc316527aebb"
dependencies = [
"failure",
"failure_derive",
"is-match",
"lazy_static",
"regex",
"toml",
"toml-query_derive",
]
[[package]]
name = "toml-query_derive"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c99ca245ec273c7e75c8ee58f47b882d0146f3c2c8495158082c6671e8b5335"
dependencies = [
"darling",
"quote 0.6.12",
"syn 0.15.35",
]
[[package]]
name = "tracing"
version = "0.1.15"
@ -5365,21 +4907,6 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "try-lock"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382"
[[package]]
name = "try_from"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "283d3b89e1368717881a9d51dad843cc435380d8109c9e47d38780a324698d8b"
dependencies = [
"cfg-if",
]
[[package]]
name = "typenum"
version = "1.12.0"
@ -5541,15 +5068,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8772a4ccbb4e89959023bc5b7cb8623a795caa7092d99f3aa9501b9484d4557d"
[[package]]
name = "uuid"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a"
dependencies = [
"rand 0.6.1",
]
[[package]]
name = "vcpkg"
version = "0.2.8"
@ -5598,17 +5116,6 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "want"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230"
dependencies = [
"futures",
"log",
"try-lock",
]
[[package]]
name = "wasi"
version = "0.9.0+wasi-snapshot-preview1"
@ -5673,15 +5180,6 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "winreg"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9"
dependencies = [
"winapi 0.3.8",
]
[[package]]
name = "ws2_32-sys"
version = "0.2.1"

View File

@ -12,7 +12,7 @@
use crate::channel::GitInfo;
use crate::compile;
use crate::toolstate::ToolState;
use crate::util::{add_dylib_path, exe, CiEnv};
use crate::util::{add_dylib_path, exe};
use crate::Compiler;
use crate::Mode;
@ -236,7 +236,6 @@ pub fn prepare_tool_cargo(
|| path.ends_with("rls")
|| path.ends_with("clippy")
|| path.ends_with("miri")
|| path.ends_with("rustbook")
|| path.ends_with("rustfmt")
{
cargo.env("LIBZ_SYS_STATIC", "1");
@ -272,20 +271,6 @@ pub fn prepare_tool_cargo(
cargo
}
fn rustbook_features() -> Vec<String> {
let mut features = Vec::new();
// Due to CI budged and risk of spurious failures we want to limit jobs running this check.
// At same time local builds should run it regardless of the platform.
// `CiEnv::None` means it's local build and `CHECK_LINKS` is defined in x86_64-gnu-tools to
// explicitly enable it on single job
if CiEnv::current() == CiEnv::None || env::var("CHECK_LINKS").is_ok() {
features.push("linkcheck".to_string());
}
features
}
macro_rules! bootstrap_tool {
($(
$name:ident, $path:expr, $tool_name:expr
@ -368,7 +353,7 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
}
bootstrap_tool!(
Rustbook, "src/tools/rustbook", "rustbook", features = rustbook_features();
Rustbook, "src/tools/rustbook", "rustbook";
UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen";
Tidy, "src/tools/tidy", "tidy";
Linkchecker, "src/tools/linkchecker", "linkchecker";

View File

@ -19,9 +19,6 @@ RUN sh /scripts/sccache.sh
COPY x86_64-gnu-tools/checktools.sh /tmp/
# Run rustbook with `linkcheck` feature enabled
ENV CHECK_LINKS 1
ENV RUST_CONFIGURE_ARGS \
--build=x86_64-unknown-linux-gnu \
--save-toolstates=/tmp/toolstate/toolstates.json

View File

@ -5,24 +5,10 @@ version = "0.1.0"
license = "MIT OR Apache-2.0"
edition = "2018"
[features]
linkcheck = ["mdbook-linkcheck", "codespan-reporting", "codespan"]
[dependencies]
clap = "2.25.0"
failure = "0.1"
mdbook-linkcheck = { version = "0.5.0", optional = true }
# Keep in sync with mdbook-linkcheck.
codespan = { version = "0.5", optional = true }
codespan-reporting = { version = "0.5", optional = true }
# A noop dependency that changes in the Rust repository, it's a bit of a hack.
# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`
# for more information.
rustc-workspace-hack = "1.0.0"
[dependencies.mdbook]
version = "0.3.7"
version = "0.4.0"
default-features = false
features = ["search"]

View File

@ -30,11 +30,6 @@ fn main() {
.about("Tests that a book's Rust code samples compile")
.arg_from_usage(dir_message),
)
.subcommand(
SubCommand::with_name("linkcheck")
.about("Run linkcheck with mdBook 3")
.arg_from_usage(dir_message),
)
.get_matches();
// Check which subcomamnd the user ran...
@ -49,98 +44,14 @@ fn main() {
handle_error(e);
}
}
("linkcheck", Some(sub_matches)) => {
#[cfg(feature = "linkcheck")]
{
let (diags, files) = linkcheck(sub_matches).expect("Error while linkchecking.");
if !diags.is_empty() {
let color = codespan_reporting::term::termcolor::ColorChoice::Auto;
let mut writer =
codespan_reporting::term::termcolor::StandardStream::stderr(color);
let cfg = codespan_reporting::term::Config::default();
for diag in diags {
codespan_reporting::term::emit(&mut writer, &cfg, &files, &diag)
.expect("Unable to emit linkcheck error.");
}
std::process::exit(101);
}
}
#[cfg(not(feature = "linkcheck"))]
{
// This avoids the `unused_binding` lint.
println!(
"mdbook-linkcheck is disabled, but arguments were passed: {:?}",
sub_matches
);
}
}
(_, _) => unreachable!(),
};
}
#[cfg(feature = "linkcheck")]
pub fn linkcheck(
args: &ArgMatches<'_>,
) -> Result<(Vec<codespan_reporting::diagnostic::Diagnostic>, codespan::Files), failure::Error> {
use mdbook_linkcheck::Reason;
let book_dir = get_book_dir(args);
let src_dir = book_dir.join("src");
let book = MDBook::load(&book_dir).unwrap();
let linkck_cfg = mdbook_linkcheck::get_config(&book.config)?;
let mut files = codespan::Files::new();
let target_files = mdbook_linkcheck::load_files_into_memory(&book.book, &mut files);
let cache = mdbook_linkcheck::Cache::default();
let (links, incomplete) = mdbook_linkcheck::extract_links(target_files, &files);
let outcome =
mdbook_linkcheck::validate(&links, &linkck_cfg, &src_dir, &cache, &files, incomplete)?;
let mut is_real_error = false;
for link in outcome.invalid_links.iter() {
match &link.reason {
Reason::FileNotFound | Reason::TraversesParentDirectories => {
is_real_error = true;
}
Reason::UnsuccessfulServerResponse(status) => {
if status.as_u16() == 429 {
eprintln!("Received 429 (TOO_MANY_REQUESTS) for link `{}`", link.link.uri);
} else if status.is_client_error() {
is_real_error = true;
} else {
eprintln!("Unsuccessful server response for link `{}`", link.link.uri);
}
}
Reason::Client(err) => {
if err.is_timeout() {
eprintln!("Timeout for link `{}`", link.link.uri);
} else if err.is_server_error() {
eprintln!("Server error for link `{}`", link.link.uri);
} else if !err.is_http() {
eprintln!("Non-HTTP-related error for link: {} {}", link.link.uri, err);
} else {
is_real_error = true;
}
}
}
}
if is_real_error {
Ok((outcome.generate_diagnostics(&files, linkck_cfg.warning_policy), files))
} else {
Ok((vec![], files))
}
}
// Build command implementation
pub fn build(args: &ArgMatches<'_>) -> Result3<()> {
let book_dir = get_book_dir(args);
let mut book = MDBook::load(&book_dir)?;
let mut book = load_book(&book_dir)?;
// Set this to allow us to catch bugs in advance.
book.config.build.create_missing = false;
@ -156,7 +67,7 @@ pub fn build(args: &ArgMatches<'_>) -> Result3<()> {
fn test(args: &ArgMatches<'_>) -> Result3<()> {
let book_dir = get_book_dir(args);
let mut book = MDBook::load(&book_dir)?;
let mut book = load_book(&book_dir)?;
book.test(vec![])
}
@ -170,10 +81,16 @@ fn get_book_dir(args: &ArgMatches<'_>) -> PathBuf {
}
}
fn load_book(book_dir: &Path) -> Result3<MDBook> {
let mut book = MDBook::load(book_dir)?;
book.config.set("output.html.input-404", "").unwrap();
Ok(book)
}
fn handle_error(error: mdbook::errors::Error) -> ! {
eprintln!("Error: {}", error);
for cause in error.iter().skip(1) {
for cause in error.chain().skip(1) {
eprintln!("\tCaused By: {}", cause);
}

View File

@ -26,9 +26,6 @@
const EXCEPTIONS: &[(&str, &str)] = &[
("mdbook", "MPL-2.0"), // mdbook
("openssl", "Apache-2.0"), // cargo, mdbook
("toml-query", "MPL-2.0"), // mdbook
("toml-query_derive", "MPL-2.0"), // mdbook
("is-match", "MPL-2.0"), // mdbook
("rdrand", "ISC"), // mdbook, rustfmt
("fuchsia-cprng", "BSD-3-Clause"), // mdbook, rustfmt
("fuchsia-zircon-sys", "BSD-3-Clause"), // rustdoc, rustc, cargo
@ -45,9 +42,6 @@
("bitmaps", "MPL-2.0+"), // cargo via im-rc
// FIXME: this dependency violates the documentation comment above:
("fortanix-sgx-abi", "MPL-2.0"), // libstd but only for `sgx` target
("dunce", "CC0-1.0"), // mdbook-linkcheck
("codespan-reporting", "Apache-2.0"), // mdbook-linkcheck
("codespan", "Apache-2.0"), // mdbook-linkcheck
("crossbeam-channel", "MIT/Apache-2.0 AND BSD-2-Clause"), // cargo
];