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.
This commit is contained in:
steveklabnik 2017-03-07 16:29:05 -05:00
parent 422330df28
commit c97b48f261

View File

@ -70,9 +70,11 @@ pub fn book(build: &Build, target: &str, name: &str) {
// build the index page
let index = format!("{}/index.md", name);
println!("Documenting book index ({})", target);
invoke_rustdoc(build, target, &index);
// build the redirect pages
println!("Documenting book redirect pages ({})", target);
for file in t!(fs::read_dir(build.src.join("src/doc/book/redirects"))) {
let file = t!(file);
let path = file.path();
@ -93,16 +95,27 @@ fn invoke_rustdoc(build: &Build, target: &str, markdown: &str) {
let favicon = build.src.join("src/doc/favicon.inc");
let footer = build.src.join("src/doc/footer.inc");
t!(fs::copy(build.src.join("src/doc/rust.css"), out.join("rust.css")));
let version_input = build.src.join("src/doc/version_info.html.template");
let version_info = out.join("version_info.html");
if !up_to_date(&version_input, &version_info) {
let mut info = String::new();
t!(t!(File::open(&version_input)).read_to_string(&mut info));
let info = info.replace("VERSION", &build.rust_release())
.replace("SHORT_HASH", build.rust_info.sha_short().unwrap_or(""))
.replace("STAMP", build.rust_info.sha().unwrap_or(""));
t!(t!(File::create(&version_info)).write_all(info.as_bytes()));
}
let mut cmd = Command::new(&rustdoc);
build.add_rustc_lib_path(&compiler, &mut cmd);
let out = out.join("book");
t!(fs::copy(build.src.join("src/doc/rust.css"), out.join("rust.css")));
cmd.arg("--html-after-content").arg(&footer)
.arg("--html-before-content").arg(&version_info)
.arg("--html-in-header").arg(&favicon)