Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #40693

Merged
merged 33 commits into from
Mar 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e2b4824
Removed RustFMT changes
jdhorwitz Mar 8, 2017
6a2ef9a
clean up visuals on error index #40425
jdhorwitz Mar 14, 2017
28626ca
Stabilize pub(restricted)
cramertj Mar 15, 2017
e9c07cf
fix typo in mir TerminatorKind docs
Mar 16, 2017
60c1c96
Make priv in pub hard error for crates using pub(restricted)
cramertj Mar 18, 2017
fc04eaa
Implement ? in catch expressions and add tests
cramertj Feb 28, 2017
1f43731
Add more catch-related CFG and lifetime tests and fix CFG bug
cramertj Mar 14, 2017
c50a6ec
Fix typo in `ptr` doc
DaseinPhaos Mar 20, 2017
17a26ee
Add missing urls in Option enum
GuillaumeGomez Mar 20, 2017
e4628fb
Remove the existing book
steveklabnik Mar 7, 2017
f17965d
Import submodule for the book.
steveklabnik Mar 7, 2017
8573a13
build both editions of the book
steveklabnik Mar 7, 2017
5f2f3d0
build book index
steveklabnik Mar 7, 2017
422330d
Render redirect pages.
steveklabnik Mar 7, 2017
c97b48f
Fix up some issues.
steveklabnik Mar 7, 2017
966e721
fix whitespace
steveklabnik Mar 7, 2017
2330459
skip nostarch directory
steveklabnik Mar 13, 2017
c0e7b16
Update book and reference submodules
steveklabnik Mar 14, 2017
d1d9626
Fix up various links
steveklabnik Mar 15, 2017
4eef581
exempt hbs from linkchecker
steveklabnik Mar 15, 2017
96d3594
fix trailing whitespace
steveklabnik Mar 17, 2017
aa83d71
config.toml.example: nightlies.txt got removed
est31 Mar 20, 2017
1a00c8f
Add missing associated type Item to Iterator
portal-chan Mar 20, 2017
fcc2d25
Rollup merge of #40229 - cramertj:break-to-blocks, r=nikomatsakis
frewsxcv Mar 21, 2017
42cfdc1
Rollup merge of #40312 - jdhorwitz:papercut, r=steveklabnik
frewsxcv Mar 21, 2017
14b5d56
Rollup merge of #40332 - steveklabnik:extract-book, r=alexcrichton
frewsxcv Mar 21, 2017
03235cc
Rollup merge of #40502 - jdhorwitz:master, r=steveklabnik
frewsxcv Mar 21, 2017
17656ab
Rollup merge of #40556 - cramertj:stabilize-pub-restricted, r=petroch…
frewsxcv Mar 21, 2017
2532ad7
Rollup merge of #40576 - dwrensha:mir-terminator-kind-doc-typo, r=nik…
frewsxcv Mar 21, 2017
d0c04fb
Rollup merge of #40667 - DaseinPhaos:patch-4, r=GuillaumeGomez
frewsxcv Mar 21, 2017
bf3f77b
Rollup merge of #40671 - GuillaumeGomez:options-urls, r=frewsxcv
frewsxcv Mar 21, 2017
c6b2110
Rollup merge of #40681 - est31:nightlies_txt_was_removed, r=alexcrichton
frewsxcv Mar 21, 2017
b6240e5
Rollup merge of #40685 - portal-chan:patch-1, r=eddyb
frewsxcv Mar 21, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@
[submodule "reference"]
path = src/doc/reference
url = https://github.com/rust-lang-nursery/reference.git
[submodule "book"]
path = src/doc/book
url = https://github.com/rust-lang/book
10 changes: 10 additions & 0 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,16 @@ pub fn docs(build: &Build, compiler: &Compiler) {
continue
}

// The nostarch directory in the book is for no starch, and so isn't guaranteed to build.
// we don't care if it doesn't build, so skip it.
use std::ffi::OsStr;
let path: &OsStr = p.as_ref();
if let Some(path) = path.to_str() {
if path.contains("nostarch") {
continue;
}
}

println!("doc tests for: {}", p.display());
markdown_test(build, compiler, &p);
}
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@
# for each target triple.
#target = ["x86_64-unknown-linux-gnu"] # defaults to just the build triple

# Instead of downloading the src/nightlies.txt version of Cargo specified, use
# Instead of downloading the src/stage0.txt version of Cargo specified, use
# this Cargo binary instead to build all Rust code
#cargo = "/path/to/bin/cargo"

# Instead of downloading the src/nightlies.txt version of the compiler
# Instead of downloading the src/stage0.txt version of the compiler
# specified, use this rustc binary instead as the stage0 snapshot compiler.
#rustc = "/path/to/bin/rustc"

Expand Down
76 changes: 76 additions & 0 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,82 @@ pub fn rustbook(build: &Build, target: &str, name: &str) {
.arg(out));
}

/// Build the book and associated stuff.
///
/// We need to build:
///
/// * Book (first edition)
/// * Book (second edition)
/// * Index page
/// * Redirect pages
pub fn book(build: &Build, target: &str, name: &str) {
// build book first edition
rustbook(build, target, &format!("{}/first-edition", name));

// build book second edition
rustbook(build, target, &format!("{}/second-edition", name));

// 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();
let path = path.to_str().unwrap();

invoke_rustdoc(build, target, path);
}
}

fn invoke_rustdoc(build: &Build, target: &str, markdown: &str) {
let out = build.doc_out(target);

let compiler = Compiler::new(0, &build.config.build);

let path = build.src.join("src/doc").join(markdown);

let rustdoc = build.rustdoc(&compiler);

let favicon = build.src.join("src/doc/favicon.inc");
let footer = build.src.join("src/doc/footer.inc");

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)
.arg("--markdown-playground-url")
.arg("https://play.rust-lang.org/")
.arg("-o").arg(&out)
.arg(&path)
.arg("--markdown-css")
.arg("rust.css");

build.run(&mut cmd);
}

/// Generates all standalone documentation as compiled by the rustdoc in `stage`
/// for the `target` into `out`.
///
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
.stage(0)
})
.default(build.config.docs)
.run(move |s| doc::rustbook(build, s.target, "book"));
.run(move |s| doc::book(build, s.target, "book"));
rules.doc("doc-nomicon", "src/doc/nomicon")
.dep(move |s| {
s.name("tool-rustbook")
Expand Down
1 change: 1 addition & 0 deletions src/doc/book
Submodule book added at e6d6ca
39 changes: 0 additions & 39 deletions src/doc/book/src/README.md

This file was deleted.

60 changes: 0 additions & 60 deletions src/doc/book/src/SUMMARY.md

This file was deleted.

Loading