diff options
| author | bors <bors@rust-lang.org> | 2023-04-20 17:23:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-04-20 17:23:22 +0000 |
| commit | 3d7a091c647ef8644bfa8487434d27c9c02aa59a (patch) | |
| tree | d856831f38bfab47f03a0d4d7f2cfceac8d460ac /src/tools | |
| parent | a57fa08f483620c2b4f33c6b5dcdbbf2b4c08ad8 (diff) | |
| parent | c430d6111a9c607bc7371112135d3209a8ed2028 (diff) | |
Auto merge of #110612 - matthiaskrgr:rollup-y2hbjws, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #108795 (Add support for the x86_64h-apple-darwin target) - #110558 (Add Call terminator to SMIR) - #110565 (linkchecker: running from a directory separate from the book) - #110599 (Remove an unused `&[Ty]` <-> `&[GenericArg]`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/tools')
| -rwxr-xr-x | src/tools/linkchecker/linkcheck.sh | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/tools/linkchecker/linkcheck.sh b/src/tools/linkchecker/linkcheck.sh index 9eeebf444a4..6c1e668a7f0 100755 --- a/src/tools/linkchecker/linkcheck.sh +++ b/src/tools/linkchecker/linkcheck.sh @@ -16,15 +16,13 @@ # # --all Check all books. This can help make sure you don't break links # from other books into your book. +# +# --path <book-path> +# Path to the root directory for the book. Default to the current +# working directory if omitted. set -e -if [ ! -f book.toml ] && [ ! -f src/SUMMARY.md ] -then - echo "Run command in root directory of the book." - exit 1 -fi - html_dir="$(rustc +nightly --print sysroot)/share/doc/rust/html" if [ ! -d "$html_dir" ] @@ -38,6 +36,8 @@ fi export MDBOOK_OUTPUT__HTML__INPUT_404="" book_name="" +# Default to the current directory +book_path="." # Iterative will avoid cleaning up, so you can quickly run it repeatedly. iterative=0 # If "1", test all books, else only this book. @@ -52,6 +52,10 @@ do --all) all_books=1 ;; + --path) + book_path="${2:-.}" + shift + ;; *) if [ -n "$book_name" ] then @@ -70,6 +74,12 @@ then exit 1 fi +if [ ! -f "$book_path/book.toml" ] && [ ! -f "$book_path/src/SUMMARY.md" ] +then + echo "Run command in root directory of the book or provide a path to the book" + exit 1 +fi + if [ ! -d "$html_dir/$book_name" ] then echo "book name \"$book_name\" not found in sysroot \"$html_dir\"" @@ -93,11 +103,11 @@ then fi echo "Building book \"$book_name\"..." -mdbook build +mdbook build "$book_path" cp -R "$html_dir" linkcheck rm -rf "linkcheck/$book_name" -cp -R book "linkcheck/$book_name" +cp -R "$book_path/book" "linkcheck/$book_name" if [ "$all_books" = "1" ] then |
