Skip to content

Commit 26e881d

Browse files
committed
Auto merge of #45998 - ollie27:doc_book_css, r=steveklabnik
Fix broken CSS for book redirect pages rust.css has to be next to the font files so we shouldn't copy it for only the book redirect pages, instead just use the version that is already there. This also removes the duplicate code creating version_info.html. Fixes: #45974
2 parents 41e03c3 + 9833fd3 commit 26e881d

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

src/bootstrap/doc.rs

+11-16
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,12 @@ impl Step for TheBook {
251251
///
252252
/// * Book (first edition)
253253
/// * Book (second edition)
254+
/// * Version info and CSS
254255
/// * Index page
255256
/// * Redirect pages
256257
fn run(self, builder: &Builder) {
257258
let build = builder.build;
259+
let compiler = self.compiler;
258260
let target = self.target;
259261
let name = self.name;
260262
// build book first edition
@@ -269,10 +271,16 @@ impl Step for TheBook {
269271
name: INTERNER.intern_string(format!("{}/second-edition", name)),
270272
});
271273

274+
// build the version info page and CSS
275+
builder.ensure(Standalone {
276+
compiler,
277+
target,
278+
});
279+
272280
// build the index page
273281
let index = format!("{}/index.md", name);
274282
println!("Documenting book index ({})", target);
275-
invoke_rustdoc(builder, self.compiler, target, &index);
283+
invoke_rustdoc(builder, compiler, target, &index);
276284

277285
// build the redirect pages
278286
println!("Documenting book redirect pages ({})", target);
@@ -281,7 +289,7 @@ impl Step for TheBook {
281289
let path = file.path();
282290
let path = path.to_str().unwrap();
283291

284-
invoke_rustdoc(builder, self.compiler, target, path);
292+
invoke_rustdoc(builder, compiler, target, path);
285293
}
286294
}
287295
}
@@ -294,25 +302,12 @@ fn invoke_rustdoc(builder: &Builder, compiler: Compiler, target: Interned<String
294302

295303
let favicon = build.src.join("src/doc/favicon.inc");
296304
let footer = build.src.join("src/doc/footer.inc");
297-
298-
let version_input = build.src.join("src/doc/version_info.html.template");
299305
let version_info = out.join("version_info.html");
300306

301-
if !up_to_date(&version_input, &version_info) {
302-
let mut info = String::new();
303-
t!(t!(File::open(&version_input)).read_to_string(&mut info));
304-
let info = info.replace("VERSION", &build.rust_release())
305-
.replace("SHORT_HASH", build.rust_info.sha_short().unwrap_or(""))
306-
.replace("STAMP", build.rust_info.sha().unwrap_or(""));
307-
t!(t!(File::create(&version_info)).write_all(info.as_bytes()));
308-
}
309-
310307
let mut cmd = builder.rustdoc_cmd(compiler.host);
311308

312309
let out = out.join("book");
313310

314-
t!(fs::copy(build.src.join("src/doc/rust.css"), out.join("rust.css")));
315-
316311
cmd.arg("--html-after-content").arg(&footer)
317312
.arg("--html-before-content").arg(&version_info)
318313
.arg("--html-in-header").arg(&favicon)
@@ -321,7 +316,7 @@ fn invoke_rustdoc(builder: &Builder, compiler: Compiler, target: Interned<String
321316
.arg("-o").arg(&out)
322317
.arg(&path)
323318
.arg("--markdown-css")
324-
.arg("rust.css");
319+
.arg("../rust.css");
325320

326321
build.run(&mut cmd);
327322
}

0 commit comments

Comments
 (0)