diff --git a/src/bootstrap/build/dist.rs b/src/bootstrap/build/dist.rs index 855528ea440..6ae652bd66d 100644 --- a/src/bootstrap/build/dist.rs +++ b/src/bootstrap/build/dist.rs @@ -52,7 +52,7 @@ pub fn docs(build: &Build, stage: u32, host: &str) { .arg(format!("--image-dir={}", sanitize_sh(&image))) .arg(format!("--work-dir={}", sanitize_sh(&tmpdir(build)))) .arg(format!("--output-dir={}", sanitize_sh(&distdir(build)))) - .arg(format!("--package-name={}", name)) + .arg(format!("--package-name={}-{}", name, host)) .arg("--component-name=rust-docs") .arg("--legacy-manifest-dirs=rustlib,cargo") .arg("--bulk-dirs=share/doc/rust/html"); @@ -61,9 +61,11 @@ pub fn docs(build: &Build, stage: u32, host: &str) { // As part of this step, *also* copy the docs directory to a directory which // buildbot typically uploads. - let dst = distdir(build).join("doc").join(&build.package_vers); - t!(fs::create_dir_all(&dst)); - cp_r(&src, &dst); + if host == build.config.build { + let dst = distdir(build).join("doc").join(&build.package_vers); + t!(fs::create_dir_all(&dst)); + cp_r(&src, &dst); + } } pub fn mingw(build: &Build, host: &str) { diff --git a/src/bootstrap/build/doc.rs b/src/bootstrap/build/doc.rs index 50c0c56807b..5782dd5ec28 100644 --- a/src/bootstrap/build/doc.rs +++ b/src/bootstrap/build/doc.rs @@ -16,18 +16,18 @@ use std::process::Command; use build::{Build, Compiler, Mode}; use build::util::{up_to_date, cp_r}; -pub fn rustbook(build: &Build, stage: u32, host: &str, name: &str, out: &Path) { +pub fn rustbook(build: &Build, stage: u32, target: &str, name: &str, out: &Path) { t!(fs::create_dir_all(out)); let out = out.join(name); - let compiler = Compiler::new(stage, host); + let compiler = Compiler::new(stage, &build.config.build); let src = build.src.join("src/doc").join(name); let index = out.join("index.html"); let rustbook = build.tool(&compiler, "rustbook"); if up_to_date(&src, &index) && up_to_date(&rustbook, &index) { return } - println!("Rustbook stage{} ({}) - {}", stage, host, name); + println!("Rustbook stage{} ({}) - {}", stage, target, name); let _ = fs::remove_dir_all(&out); build.run(build.tool_cmd(&compiler, "rustbook") .arg("build") @@ -35,11 +35,11 @@ pub fn rustbook(build: &Build, stage: u32, host: &str, name: &str, out: &Path) { .arg(out)); } -pub fn standalone(build: &Build, stage: u32, host: &str, out: &Path) { - println!("Documenting stage{} standalone ({})", stage, host); +pub fn standalone(build: &Build, stage: u32, target: &str, out: &Path) { + println!("Documenting stage{} standalone ({})", stage, target); t!(fs::create_dir_all(out)); - let compiler = Compiler::new(stage, host); + let compiler = Compiler::new(stage, &build.config.build); let favicon = build.src.join("src/doc/favicon.inc"); let footer = build.src.join("src/doc/footer.inc"); @@ -105,16 +105,17 @@ pub fn standalone(build: &Build, stage: u32, host: &str, out: &Path) { } } -pub fn std(build: &Build, stage: u32, host: &str, out: &Path) { - println!("Documenting stage{} std ({})", stage, host); - let compiler = Compiler::new(stage, host); +pub fn std(build: &Build, stage: u32, target: &str, out: &Path) { + println!("Documenting stage{} std ({})", stage, target); + t!(fs::create_dir_all(out)); + let compiler = Compiler::new(stage, &build.config.build); let out_dir = build.stage_out(&compiler, Mode::Libstd) - .join(host).join("doc"); + .join(target).join("doc"); let rustdoc = build.rustdoc(&compiler); build.clear_if_dirty(&out_dir, &rustdoc); - let mut cargo = build.cargo(&compiler, Mode::Libstd, host, "doc"); + let mut cargo = build.cargo(&compiler, Mode::Libstd, target, "doc"); cargo.arg("--manifest-path") .arg(build.src.join("src/rustc/std_shim/Cargo.toml")) .arg("--features").arg(build.std_features()); @@ -122,32 +123,32 @@ pub fn std(build: &Build, stage: u32, host: &str, out: &Path) { cp_r(&out_dir, out) } -pub fn test(build: &Build, stage: u32, host: &str, out: &Path) { - println!("Documenting stage{} test ({})", stage, host); - let compiler = Compiler::new(stage, host); +pub fn test(build: &Build, stage: u32, target: &str, out: &Path) { + println!("Documenting stage{} test ({})", stage, target); + let compiler = Compiler::new(stage, &build.config.build); let out_dir = build.stage_out(&compiler, Mode::Libtest) - .join(host).join("doc"); + .join(target).join("doc"); let rustdoc = build.rustdoc(&compiler); build.clear_if_dirty(&out_dir, &rustdoc); - let mut cargo = build.cargo(&compiler, Mode::Libtest, host, "doc"); + let mut cargo = build.cargo(&compiler, Mode::Libtest, target, "doc"); cargo.arg("--manifest-path") .arg(build.src.join("src/rustc/test_shim/Cargo.toml")); build.run(&mut cargo); cp_r(&out_dir, out) } -pub fn rustc(build: &Build, stage: u32, host: &str, out: &Path) { - println!("Documenting stage{} compiler ({})", stage, host); - let compiler = Compiler::new(stage, host); +pub fn rustc(build: &Build, stage: u32, target: &str, out: &Path) { + println!("Documenting stage{} compiler ({})", stage, target); + let compiler = Compiler::new(stage, &build.config.build); let out_dir = build.stage_out(&compiler, Mode::Librustc) - .join(host).join("doc"); + .join(target).join("doc"); let rustdoc = build.rustdoc(&compiler); if !up_to_date(&rustdoc, &out_dir.join("rustc/index.html")) { t!(fs::remove_dir_all(&out_dir)); } - let mut cargo = build.cargo(&compiler, Mode::Librustc, host, "doc"); + let mut cargo = build.cargo(&compiler, Mode::Librustc, target, "doc"); cargo.arg("--manifest-path") .arg(build.src.join("src/rustc/Cargo.toml")) .arg("--features").arg(build.rustc_features()); @@ -155,9 +156,10 @@ pub fn rustc(build: &Build, stage: u32, host: &str, out: &Path) { cp_r(&out_dir, out) } -pub fn error_index(build: &Build, stage: u32, host: &str, out: &Path) { - println!("Documenting stage{} error index ({})", stage, host); - let compiler = Compiler::new(stage, host); +pub fn error_index(build: &Build, stage: u32, target: &str, out: &Path) { + println!("Documenting stage{} error index ({})", stage, target); + t!(fs::create_dir_all(out)); + let compiler = Compiler::new(stage, &build.config.build); let mut index = build.tool_cmd(&compiler, "error_index_generator"); index.arg("html"); index.arg(out.join("error-index.html")); diff --git a/src/bootstrap/build/step.rs b/src/bootstrap/build/step.rs index 4e3aacd3720..a185a65975f 100644 --- a/src/bootstrap/build/step.rs +++ b/src/bootstrap/build/step.rs @@ -274,22 +274,28 @@ impl<'a> Step<'a> { vec![self.llvm(()).target(&build.config.build)] } Source::Llvm { _dummy } => Vec::new(), + + // Note that all doc targets depend on artifacts from the build + // architecture, not the target (which is where we're generating + // docs into). Source::DocStd { stage } => { - vec![self.libstd(self.compiler(stage))] + let compiler = self.target(&build.config.build).compiler(stage); + vec![self.libstd(compiler)] } Source::DocTest { stage } => { - vec![self.libtest(self.compiler(stage))] + let compiler = self.target(&build.config.build).compiler(stage); + vec![self.libtest(compiler)] } Source::DocBook { stage } | Source::DocNomicon { stage } | Source::DocStyle { stage } => { - vec![self.tool_rustbook(stage)] + vec![self.target(&build.config.build).tool_rustbook(stage)] } Source::DocErrorIndex { stage } => { - vec![self.tool_error_index(stage)] + vec![self.target(&build.config.build).tool_error_index(stage)] } Source::DocStandalone { stage } => { - vec![self.rustc(stage)] + vec![self.target(&build.config.build).rustc(stage)] } Source::DocRustc { stage } => { vec![self.doc_test(stage)] @@ -333,7 +339,6 @@ impl<'a> Step<'a> { Source::Dist { stage } => { let mut base = Vec::new(); - base.push(self.dist_docs(stage)); for host in build.config.host.iter() { let host = self.target(host); @@ -344,7 +349,9 @@ impl<'a> Step<'a> { let compiler = self.compiler(stage); for target in build.config.target.iter() { - base.push(self.target(target).dist_std(compiler)); + let target = self.target(target); + base.push(target.dist_docs(stage)); + base.push(target.dist_std(compiler)); } } return base