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

Update mdbook, cargo, books #62733

Merged
merged 1 commit into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
293 changes: 47 additions & 246 deletions Cargo.lock

Large diffs are not rendered by default.

38 changes: 9 additions & 29 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::cache::{INTERNER, Interned};
use crate::config::Config;

macro_rules! book {
($($name:ident, $path:expr, $book_name:expr, $book_ver:expr;)+) => {
($($name:ident, $path:expr, $book_name:expr;)+) => {
$(
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct $name {
Expand All @@ -49,7 +49,6 @@ macro_rules! book {
builder.ensure(RustbookSrc {
target: self.target,
name: INTERNER.intern_str($book_name),
version: $book_ver,
src: doc_src(builder),
})
}
Expand All @@ -61,21 +60,15 @@ macro_rules! book {
// NOTE: When adding a book here, make sure to ALSO build the book by
// adding a build step in `src/bootstrap/builder.rs`!
book!(
EditionGuide, "src/doc/edition-guide", "edition-guide", RustbookVersion::Latest;
EmbeddedBook, "src/doc/embedded-book", "embedded-book", RustbookVersion::Latest;
Nomicon, "src/doc/nomicon", "nomicon", RustbookVersion::Latest;
Reference, "src/doc/reference", "reference", RustbookVersion::MdBook1;
RustByExample, "src/doc/rust-by-example", "rust-by-example", RustbookVersion::Latest;
RustcBook, "src/doc/rustc", "rustc", RustbookVersion::MdBook1;
RustdocBook, "src/doc/rustdoc", "rustdoc", RustbookVersion::Latest;
EditionGuide, "src/doc/edition-guide", "edition-guide";
EmbeddedBook, "src/doc/embedded-book", "embedded-book";
Nomicon, "src/doc/nomicon", "nomicon";
Reference, "src/doc/reference", "reference";
RustByExample, "src/doc/rust-by-example", "rust-by-example";
RustcBook, "src/doc/rustc", "rustc";
RustdocBook, "src/doc/rustdoc", "rustdoc";
);

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
enum RustbookVersion {
MdBook1,
Latest,
}

fn doc_src(builder: &Builder<'_>) -> Interned<PathBuf> {
INTERNER.intern_path(builder.src.join("src/doc"))
}
Expand Down Expand Up @@ -108,7 +101,6 @@ impl Step for UnstableBook {
target: self.target,
name: INTERNER.intern_str("unstable-book"),
src: builder.md_doc_out(self.target),
version: RustbookVersion::Latest,
})
}
}
Expand Down Expand Up @@ -162,7 +154,6 @@ struct RustbookSrc {
target: Interned<String>,
name: Interned<String>,
src: Interned<PathBuf>,
version: RustbookVersion,
}

impl Step for RustbookSrc {
Expand Down Expand Up @@ -194,18 +185,11 @@ impl Step for RustbookSrc {
builder.info(&format!("Rustbook ({}) - {}", target, name));
let _ = fs::remove_dir_all(&out);

let vers = match self.version {
RustbookVersion::MdBook1 => "1",
RustbookVersion::Latest => "3",
};

builder.run(rustbook_cmd
.arg("build")
.arg(&src)
.arg("-d")
.arg(out)
.arg("-m")
.arg(vers));
.arg(out));
}
}

Expand Down Expand Up @@ -251,7 +235,6 @@ impl Step for TheBook {
builder.ensure(RustbookSrc {
target,
name: INTERNER.intern_string(name.to_string()),
version: RustbookVersion::Latest,
src: doc_src(builder),
});

Expand All @@ -261,23 +244,20 @@ impl Step for TheBook {
builder.ensure(RustbookSrc {
target,
name: INTERNER.intern_string(source_name),
version: RustbookVersion::Latest,
src: doc_src(builder),
});

let source_name = format!("{}/second-edition", name);
builder.ensure(RustbookSrc {
target,
name: INTERNER.intern_string(source_name),
version: RustbookVersion::Latest,
src: doc_src(builder),
});

let source_name = format!("{}/2018-edition", name);
builder.ensure(RustbookSrc {
target,
name: INTERNER.intern_string(source_name),
version: RustbookVersion::Latest,
src: doc_src(builder),
});

Expand Down
2 changes: 1 addition & 1 deletion src/doc/edition-guide
2 changes: 1 addition & 1 deletion src/doc/embedded-book
2 changes: 1 addition & 1 deletion src/doc/nomicon
2 changes: 1 addition & 1 deletion src/doc/reference
8 changes: 4 additions & 4 deletions src/doc/rustc/src/codegen-options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@ This flag allows for creating instrumented binaries that will collect
profiling data for use with profile-guided optimization (PGO). The flag takes
an optional argument which is the path to a directory into which the
instrumented binary will emit the collected data. See the chapter on
[profile-guided optimization](profile-guided-optimization.html) for more
information.
[profile-guided optimization] for more information.

## profile-use

This flag specifies the profiling data file to be used for profile-guided
optimization (PGO). The flag takes a mandatory argument which is the path
to a valid `.profdata` file. See the chapter on
[profile-guided optimization](profile-guided-optimization.html) for more
information.
[profile-guided optimization] for more information.

[profile-guided optimization]: ../profile-guided-optimization.md
18 changes: 9 additions & 9 deletions src/doc/rustc/src/command-line-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ of print values are:

## `-g`: include debug information

A synonym for `-C debuginfo=2`, for more see [here](codegen-options/index.html#debuginfo).
A synonym for `-C debuginfo=2`, for more see [here](codegen-options/index.md#debuginfo).

## `-O`: optimize your code

A synonym for `-C opt-level=2`, for more see [here](codegen-options/index.html#opt-level).
A synonym for `-C opt-level=2`, for more see [here](codegen-options/index.md#opt-level).

## `-o`: filename of the output

Expand All @@ -188,23 +188,23 @@ and instead produce a test harness.

## `--target`: select a target triple to build

This controls which [target](targets/index.html) to produce.
This controls which [target](targets/index.md) to produce.

## `-W`: set lint warnings

This flag will set which lints should be set to the [warn level](lints/levels.html#warn).
This flag will set which lints should be set to the [warn level](lints/levels.md#warn).

## `-A`: set lint allowed

This flag will set which lints should be set to the [allow level](lints/levels.html#allow).
This flag will set which lints should be set to the [allow level](lints/levels.md#allow).

## `-D`: set lint denied

This flag will set which lints should be set to the [deny level](lints/levels.html#deny).
This flag will set which lints should be set to the [deny level](lints/levels.md#deny).

## `-F`: set lint forbidden

This flag will set which lints should be set to the [forbid level](lints/levels.html#forbid).
This flag will set which lints should be set to the [forbid level](lints/levels.md#forbid).

## `-Z`: set unstable options

Expand All @@ -215,11 +215,11 @@ run: `rustc -Z help`.

## `--cap-lints`: set the most restrictive lint level

This flag lets you 'cap' lints, for more, [see here](lints/levels.html#capping-lints).
This flag lets you 'cap' lints, for more, [see here](lints/levels.md#capping-lints).

## `-C`/`--codegen`: code generation options

This flag will allow you to set [codegen options](codegen-options/index.html).
This flag will allow you to set [codegen options](codegen-options/index.md).

## `-V`/`--version`: print a version

Expand Down
2 changes: 1 addition & 1 deletion src/tools/cargo
Submodule cargo updated 99 files
+1 −1 .travis.yml
+1 −1 CHANGELOG.md
+1 −2 crates/resolver-tests/tests/resolve.rs
+1 −1 src/bin/cargo/cli.rs
+3 −2 src/bin/cargo/commands/install.rs
+1 −2 src/bin/cargo/commands/metadata.rs
+24 −20 src/cargo/core/compiler/context/compilation_files.rs
+0 −6 src/cargo/core/compiler/context/unit_dependencies.rs
+17 −38 src/cargo/core/compiler/fingerprint.rs
+1 −2 src/cargo/core/package.rs
+4 −6 src/cargo/core/registry.rs
+35 −2 src/cargo/core/resolver/context.rs
+5 −11 src/cargo/core/resolver/encode.rs
+8 −3 src/cargo/core/resolver/mod.rs
+4 −1 src/cargo/core/shell.rs
+4 −0 src/cargo/ops/cargo_new.rs
+1 −1 src/cargo/ops/cargo_package.rs
+1 −2 src/cargo/ops/lockfile.rs
+2 −4 src/cargo/ops/registry.rs
+1 −2 src/cargo/sources/directory.rs
+3 −4 src/cargo/util/command_prelude.rs
+1 −2 src/cargo/util/diagnostic_server.rs
+1 −1 src/cargo/util/toml/mod.rs
+1 −1 src/cargo/util/workspace.rs
+1 −1 src/doc/README.md
+5 −4 src/doc/asciidoc-extension.rb
+4 −0 src/doc/book.toml
+12 −12 src/doc/man/generated/cargo-bench.html
+11 −11 src/doc/man/generated/cargo-build.html
+11 −11 src/doc/man/generated/cargo-check.html
+9 −9 src/doc/man/generated/cargo-clean.html
+11 −11 src/doc/man/generated/cargo-doc.html
+7 −7 src/doc/man/generated/cargo-fetch.html
+12 −12 src/doc/man/generated/cargo-fix.html
+7 −7 src/doc/man/generated/cargo-generate-lockfile.html
+1 −1 src/doc/man/generated/cargo-help.html
+7 −7 src/doc/man/generated/cargo-init.html
+10 −10 src/doc/man/generated/cargo-install.html
+5 −5 src/doc/man/generated/cargo-locate-project.html
+6 −6 src/doc/man/generated/cargo-login.html
+7 −7 src/doc/man/generated/cargo-metadata.html
+7 −7 src/doc/man/generated/cargo-new.html
+9 −9 src/doc/man/generated/cargo-owner.html
+11 −11 src/doc/man/generated/cargo-package.html
+6 −6 src/doc/man/generated/cargo-pkgid.html
+15 −15 src/doc/man/generated/cargo-publish.html
+11 −11 src/doc/man/generated/cargo-run.html
+12 −12 src/doc/man/generated/cargo-rustc.html
+11 −11 src/doc/man/generated/cargo-rustdoc.html
+5 −5 src/doc/man/generated/cargo-search.html
+11 −11 src/doc/man/generated/cargo-test.html
+7 −7 src/doc/man/generated/cargo-uninstall.html
+8 −8 src/doc/man/generated/cargo-update.html
+21 −4 src/doc/man/generated/cargo-vendor.html
+6 −6 src/doc/man/generated/cargo-verify-project.html
+1 −1 src/doc/man/generated/cargo-version.html
+8 −8 src/doc/man/generated/cargo-yank.html
+36 −36 src/doc/man/generated/cargo.html
+22 −22 src/doc/src/appendix/glossary.md
+4 −4 src/doc/src/faq.md
+1 −1 src/doc/src/getting-started/first-steps.md
+2 −2 src/doc/src/getting-started/index.md
+2 −2 src/doc/src/guide/cargo-toml-vs-cargo-lock.md
+1 −1 src/doc/src/guide/dependencies.md
+9 −9 src/doc/src/guide/index.md
+1 −1 src/doc/src/guide/project-layout.md
+1 −1 src/doc/src/guide/tests.md
+4 −4 src/doc/src/index.md
+3 −3 src/doc/src/reference/build-scripts.md
+5 −5 src/doc/src/reference/config.md
+5 −5 src/doc/src/reference/environment-variables.md
+10 −10 src/doc/src/reference/index.md
+18 −15 src/doc/src/reference/manifest.md
+8 −8 src/doc/src/reference/publishing.md
+7 −7 src/doc/src/reference/registries.md
+4 −4 src/doc/src/reference/source-replacement.md
+9 −9 src/doc/src/reference/specifying-dependencies.md
+1 −1 src/doc/src/reference/unstable.md
+1 −2 tests/testsuite/bad_config.rs
+8 −16 tests/testsuite/build.rs
+12 −18 tests/testsuite/build_auth.rs
+1 −2 tests/testsuite/build_script.rs
+1 −2 tests/testsuite/cross_compile.rs
+4 −16 tests/testsuite/features.rs
+5 −9 tests/testsuite/fix.rs
+5 −10 tests/testsuite/install.rs
+3 −6 tests/testsuite/new.rs
+59 −0 tests/testsuite/patch.rs
+1 −2 tests/testsuite/path.rs
+1 −1 tests/testsuite/read_manifest.rs
+1 −2 tests/testsuite/run.rs
+5 −10 tests/testsuite/rustc.rs
+15 −6 tests/testsuite/rustflags.rs
+2 −2 tests/testsuite/support/mod.rs
+1 −1 tests/testsuite/support/paths.rs
+2 −11 tests/testsuite/test.rs
+1 −1 tests/testsuite/tool_paths.rs
+2 −2 tests/testsuite/warn_on_failure.rs
+36 −0 tests/testsuite/workspaces.rs
6 changes: 0 additions & 6 deletions src/tools/rustbook/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,5 @@ version = "0.3.0"
default-features = false
features = ["search"]

[dependencies.mdbook_1]
package = "mdbook"
version = "0.1.7"
default-features = false
features = ["search"]

[target.'cfg(all(target_arch = "x86_64", target_os = "linux"))'.dependencies]
mdbook-linkcheck = "0.3.0"
55 changes: 7 additions & 48 deletions src/tools/rustbook/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ use std::path::{Path, PathBuf};

use clap::{App, ArgMatches, SubCommand, AppSettings};

use mdbook_1::{MDBook as MDBook1};
use mdbook_1::errors::{Result as Result1};

use mdbook::MDBook;
use mdbook::errors::{Result as Result3};

Expand All @@ -25,8 +22,6 @@ fn main() {
'The output directory for your book{n}(Defaults to ./book when omitted)'";
let dir_message = "[dir]
'A directory for your book{n}(Defaults to Current Directory when omitted)'";
let vers_message = "-m, --mdbook-vers=[md-version]
'The version of mdbook to use for your book{n}(Defaults to 1 when omitted)'";

let matches = App::new("rustbook")
.about("Build a book with mdBook")
Expand All @@ -36,8 +31,7 @@ fn main() {
.subcommand(SubCommand::with_name("build")
.about("Build the book from the markdown files")
.arg_from_usage(d_message)
.arg_from_usage(dir_message)
.arg_from_usage(vers_message))
.arg_from_usage(dir_message))
.subcommand(SubCommand::with_name("linkcheck")
.about("Run linkcheck with mdBook 3")
.arg_from_usage(dir_message))
Expand All @@ -46,33 +40,15 @@ fn main() {
// Check which subcomamnd the user ran...
match matches.subcommand() {
("build", Some(sub_matches)) => {
match sub_matches.value_of("mdbook-vers") {
None | Some("1") => {
if let Err(e) = build_1(sub_matches) {
eprintln!("Error: {}", e);

for cause in e.iter().skip(1) {
eprintln!("\tCaused By: {}", cause);
}
if let Err(e) = build(sub_matches) {
eprintln!("Error: {}", e);

::std::process::exit(101);
}
for cause in e.iter().skip(1) {
eprintln!("\tCaused By: {}", cause);
}
Some("2") | Some("3") => {
if let Err(e) = build(sub_matches) {
eprintln!("Error: {}", e);

for cause in e.iter().skip(1) {
eprintln!("\tCaused By: {}", cause);
}

::std::process::exit(101);
}
}
_ => {
panic!("Invalid mdBook version! Select '1' or '2' or '3'");
}
};
::std::process::exit(101);
}
},
("linkcheck", Some(sub_matches)) => {
if let Err(err) = linkcheck(sub_matches) {
Expand Down Expand Up @@ -110,23 +86,6 @@ pub fn linkcheck(_args: &ArgMatches<'_>) -> Result<(), Error> {
Ok(())
}

// Build command implementation
pub fn build_1(args: &ArgMatches<'_>) -> Result1<()> {
let book_dir = get_book_dir(args);
let mut book = MDBook1::load(&book_dir)?;

// Set this to allow us to catch bugs in advance.
book.config.build.create_missing = false;

if let Some(dest_dir) = args.value_of("dest-dir") {
book.config.build.build_dir = PathBuf::from(dest_dir);
}

book.build()?;

Ok(())
}

// Build command implementation
pub fn build(args: &ArgMatches<'_>) -> Result3<()> {
let book_dir = get_book_dir(args);
Expand Down