Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5dfa062

Browse files
committedJul 22, 2024
Move rustbook to its own workspace.
1 parent aee3dc4 commit 5dfa062

File tree

10 files changed

+1796
-297
lines changed

10 files changed

+1796
-297
lines changed
 

‎.github/workflows/dependencies.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,17 @@ jobs:
6464
- name: cargo update
6565
# Remove first line that always just says "Updating crates.io index"
6666
run: cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
67+
- name: cargo update rustbook
68+
run: |
69+
echo -e "\nrustbook dependencies:" >> cargo_update.log
70+
cargo update --manifest-path src/tools/rustbook 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
6771
- name: upload Cargo.lock artifact for use in PR
6872
uses: actions/upload-artifact@v4
6973
with:
7074
name: Cargo-lock
71-
path: Cargo.lock
75+
path: |
76+
Cargo.lock
77+
src/tools/rustbook/Cargo.lock
7278
retention-days: 1
7379
- name: upload cargo-update log artifact for use in PR
7480
uses: actions/upload-artifact@v4
@@ -113,7 +119,7 @@ jobs:
113119
git config user.name github-actions
114120
git config user.email github-actions@github.com
115121
git switch --force-create cargo_update
116-
git add ./Cargo.lock
122+
git add ./Cargo.lock ./src/tools/rustbook/Cargo.lock
117123
git commit --no-verify --file=commit.txt
118124
119125
- name: push

‎Cargo.lock

Lines changed: 2 additions & 291 deletions
Large diffs are not rendered by default.

‎Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ members = [
1616
"src/tools/linkchecker",
1717
"src/tools/lint-docs",
1818
"src/tools/miropt-test-tools",
19-
"src/tools/rustbook",
2019
"src/tools/unstable-book-gen",
2120
"src/tools/tidy",
2221
"src/tools/tier-check",

‎src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,8 @@ impl Step for PlainSourceTarball {
10401040
.arg(builder.src.join("./src/tools/opt-dist/Cargo.toml"))
10411041
.arg("--sync")
10421042
.arg(builder.src.join("./src/tools/rustc-perf/Cargo.toml"))
1043+
.arg("--sync")
1044+
.arg(builder.src.join("./src/tools/rustbook/Cargo.toml"))
10431045
// Will read the libstd Cargo.toml
10441046
// which uses the unstable `public-dependency` feature.
10451047
.env("RUSTC_BOOTSTRAP", "1")

‎src/bootstrap/src/core/build_steps/doc.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,12 @@ impl Step for RustcBook {
11721172
/// in the "md-doc" directory in the build output directory. Then
11731173
/// "rustbook" is used to convert it to HTML.
11741174
fn run(self, builder: &Builder<'_>) {
1175+
// These submodules are required to be checked out to build rustbook
1176+
// because they have Cargo dependencies that are needed.
1177+
#[allow(clippy::single_element_loop)] // This will change soon.
1178+
for path in ["src/doc/book"] {
1179+
builder.update_submodule(Path::new(path));
1180+
}
11751181
let out_base = builder.md_doc_out(self.target).join("rustc");
11761182
t!(fs::create_dir_all(&out_base));
11771183
let out_listing = out_base.join("src/lints");

‎src/bootstrap/src/core/build_steps/vendor.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ impl Step for Vendor {
3434
cmd.arg("--versioned-dirs");
3535
}
3636

37-
// cargo submodule must be present for `x vendor` to work.
38-
builder.build.update_submodule(Path::new("src/tools/cargo"));
37+
// These submodules must be present for `x vendor` to work.
38+
for path in ["src/tools/cargo", "src/doc/book"] {
39+
builder.build.update_submodule(Path::new(path));
40+
}
3941

4042
// Sync these paths by default.
4143
for p in [
@@ -44,6 +46,7 @@ impl Step for Vendor {
4446
"compiler/rustc_codegen_cranelift/Cargo.toml",
4547
"compiler/rustc_codegen_gcc/Cargo.toml",
4648
"src/bootstrap/Cargo.toml",
49+
"src/tools/rustbook/Cargo.toml",
4750
] {
4851
cmd.arg("--sync").arg(builder.src.join(p));
4952
}

‎src/bootstrap/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ impl Build {
439439

440440
// Make sure we update these before gathering metadata so we don't get an error about missing
441441
// Cargo.toml files.
442-
let rust_submodules = ["src/doc/book", "library/backtrace", "library/stdarch"];
442+
let rust_submodules = ["library/backtrace", "library/stdarch"];
443443
for s in rust_submodules {
444444
build.update_submodule(Path::new(s));
445445
}

‎src/tools/rustbook/Cargo.lock

Lines changed: 1762 additions & 0 deletions
Large diffs are not rendered by default.

‎src/tools/rustbook/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[workspace]
2+
13
[package]
24
name = "rustbook"
35
version = "0.1.0"

‎src/tools/tidy/src/deps.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ pub(crate) const WORKSPACES: &[(&str, ExceptionList, Option<(&[&str], &[&str])>)
7070
//("src/tools/miri/test-cargo-miri", &[], None), // FIXME uncomment once all deps are vendored
7171
//("src/tools/miri/test_dependencies", &[], None), // FIXME uncomment once all deps are vendored
7272
("src/tools/rust-analyzer", EXCEPTIONS_RUST_ANALYZER, None),
73+
("src/tools/rustbook", EXCEPTIONS_RUSTBOOK, None),
7374
("src/tools/rustc-perf", EXCEPTIONS_RUSTC_PERF, None),
7475
("src/tools/x", &[], None),
7576
// tidy-alphabetical-end
@@ -167,6 +168,13 @@ const EXCEPTIONS_RUSTC_PERF: ExceptionList = &[
167168
// tidy-alphabetical-end
168169
];
169170

171+
const EXCEPTIONS_RUSTBOOK: ExceptionList = &[
172+
// tidy-alphabetical-start
173+
("mdbook", "MPL-2.0"),
174+
("ryu", "Apache-2.0 OR BSL-1.0"),
175+
// tidy-alphabetical-end
176+
];
177+
170178
const EXCEPTIONS_CRANELIFT: ExceptionList = &[
171179
// tidy-alphabetical-start
172180
("cranelift-bforest", "Apache-2.0 WITH LLVM-exception"),

0 commit comments

Comments
 (0)
Please sign in to comment.