Skip to content

Commit 11c44aa

Browse files
committed
Fix up some issues.
Becuase I had run a `x.py doc` before doing this work, I had accidentally relied on some files existing in places that they didn't need to be.
1 parent 73b46a0 commit 11c44aa

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/bootstrap/doc.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ pub fn book(build: &Build, target: &str, name: &str) {
7070

7171
// build the index page
7272
let index = format!("{}/index.md", name);
73+
println!("Documenting book index ({})", target);
7374
invoke_rustdoc(build, target, &index);
7475

7576
// build the redirect pages
77+
println!("Documenting book redirect pages ({})", target);
7678
for file in t!(fs::read_dir(build.src.join("src/doc/book/redirects"))) {
7779
let file = t!(file);
7880
let path = file.path();
@@ -93,16 +95,27 @@ fn invoke_rustdoc(build: &Build, target: &str, markdown: &str) {
9395

9496
let favicon = build.src.join("src/doc/favicon.inc");
9597
let footer = build.src.join("src/doc/footer.inc");
96-
t!(fs::copy(build.src.join("src/doc/rust.css"), out.join("rust.css")));
9798

99+
let version_input = build.src.join("src/doc/version_info.html.template");
98100
let version_info = out.join("version_info.html");
99101

102+
if !up_to_date(&version_input, &version_info) {
103+
let mut info = String::new();
104+
t!(t!(File::open(&version_input)).read_to_string(&mut info));
105+
let info = info.replace("VERSION", &build.rust_release())
106+
.replace("SHORT_HASH", build.rust_info.sha_short().unwrap_or(""))
107+
.replace("STAMP", build.rust_info.sha().unwrap_or(""));
108+
t!(t!(File::create(&version_info)).write_all(info.as_bytes()));
109+
}
110+
100111
let mut cmd = Command::new(&rustdoc);
101112

102113
build.add_rustc_lib_path(&compiler, &mut cmd);
103114

104115
let out = out.join("book");
105116

117+
t!(fs::copy(build.src.join("src/doc/rust.css"), out.join("rust.css")));
118+
106119
cmd.arg("--html-after-content").arg(&footer)
107120
.arg("--html-before-content").arg(&version_info)
108121
.arg("--html-in-header").arg(&favicon)

0 commit comments

Comments
 (0)