diff options
| author | bors <bors@rust-lang.org> | 2019-07-06 18:19:01 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-07-06 18:19:01 +0000 | 
| commit | dfd52ba6ac2262c6b61c59ec86bfd23e4e53d3de (patch) | |
| tree | 9585cb8e0899c0961c72a1678d337825d28d66e7 /src | |
| parent | 254f2014954bd66da206232490824975c0c662f1 (diff) | |
| parent | b5cd962be8961a269aa92513cefca2154b20a506 (diff) | |
| download | rust-dfd52ba6ac2262c6b61c59ec86bfd23e4e53d3de.tar.gz rust-dfd52ba6ac2262c6b61c59ec86bfd23e4e53d3de.zip | |
Auto merge of #59772 - andrehjr:add-rustc-guide-to-toolstate, r=mark-i-m
Add rustc guide to toolstate Closes #59597
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/builder.rs | 1 | ||||
| -rw-r--r-- | src/bootstrap/test.rs | 25 | ||||
| -rw-r--r-- | src/ci/docker/test-various/Dockerfile | 2 | ||||
| -rw-r--r-- | src/ci/docker/x86_64-gnu-debug/Dockerfile | 2 | ||||
| -rw-r--r-- | src/ci/docker/x86_64-gnu-full-bootstrap/Dockerfile | 2 | ||||
| -rw-r--r-- | src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile | 2 | ||||
| -rw-r--r-- | src/ci/docker/x86_64-gnu-nopt/Dockerfile | 2 | ||||
| -rwxr-xr-x | src/ci/docker/x86_64-gnu-tools/checktools.sh | 1 | ||||
| -rw-r--r-- | src/ci/docker/x86_64-gnu/Dockerfile | 2 | ||||
| -rwxr-xr-x | src/tools/publish_toolstate.py | 2 | ||||
| -rw-r--r-- | src/tools/rustbook/Cargo.toml | 4 | ||||
| -rw-r--r-- | src/tools/rustbook/src/main.rs | 46 | ||||
| -rw-r--r-- | src/tools/tidy/src/deps.rs | 1 | 
13 files changed, 90 insertions, 2 deletions
| diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 2e9df48d000..ab50bc1db22 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -405,6 +405,7 @@ impl<'a> Builder<'a> { test::TheBook, test::UnstableBook, test::RustcBook, + test::RustcGuide, test::EmbeddedBook, test::EditionGuide, test::Rustfmt, diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 1d54ca16a31..6c0c770bf08 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1531,6 +1531,31 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) -> } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct RustcGuide; + +impl Step for RustcGuide { + type Output = (); + const DEFAULT: bool = false; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.path("src/doc/rustc-guide") + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(RustcGuide); + } + + fn run(self, builder: &Builder<'_>) { + let src = builder.src.join("src/doc/rustc-guide"); + let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook); + builder.run(rustbook_cmd + .arg("linkcheck") + .arg(&src)); + } +} + +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct CrateLibrustc { compiler: Compiler, target: Interned<String>, diff --git a/src/ci/docker/test-various/Dockerfile b/src/ci/docker/test-various/Dockerfile index c45b1a9a0f1..cfbf2c6b688 100644 --- a/src/ci/docker/test-various/Dockerfile +++ b/src/ci/docker/test-various/Dockerfile @@ -11,6 +11,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ cmake \ sudo \ gdb \ + libssl-dev \ + pkg-config \ xz-utils \ wget \ patch diff --git a/src/ci/docker/x86_64-gnu-debug/Dockerfile b/src/ci/docker/x86_64-gnu-debug/Dockerfile index 7a503ea4e98..3ac1d2ac90b 100644 --- a/src/ci/docker/x86_64-gnu-debug/Dockerfile +++ b/src/ci/docker/x86_64-gnu-debug/Dockerfile @@ -17,6 +17,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ cmake \ sudo \ gdb \ + libssl-dev \ + pkg-config \ xz-utils \ lld \ clang diff --git a/src/ci/docker/x86_64-gnu-full-bootstrap/Dockerfile b/src/ci/docker/x86_64-gnu-full-bootstrap/Dockerfile index a157fee16cf..207f972c3cd 100644 --- a/src/ci/docker/x86_64-gnu-full-bootstrap/Dockerfile +++ b/src/ci/docker/x86_64-gnu-full-bootstrap/Dockerfile @@ -11,6 +11,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ cmake \ sudo \ gdb \ + libssl-dev \ + pkg-config \ xz-utils COPY scripts/sccache.sh /scripts/ diff --git a/src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile b/src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile index ef97f59cafd..6dbbb220347 100644 --- a/src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile +++ b/src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile @@ -13,6 +13,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ gdb \ llvm-6.0-tools \ libedit-dev \ + libssl-dev \ + pkg-config \ zlib1g-dev \ xz-utils diff --git a/src/ci/docker/x86_64-gnu-nopt/Dockerfile b/src/ci/docker/x86_64-gnu-nopt/Dockerfile index d0b244c9b76..6a5c7f5d9e6 100644 --- a/src/ci/docker/x86_64-gnu-nopt/Dockerfile +++ b/src/ci/docker/x86_64-gnu-nopt/Dockerfile @@ -11,6 +11,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ cmake \ sudo \ gdb \ + libssl-dev \ + pkg-config \ xz-utils COPY scripts/sccache.sh /scripts/ diff --git a/src/ci/docker/x86_64-gnu-tools/checktools.sh b/src/ci/docker/x86_64-gnu-tools/checktools.sh index 978732e3c08..9995d2aac7f 100755 --- a/src/ci/docker/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/x86_64-gnu-tools/checktools.sh @@ -88,6 +88,7 @@ status_check() { # these tools are not required for beta to successfully branch check_dispatch $1 nightly miri src/tools/miri check_dispatch $1 nightly embedded-book src/doc/embedded-book + check_dispatch $1 nightly rustc-guide src/doc/rustc-guide } # If this PR is intended to update one of these tools, do not let the build pass diff --git a/src/ci/docker/x86_64-gnu/Dockerfile b/src/ci/docker/x86_64-gnu/Dockerfile index c3519a00778..4ec43647213 100644 --- a/src/ci/docker/x86_64-gnu/Dockerfile +++ b/src/ci/docker/x86_64-gnu/Dockerfile @@ -11,6 +11,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ cmake \ sudo \ gdb \ + libssl-dev \ + pkg-config \ xz-utils COPY scripts/sccache.sh /scripts/ diff --git a/src/tools/publish_toolstate.py b/src/tools/publish_toolstate.py index d5dff1dcae0..3f876b04fbe 100755 --- a/src/tools/publish_toolstate.py +++ b/src/tools/publish_toolstate.py @@ -28,6 +28,7 @@ MAINTAINERS = { '@ryankurte @thejpster @therealprof' ), 'edition-guide': '@ehuss @Centril @steveklabnik', + 'rustc-guide': '@mark-i-m' } REPOS = { @@ -41,6 +42,7 @@ REPOS = { 'rust-by-example': 'https://github.com/rust-lang/rust-by-example', 'embedded-book': 'https://github.com/rust-embedded/book', 'edition-guide': 'https://github.com/rust-lang-nursery/edition-guide', + 'rustc-guide': 'https://github.com/rust-lang/rustc-guide', } diff --git a/src/tools/rustbook/Cargo.toml b/src/tools/rustbook/Cargo.toml index 54549e4c7e9..15a71df93a2 100644 --- a/src/tools/rustbook/Cargo.toml +++ b/src/tools/rustbook/Cargo.toml @@ -7,6 +7,7 @@ edition = "2018" [dependencies] clap = "2.25.0" +failure = "0.1" [dependencies.mdbook] version = "0.3.0" @@ -18,3 +19,6 @@ package = "mdbook" version = "0.1.7" default-features = false features = ["search"] + +[target.'cfg(all(target_arch = "x86_64", target_os = "linux"))'.dependencies] +mdbook-linkcheck = "0.3.0" diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs index 04e48dde86b..c9e240049a1 100644 --- a/src/tools/rustbook/src/main.rs +++ b/src/tools/rustbook/src/main.rs @@ -11,7 +11,14 @@ use mdbook_1::{MDBook as MDBook1}; use mdbook_1::errors::{Result as Result1}; use mdbook::MDBook; -use mdbook::errors::Result; +use mdbook::errors::{Result as Result3}; + +#[cfg(all(target_arch = "x86_64", target_os = "linux"))] +use mdbook::renderer::RenderContext; + +#[cfg(all(target_arch = "x86_64", target_os = "linux"))] +use mdbook_linkcheck::{self, errors::BrokenLinks}; +use failure::Error; fn main() { let d_message = "-d, --dest-dir=[dest-dir] @@ -31,6 +38,9 @@ fn main() { .arg_from_usage(d_message) .arg_from_usage(dir_message) .arg_from_usage(vers_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... @@ -64,10 +74,42 @@ fn main() { } }; }, + ("linkcheck", Some(sub_matches)) => { + if let Err(err) = linkcheck(sub_matches) { + eprintln!("Error: {}", err); + + #[cfg(all(target_arch = "x86_64", target_os = "linux"))] + { + if let Ok(broken_links) = err.downcast::<BrokenLinks>() { + for cause in broken_links.links().iter() { + eprintln!("\tCaused By: {}", cause); + } + } + } + + ::std::process::exit(101); + } + }, (_, _) => unreachable!(), }; } +#[cfg(all(target_arch = "x86_64", target_os = "linux"))] +pub fn linkcheck(args: &ArgMatches<'_>) -> Result<(), Error> { + let book_dir = get_book_dir(args); + let book = MDBook::load(&book_dir).unwrap(); + let cfg = book.config; + let render_ctx = RenderContext::new(&book_dir, book.book, cfg, &book_dir); + + mdbook_linkcheck::check_links(&render_ctx) +} + +#[cfg(not(all(target_arch = "x86_64", target_os = "linux")))] +pub fn linkcheck(_args: &ArgMatches<'_>) -> Result<(), Error> { + println!("mdbook-linkcheck only works on x86_64 linux targets."); + Ok(()) +} + // Build command implementation pub fn build_1(args: &ArgMatches<'_>) -> Result1<()> { let book_dir = get_book_dir(args); @@ -86,7 +128,7 @@ pub fn build_1(args: &ArgMatches<'_>) -> Result1<()> { } // Build command implementation -pub fn build(args: &ArgMatches<'_>) -> Result<()> { +pub fn build(args: &ArgMatches<'_>) -> Result3<()> { let book_dir = get_book_dir(args); let mut book = MDBook::load(&book_dir)?; diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 6169ffc4297..ca6cea97066 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -14,6 +14,7 @@ const LICENSES: &[&str] = &[ "Apache-2.0/MIT", "Apache-2.0 / MIT", "MIT OR Apache-2.0", + "Apache-2.0 OR MIT", "MIT", "Unlicense/MIT", "Unlicense OR MIT", | 
