Repository navigation
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·67 lines (58 loc) · 2.58 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·67 lines (58 loc) · 2.58 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
59
60
61
62
63
64
65
66
67
#!/bin/bash
set -e
ROOT=$(cd "$(dirname "$0")" && pwd)
# Only a real `<version>x</version>` element matches; the usage comment above
# the coordinates mentions `<version>` too, and grabbing that line would put
# slashes into the sed below ("unknown option to `s'").
VERSION=$(grep -m1 -oE '<version>[^<]+</version>' ./pom.xml | sed -E 's/<\/?version>//g')
cp ./CHANGELOG.md ./docs/book/changelog.md
# The reference examples used to be recorded as GIFs and copied in here. They
# are run in the browser now, so there is nothing left to copy.
rm -rf "$PWD/docs/public/reference"
# 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, the HTML Javadoc under target/apidocs (the docs workflow copies it
# into the site as /javadocs), the built-in sprite and sound pages, and the demo
# pages with the assets they load.
# in the reactor, never `install` (AGENTS.md); the reference pages come from the Javadoc of the
# core and the extensions, the demo pages and their assets from examples/src/main/java/demos
./scripts/reference-docs.sh
CP="examples/target/classes:$(ls all/target/scratch-*-all.jar | grep -v nrw | head -1)"
java -cp "$CP" docs.GenerateDemoPages --write
java -cp "$CP" docs.GenerateAssetPages
python3 scripts/browser-compatibility.py
python3 scripts/release-catalogs.py
python3 scripts/build-course-pack.py --output docs/public/scratch-to-java-course.zip
# 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@latest build