std-internal-docs/build.sh
2025-07-27 17:04:43 +02:00

36 lines
907 B
Bash
Executable file

#!/usr/bin/env bash
set -euxo pipefail
root=$(realpath "$PWD")
# use a higher depth because bootstrap might be broken with depth 1?
git clone --depth 50 https://github.com/rust-lang/rust.git
cd rust
./configure \
--set llvm.download-ci-llvm=true \
--set rust.download-rustc=true
targets=(x86_64-unknown-linux-gnu x86_64-pc-windows-gnu aarch64-apple-darwin)
# bootstrap uses this var to perform CI detection :(
unset CI
unset GITHUB_ACTIONS
# sanity checks make no sense for doc
export BOOTSTRAP_SKIP_TARGET_SANITY=1
for target in "${targets[@]}"; do
echo "Building $target"
export RUSTDOCFLAGS="--document-private-items \
--document-hidden-items \
--html-before-content=$root/before.html \
--extend-css=$root/style.css"
./x doc library --target "$target"
mkdir "$root/www-root/$target"
cp -r "./build/$target/doc" "$root/www-root/$target"
done