rustdoc: Fix inclusion of the new fonts

These fonts were moved into place by rust's makefiles, but rustdoc is widely
used outside of rustc itself. This moves the fonts into the rustdoc binary,
similarly to the other static assets, and writes them to the output location
whenever rustdoc generates documentation.

Closes #13593
Closes #13787
This commit is contained in:
Alex Crichton 2014-05-02 16:03:09 -07:00
parent 3a321b001f
commit 1547caf748
7 changed files with 16 additions and 26 deletions

View File

@ -141,26 +141,6 @@ doc/footer.inc: $(D)/footer.inc | doc/
@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null
doc/FiraSans-Regular.woff: $(D)/FiraSans-Regular.woff | doc/
@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null
doc/FiraSans-Medium.woff: $(D)/FiraSans-Medium.woff | doc/
@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null
doc/Heuristica-Regular.woff: $(D)/Heuristica-Regular.woff | doc/
@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null
doc/Heuristica-Italic.woff: $(D)/Heuristica-Italic.woff | doc/
@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null
doc/Heuristica-Bold.woff: $(D)/Heuristica-Bold.woff | doc/
@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null
# The (english) documentation for each doc item.
define DEF_SHOULD_BUILD_PDF_DOC

View File

@ -362,11 +362,21 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> {
// Add all the static files. These may already exist, but we just
// overwrite them anyway to make sure that they're fresh and up-to-date.
try!(write(cx.dst.join("jquery.js"),
include_str!("static/jquery-2.1.0.min.js")));
try!(write(cx.dst.join("main.js"), include_str!("static/main.js")));
try!(write(cx.dst.join("main.css"), include_str!("static/main.css")));
include_bin!("static/jquery-2.1.0.min.js")));
try!(write(cx.dst.join("main.js"), include_bin!("static/main.js")));
try!(write(cx.dst.join("main.css"), include_bin!("static/main.css")));
try!(write(cx.dst.join("normalize.css"),
include_str!("static/normalize.css")));
include_bin!("static/normalize.css")));
try!(write(cx.dst.join("FiraSans-Regular.woff"),
include_bin!("static/FiraSans-Regular.woff")));
try!(write(cx.dst.join("FiraSans-Medium.woff"),
include_bin!("static/FiraSans-Medium.woff")));
try!(write(cx.dst.join("Heuristica-Regular.woff"),
include_bin!("static/Heuristica-Regular.woff")));
try!(write(cx.dst.join("Heuristica-Italic.woff"),
include_bin!("static/Heuristica-Italic.woff")));
try!(write(cx.dst.join("Heuristica-Bold.woff"),
include_bin!("static/Heuristica-Bold.woff")));
// Update the search index
let dst = cx.dst.join("search-index.js");
@ -415,8 +425,8 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> {
/// Writes the entire contents of a string to a destination, not attempting to
/// catch any errors.
fn write(dst: Path, contents: &str) -> io::IoResult<()> {
File::create(&dst).write(contents.as_bytes())
fn write(dst: Path, contents: &[u8]) -> io::IoResult<()> {
File::create(&dst).write(contents)
}
/// Makes a directory on the filesystem, failing the task if an error occurs and