2016-03-08 17:30:33 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2016-11-03 13:53:31 +00:00
|
|
|
set -xeo pipefail
|
|
|
|
|
2016-03-08 17:30:33 +00:00
|
|
|
if [ ! -e ./gradlew ]; then
|
|
|
|
echo "Run from the root directory please"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -e lib/dokka.jar ]; then
|
|
|
|
echo "Downloading Dokka tool ... "
|
|
|
|
echo
|
2016-05-13 10:50:44 +00:00
|
|
|
wget -O lib/dokka.jar https://github.com/Kotlin/dokka/releases/download/0.9.8/dokka-fatjar.jar
|
2016-03-08 17:30:33 +00:00
|
|
|
fi
|
|
|
|
|
2016-11-07 17:16:44 +00:00
|
|
|
(
|
|
|
|
cd docs
|
|
|
|
|
|
|
|
if [ ! -d "virtualenv" ]
|
|
|
|
then
|
|
|
|
virtualenv -p python2.7 virtualenv
|
|
|
|
fi
|
|
|
|
. virtualenv/bin/activate
|
2016-11-21 16:39:46 +00:00
|
|
|
if [ ! -d "virtualenv/lib/python2.7/site-packages/sphinx" ]
|
2016-11-07 17:16:44 +00:00
|
|
|
then
|
|
|
|
echo "Installing pip dependencies ... "
|
|
|
|
pip install -r requirements.txt
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Generating docsite ..."
|
|
|
|
echo
|
2016-03-08 17:30:33 +00:00
|
|
|
|
2016-11-07 17:16:44 +00:00
|
|
|
make html
|
|
|
|
)
|
2016-03-08 17:30:33 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Generating API docs ..."
|
|
|
|
echo
|
2016-11-28 13:28:43 +00:00
|
|
|
|
|
|
|
SOURCES=$(find . \( -wholename "*src/main/kotlin" -or -wholename "*src/main/java" \) -and -not -wholename "./samples/*")
|
|
|
|
TARGET=docs/build/html/api
|
|
|
|
java -jar lib/dokka.jar -output $TARGET $SOURCES | grep -v "No documentation for"
|
|
|
|
|
|
|
|
echo "Generated documentation to $TARGET"
|
2016-03-08 17:30:33 +00:00
|
|
|
|
|
|
|
echo
|
2016-03-08 17:35:33 +00:00
|
|
|
echo "Writing robots.txt"
|
|
|
|
echo
|
|
|
|
|
|
|
|
cat <<EOF >docs/build/html/robots.txt
|
|
|
|
User-agent: *
|
|
|
|
Disallow: /
|
|
|
|
EOF
|
|
|
|
|
2016-11-07 17:16:44 +00:00
|
|
|
echo "Done"
|