Skip to content

Commit 3b90551

Browse files
Allow changing rustdoc which builds the book.
1 parent 4e5333c commit 3b90551

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/bootstrap/doc.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use Mode;
2626
use build_helper::up_to_date;
2727

2828
use util::{cp_r, symlink_dir};
29-
use builder::{Builder, RunConfig, ShouldRun, Step};
29+
use builder::{Builder, Compiler, RunConfig, ShouldRun, Step};
3030
use tool::Tool;
3131
use compile;
3232
use cache::{INTERNER, Interned};
@@ -176,6 +176,7 @@ impl Step for RustbookSrc {
176176

177177
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
178178
pub struct TheBook {
179+
compiler: Compiler,
179180
target: Interned<String>,
180181
name: &'static str,
181182
}
@@ -191,6 +192,7 @@ impl Step for TheBook {
191192

192193
fn make_run(run: RunConfig) {
193194
run.builder.ensure(TheBook {
195+
compiler: run.builder.compiler(run.builder.top_stage, run.host),
194196
target: run.target,
195197
name: "book",
196198
});
@@ -223,7 +225,7 @@ impl Step for TheBook {
223225
// build the index page
224226
let index = format!("{}/index.md", name);
225227
println!("Documenting book index ({})", target);
226-
invoke_rustdoc(builder, target, &index);
228+
invoke_rustdoc(builder, self.compiler, target, &index);
227229

228230
// build the redirect pages
229231
println!("Documenting book redirect pages ({})", target);
@@ -232,12 +234,12 @@ impl Step for TheBook {
232234
let path = file.path();
233235
let path = path.to_str().unwrap();
234236

235-
invoke_rustdoc(builder, target, path);
237+
invoke_rustdoc(builder, self.compiler, target, path);
236238
}
237239
}
238240
}
239241

240-
fn invoke_rustdoc(builder: &Builder, target: Interned<String>, markdown: &str) {
242+
fn invoke_rustdoc(builder: &Builder, compiler: Compiler, target: Interned<String>, markdown: &str) {
241243
let build = builder.build;
242244
let out = build.doc_out(target);
243245

@@ -258,7 +260,7 @@ fn invoke_rustdoc(builder: &Builder, target: Interned<String>, markdown: &str) {
258260
t!(t!(File::create(&version_info)).write_all(info.as_bytes()));
259261
}
260262

261-
let mut cmd = builder.rustdoc_cmd(builder.compiler(0, build.build));
263+
let mut cmd = builder.rustdoc_cmd(compiler);
262264

263265
let out = out.join("book");
264266

@@ -279,6 +281,7 @@ fn invoke_rustdoc(builder: &Builder, target: Interned<String>, markdown: &str) {
279281

280282
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
281283
pub struct Standalone {
284+
compiler: Compiler,
282285
target: Interned<String>,
283286
}
284287

@@ -293,6 +296,7 @@ impl Step for Standalone {
293296

294297
fn make_run(run: RunConfig) {
295298
run.builder.ensure(Standalone {
299+
compiler: run.builder.compiler(run.builder.top_stage, run.host),
296300
target: run.target,
297301
});
298302
}
@@ -308,12 +312,11 @@ impl Step for Standalone {
308312
fn run(self, builder: &Builder) {
309313
let build = builder.build;
310314
let target = self.target;
315+
let compiler = self.compiler;
311316
println!("Documenting standalone ({})", target);
312317
let out = build.doc_out(target);
313318
t!(fs::create_dir_all(&out));
314319

315-
let compiler = builder.compiler(0, build.build);
316-
317320
let favicon = build.src.join("src/doc/favicon.inc");
318321
let footer = build.src.join("src/doc/footer.inc");
319322
let full_toc = build.src.join("src/doc/full-toc.inc");
@@ -405,6 +408,7 @@ impl Step for Std {
405408
let out = build.doc_out(target);
406409
t!(fs::create_dir_all(&out));
407410
let compiler = builder.compiler(stage, build.build);
411+
let rustdoc = builder.rustdoc(compiler);
408412
let compiler = if build.force_use_stage1(compiler, target) {
409413
builder.compiler(1, compiler.host)
410414
} else {
@@ -414,7 +418,6 @@ impl Step for Std {
414418
builder.ensure(compile::Std { compiler, target });
415419
let out_dir = build.stage_out(compiler, Mode::Libstd)
416420
.join(target).join("doc");
417-
let rustdoc = builder.rustdoc(compiler);
418421

419422
// Here what we're doing is creating a *symlink* (directory junction on
420423
// Windows) to the final output location. This is not done as an
@@ -490,6 +493,7 @@ impl Step for Test {
490493
let out = build.doc_out(target);
491494
t!(fs::create_dir_all(&out));
492495
let compiler = builder.compiler(stage, build.build);
496+
let rustdoc = builder.rustdoc(compiler);
493497
let compiler = if build.force_use_stage1(compiler, target) {
494498
builder.compiler(1, compiler.host)
495499
} else {
@@ -502,7 +506,6 @@ impl Step for Test {
502506
builder.ensure(compile::Test { compiler, target });
503507
let out_dir = build.stage_out(compiler, Mode::Libtest)
504508
.join(target).join("doc");
505-
let rustdoc = builder.rustdoc(compiler);
506509

507510
// See docs in std above for why we symlink
508511
let my_out = build.crate_doc_out(target);
@@ -551,6 +554,7 @@ impl Step for Rustc {
551554
let out = build.doc_out(target);
552555
t!(fs::create_dir_all(&out));
553556
let compiler = builder.compiler(stage, build.build);
557+
let rustdoc = builder.rustdoc(compiler);
554558
let compiler = if build.force_use_stage1(compiler, target) {
555559
builder.compiler(1, compiler.host)
556560
} else {
@@ -563,7 +567,6 @@ impl Step for Rustc {
563567
builder.ensure(compile::Rustc { compiler, target });
564568
let out_dir = build.stage_out(compiler, Mode::Librustc)
565569
.join(target).join("doc");
566-
let rustdoc = builder.rustdoc(compiler);
567570

568571
// See docs in std above for why we symlink
569572
let my_out = build.crate_doc_out(target);

0 commit comments

Comments
 (0)