| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
set -euo pipefail |
| 7 |
|
| 8 |
if [ ! -f "Cargo.toml" ]; then |
| 9 |
echo "Error: Run this script from the MNW/server directory" |
| 10 |
exit 1 |
| 11 |
fi |
| 12 |
|
| 13 |
OUT_DIR="$(pwd)/rustdoc-out" |
| 14 |
SHARED_DIR="$(cd ../shared && pwd)" |
| 15 |
|
| 16 |
CRATES=("synckit-client" "docengine" "tagtree" "s3-storage" "theme-common") |
| 17 |
|
| 18 |
rm -rf "$OUT_DIR" |
| 19 |
mkdir -p "$OUT_DIR" |
| 20 |
|
| 21 |
for crate in "${CRATES[@]}"; do |
| 22 |
crate_dir="$SHARED_DIR/$crate" |
| 23 |
if [ ! -d "$crate_dir" ]; then |
| 24 |
echo "Warning: $crate_dir not found, skipping" |
| 25 |
continue |
| 26 |
fi |
| 27 |
|
| 28 |
echo "Generating docs for $crate..." |
| 29 |
(cd "$crate_dir" && cargo doc --no-deps --target-dir "$OUT_DIR/.target" 2>&1 | tail -1) |
| 30 |
done |
| 31 |
|
| 32 |
|
| 33 |
if [ -d "$OUT_DIR/.target/doc" ]; then |
| 34 |
cp -r "$OUT_DIR/.target/doc/"* "$OUT_DIR/" |
| 35 |
rm -rf "$OUT_DIR/.target" |
| 36 |
fi |
| 37 |
|
| 38 |
echo "" |
| 39 |
echo "Rustdoc generated in $OUT_DIR/" |
| 40 |
ls -1 "$OUT_DIR/" | head -20 |
| 41 |
|