-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·58 lines (50 loc) · 1.85 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·58 lines (50 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
set -e
ROOT=$(cd "$(dirname "$0")" && pwd)
VERSION=$(grep -m1 '<version>' ./pom.xml | sed -E 's/.*<version>([^<]+)<\/version>.*/\1/')
cp ./CHANGELOG.md ./docs/book/changelog.md
folder=$PWD/docs/public/reference/
rm -rf $folder
mkdir $folder
pushd ./src/examples/java/reference
find . -name "*.gif" | cpio -pdm $folder
popd
# The version is written into these pages for the build and taken out again
# afterwards. Substituting in place without restoring would burn one version
# number into the sources, and every later release would ship the wrong one.
VERSIONED_PAGES="$ROOT/docs/book/download.md $ROOT/docs/book/index.md $ROOT/docs/book/setup.md"
restore_versioned_pages() {
for page in $VERSIONED_PAGES; do
if [ -f "$page.orig" ]; then
mv "$page.orig" "$page"
fi
done
return 0
}
trap restore_versioned_pages EXIT
for page in $VERSIONED_PAGES; do
cp "$page" "$page.orig"
sed -i "s/{{VERSION}}/${VERSION}/g" "$page"
done
# Regenerates everything the docs are built from: the reference pages written by
# the doclet, and the built-in sprite and sound pages. Running only `compile`
# here would leave the reference pages as they were after the last `mvn package`,
# which is how pages for deleted methods used to survive.
mvn -q -DskipTests prepare-package
# Any jar linked in for local testing by scripts/link-jar.sh is taken out again
# here. Zipping one in would put a 19 MB library inside every project download.
removed=0
for libs in "$ROOT"/docs/archives/*/+libs; do
for jar in "$libs"/scratch-*.jar; do
if [ -e "$jar" ] || [ -L "$jar" ]; then
rm -f "$jar"
removed=$((removed + 1))
fi
done
done
if [ "$removed" -gt 0 ]; then
echo "Removed $removed locally linked jar(s) from docs/archives before building."
echo "Run ./scripts/link-jar.sh again if you want to keep testing the projects."
fi
cd docs
npx hyperbook build