Build rustdoc only at the top stage

This commit is contained in:
Mark Simulacrum
2017-08-04 16:13:01 -06:00
parent ad4acbaadf
commit facf5a91c4
5 changed files with 21 additions and 25 deletions

View File

@@ -407,22 +407,19 @@ impl<'a> Builder<'a> {
} }
} }
pub fn rustdoc(&self, compiler: Compiler) -> PathBuf { pub fn rustdoc(&self, host: Interned<String>) -> PathBuf {
self.ensure(tool::Rustdoc { target_compiler: compiler }) self.ensure(tool::Rustdoc { host })
} }
pub fn rustdoc_cmd(&self, compiler: Compiler) -> Command { pub fn rustdoc_cmd(&self, host: Interned<String>) -> Command {
let mut cmd = Command::new(&self.out.join("bootstrap/debug/rustdoc")); let mut cmd = Command::new(&self.out.join("bootstrap/debug/rustdoc"));
let compiler = self.compiler(self.top_stage, host);
cmd cmd
.env("RUSTC_STAGE", compiler.stage.to_string()) .env("RUSTC_STAGE", compiler.stage.to_string())
.env("RUSTC_SYSROOT", if compiler.is_snapshot(&self.build) { .env("RUSTC_SYSROOT", self.sysroot(compiler))
INTERNER.intern_path(self.build.rustc_snapshot_libdir()) .env("RUSTC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
} else {
self.sysroot(compiler)
})
.env("RUSTC_LIBDIR", self.rustc_libdir(compiler))
.env("CFG_RELEASE_CHANNEL", &self.build.config.channel) .env("CFG_RELEASE_CHANNEL", &self.build.config.channel)
.env("RUSTDOC_REAL", self.rustdoc(compiler)); .env("RUSTDOC_REAL", self.rustdoc(host));
cmd cmd
} }
@@ -476,7 +473,7 @@ impl<'a> Builder<'a> {
.env("RUSTC_RPATH", self.config.rust_rpath.to_string()) .env("RUSTC_RPATH", self.config.rust_rpath.to_string())
.env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc")) .env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc"))
.env("RUSTDOC_REAL", if cmd == "doc" || cmd == "test" { .env("RUSTDOC_REAL", if cmd == "doc" || cmd == "test" {
self.rustdoc(compiler) self.rustdoc(compiler.host)
} else { } else {
PathBuf::from("/path/to/nowhere/rustdoc/not/required") PathBuf::from("/path/to/nowhere/rustdoc/not/required")
}) })

View File

@@ -164,7 +164,7 @@ impl Step for Cargotest {
try_run(build, cmd.arg(&build.initial_cargo) try_run(build, cmd.arg(&build.initial_cargo)
.arg(&out_dir) .arg(&out_dir)
.env("RUSTC", builder.rustc(compiler)) .env("RUSTC", builder.rustc(compiler))
.env("RUSTDOC", builder.rustdoc(compiler))); .env("RUSTDOC", builder.rustdoc(compiler.host)));
} }
} }
@@ -565,7 +565,7 @@ impl Step for Compiletest {
// Avoid depending on rustdoc when we don't need it. // Avoid depending on rustdoc when we don't need it.
if mode == "rustdoc" || mode == "run-make" { if mode == "rustdoc" || mode == "run-make" {
cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler)); cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler.host));
} }
cmd.arg("--src-base").arg(build.src.join("src/test").join(suite)); cmd.arg("--src-base").arg(build.src.join("src/test").join(suite));
@@ -814,7 +814,7 @@ fn markdown_test(builder: &Builder, compiler: Compiler, markdown: &Path) {
} }
println!("doc tests for: {}", markdown.display()); println!("doc tests for: {}", markdown.display());
let mut cmd = builder.rustdoc_cmd(compiler); let mut cmd = builder.rustdoc_cmd(compiler.host);
build.add_rust_test_threads(&mut cmd); build.add_rust_test_threads(&mut cmd);
cmd.arg("--test"); cmd.arg("--test");
cmd.arg(markdown); cmd.arg(markdown);

View File

@@ -413,8 +413,7 @@ impl Step for Rustc {
t!(fs::create_dir_all(image.join("bin"))); t!(fs::create_dir_all(image.join("bin")));
cp_r(&src.join("bin"), &image.join("bin")); cp_r(&src.join("bin"), &image.join("bin"));
install(&builder.ensure(tool::Rustdoc { target_compiler: compiler }), install(&builder.rustdoc(compiler.host), &image.join("bin"), 0o755);
&image.join("bin"), 0o755);
// Copy runtime DLLs needed by the compiler // Copy runtime DLLs needed by the compiler
if libdir != "bin" { if libdir != "bin" {

View File

@@ -260,7 +260,7 @@ fn invoke_rustdoc(builder: &Builder, compiler: Compiler, target: Interned<String
t!(t!(File::create(&version_info)).write_all(info.as_bytes())); t!(t!(File::create(&version_info)).write_all(info.as_bytes()));
} }
let mut cmd = builder.rustdoc_cmd(compiler); let mut cmd = builder.rustdoc_cmd(compiler.host);
let out = out.join("book"); let out = out.join("book");
@@ -343,7 +343,7 @@ impl Step for Standalone {
} }
let html = out.join(filename).with_extension("html"); let html = out.join(filename).with_extension("html");
let rustdoc = builder.rustdoc(compiler); let rustdoc = builder.rustdoc(compiler.host);
if up_to_date(&path, &html) && if up_to_date(&path, &html) &&
up_to_date(&footer, &html) && up_to_date(&footer, &html) &&
up_to_date(&favicon, &html) && up_to_date(&favicon, &html) &&
@@ -353,7 +353,7 @@ impl Step for Standalone {
continue continue
} }
let mut cmd = builder.rustdoc_cmd(compiler); let mut cmd = builder.rustdoc_cmd(compiler.host);
cmd.arg("--html-after-content").arg(&footer) cmd.arg("--html-after-content").arg(&footer)
.arg("--html-before-content").arg(&version_info) .arg("--html-before-content").arg(&version_info)
.arg("--html-in-header").arg(&favicon) .arg("--html-in-header").arg(&favicon)
@@ -408,7 +408,7 @@ impl Step for Std {
let out = build.doc_out(target); let out = build.doc_out(target);
t!(fs::create_dir_all(&out)); t!(fs::create_dir_all(&out));
let compiler = builder.compiler(stage, build.build); let compiler = builder.compiler(stage, build.build);
let rustdoc = builder.rustdoc(compiler); let rustdoc = builder.rustdoc(compiler.host);
let compiler = if build.force_use_stage1(compiler, target) { let compiler = if build.force_use_stage1(compiler, target) {
builder.compiler(1, compiler.host) builder.compiler(1, compiler.host)
} else { } else {
@@ -493,7 +493,7 @@ impl Step for Test {
let out = build.doc_out(target); let out = build.doc_out(target);
t!(fs::create_dir_all(&out)); t!(fs::create_dir_all(&out));
let compiler = builder.compiler(stage, build.build); let compiler = builder.compiler(stage, build.build);
let rustdoc = builder.rustdoc(compiler); let rustdoc = builder.rustdoc(compiler.host);
let compiler = if build.force_use_stage1(compiler, target) { let compiler = if build.force_use_stage1(compiler, target) {
builder.compiler(1, compiler.host) builder.compiler(1, compiler.host)
} else { } else {
@@ -554,7 +554,7 @@ impl Step for Rustc {
let out = build.doc_out(target); let out = build.doc_out(target);
t!(fs::create_dir_all(&out)); t!(fs::create_dir_all(&out));
let compiler = builder.compiler(stage, build.build); let compiler = builder.compiler(stage, build.build);
let rustdoc = builder.rustdoc(compiler); let rustdoc = builder.rustdoc(compiler.host);
let compiler = if build.force_use_stage1(compiler, target) { let compiler = if build.force_use_stage1(compiler, target) {
builder.compiler(1, compiler.host) builder.compiler(1, compiler.host)
} else { } else {

View File

@@ -236,7 +236,7 @@ impl Step for RemoteTestServer {
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Rustdoc { pub struct Rustdoc {
pub target_compiler: Compiler, pub host: Interned<String>,
} }
impl Step for Rustdoc { impl Step for Rustdoc {
@@ -250,13 +250,13 @@ impl Step for Rustdoc {
fn make_run(run: RunConfig) { fn make_run(run: RunConfig) {
run.builder.ensure(Rustdoc { run.builder.ensure(Rustdoc {
target_compiler: run.builder.compiler(run.builder.top_stage, run.host), host: run.host,
}); });
} }
fn run(self, builder: &Builder) -> PathBuf { fn run(self, builder: &Builder) -> PathBuf {
let build = builder.build; let build = builder.build;
let target_compiler = self.target_compiler; let target_compiler = builder.compiler(builder.top_stage, self.host);
let target = target_compiler.host; let target = target_compiler.host;
let build_compiler = if target_compiler.stage == 0 { let build_compiler = if target_compiler.stage == 0 {
builder.compiler(0, builder.build.build) builder.compiler(0, builder.build.build)