Skip to content

Commit

Permalink
Auto merge of #127786 - ehuss:rustbook-workspace, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Move rustbook to its own workspace.

This moves rustbook (the wrapper around mdbook) to its own Cargo workspace. This is done for two reasons:

- Some users want to avoid having to check out documentation submodules if they are not working on documentation. These submodules are required for submodules that have Cargo dependencies in the tree (such as mdbook preprocessors).
- The [pinned `memchr`](https://github.com/rust-lang/rust/blob/eb72697e41b00e5d8723f14c64a969d59d9b9474/compiler/rustc_ast/Cargo.toml#L10) is causing problems with updating. That pin is only necessary for the standard library, but unfortunately it is affecting all other crates.

This will have some drawbacks:

- A slight increase in the vendor directory size. My measurement shows about a 14M increase (0.7%), but somehow the compressed filesize is smaller.
- The dependencies for rustbook now need to be managed separately. I have updated the cron job to try to mitigate this.
- There will be a slight dist build time penalty. I'm not sure what it will be, since it heavily depends on the machine, but I suspect in the 30-45s range.
- Adds more complexity to things like bootstrap and tidy.

There are a few other alternatives considered:

- Publish preprocessors on crates.io. This adds the burden of publishing every change, and ensuring those publishes happen and the sources don't get out of sync, and somehow syncing those updates back to rust-lang/rust during the automatic updates. This is also more work.
- Move the submodules to subtrees. These have the added burden of doing updates in a way that is more difficult than submodules. I believe it also causes problems with GitHub's `#NNNN` tagging and closing issues. This is also more work.

The only thing I haven't tested here is the cron job. However, there's a pretty decent chance this won't pass CI, or that I missed something.
  • Loading branch information
bors committed Jul 22, 2024
2 parents 2a1c384 + 5dfa062 commit cefe1dc
Show file tree
Hide file tree
Showing 10 changed files with 1,796 additions and 297 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,17 @@ jobs:
- name: cargo update
# Remove first line that always just says "Updating crates.io index"
run: cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
- name: cargo update rustbook
run: |
echo -e "\nrustbook dependencies:" >> cargo_update.log
cargo update --manifest-path src/tools/rustbook 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
- name: upload Cargo.lock artifact for use in PR
uses: actions/upload-artifact@v4
with:
name: Cargo-lock
path: Cargo.lock
path: |
Cargo.lock
src/tools/rustbook/Cargo.lock
retention-days: 1
- name: upload cargo-update log artifact for use in PR
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -113,7 +119,7 @@ jobs:
git config user.name github-actions
git config user.email github-actions@github.com
git switch --force-create cargo_update
git add ./Cargo.lock
git add ./Cargo.lock ./src/tools/rustbook/Cargo.lock
git commit --no-verify --file=commit.txt
- name: push
Expand Down
Loading

0 comments on commit cefe1dc

Please sign in to comment.