Add rustdoc to x.py check

This can often encounter errors after modifying rustc, so it's useful to include it in the steps that are checked.
This commit is contained in:
varkor 2018-04-18 19:46:58 +01:00
parent 8a28d94ea1
commit baf940d580
2 changed files with 53 additions and 2 deletions

View file

@ -310,7 +310,7 @@ impl<'a> Builder<'a> {
tool::Compiletest, tool::RemoteTestServer, tool::RemoteTestClient,
tool::RustInstaller, tool::Cargo, tool::Rls, tool::Rustdoc, tool::Clippy,
native::Llvm, tool::Rustfmt, tool::Miri, native::Lld),
Kind::Check => describe!(check::Std, check::Test, check::Rustc, check::CodegenBackend),
Kind::Check => describe!(check::Std, check::Test, check::Rustc, check::CodegenBackend, check::Rustdoc),
Kind::Test => describe!(test::Tidy, test::Bootstrap, test::Ui, test::RunPass,
test::CompileFail, test::ParseFail, test::RunFail, test::RunPassValgrind,
test::MirOpt, test::Codegen, test::CodegenUnits, test::Incremental, test::Debuginfo,

View file

@ -12,6 +12,7 @@
use compile::{run_cargo, std_cargo, test_cargo, rustc_cargo, rustc_cargo_env, add_to_sysroot};
use builder::{RunConfig, Builder, ShouldRun, Step};
use tool::prepare_tool_cargo;
use {Compiler, Mode};
use cache::{INTERNER, Interned};
use std::path::PathBuf;
@ -41,6 +42,7 @@ impl Step for Std {
let out_dir = builder.stage_out(compiler, Mode::Libstd);
builder.clear_if_dirty(&out_dir, &builder.rustc(compiler));
let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "check");
std_cargo(builder, &compiler, target, &mut cargo);
@ -170,11 +172,12 @@ impl Step for Test {
}
fn run(self, builder: &Builder) {
let target = self.target;
let compiler = builder.compiler(0, builder.config.build);
let target = self.target;
let out_dir = builder.stage_out(compiler, Mode::Libtest);
builder.clear_if_dirty(&out_dir, &libstd_stamp(builder, compiler, target));
let mut cargo = builder.cargo(compiler, Mode::Libtest, target, "check");
test_cargo(builder, &compiler, target, &mut cargo);
@ -190,6 +193,48 @@ impl Step for Test {
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Rustdoc {
pub target: Interned<String>,
}
impl Step for Rustdoc {
type Output = ();
const ONLY_HOSTS: bool = true;
const DEFAULT: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/tools/rustdoc")
}
fn make_run(run: RunConfig) {
run.builder.ensure(Rustdoc {
target: run.target,
});
}
fn run(self, builder: &Builder) {
let compiler = builder.compiler(0, builder.config.build);
let target = self.target;
let mut cargo = prepare_tool_cargo(builder,
compiler,
target,
"check",
"src/tools/rustdoc");
let _folder = builder.fold_output(|| format!("stage{}-rustdoc", compiler.stage));
println!("Checking rustdoc artifacts ({} -> {})", &compiler.host, target);
run_cargo(builder,
&mut cargo,
&rustdoc_stamp(builder, compiler, target),
true);
let libdir = builder.sysroot_libdir(compiler, target);
add_to_sysroot(&builder, &libdir, &rustdoc_stamp(builder, compiler, target));
}
}
/// Cargo's output path for the standard library in a given stage, compiled
/// by a particular compiler for the specified target.
pub fn libstd_stamp(builder: &Builder, compiler: Compiler, target: Interned<String>) -> PathBuf {
@ -217,3 +262,9 @@ fn codegen_backend_stamp(builder: &Builder,
builder.cargo_out(compiler, Mode::Librustc, target)
.join(format!(".librustc_trans-{}-check.stamp", backend))
}
/// Cargo's output path for rustdoc in a given stage, compiled by a particular
/// compiler for the specified target.
pub fn rustdoc_stamp(builder: &Builder, compiler: Compiler, target: Interned<String>) -> PathBuf {
builder.cargo_out(compiler, Mode::Tool, target).join(".rustdoc-check.stamp")
}