2011-12-06 14:52:38 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2011-12-07 18:52:40 +00:00
|
|
|
# Runs doxygen and stores its results in the skia-autogen repo, so that they
|
|
|
|
# can be browsed at http://skia-autogen.googlecode.com/svn/docs/html/index.html
|
2012-07-09 20:53:03 +00:00
|
|
|
#
|
|
|
|
# The DOXYGEN_TEMPDIR env variable is the working directory within which we will
|
|
|
|
# check out the code, generate documentation, and store the doxygen log
|
|
|
|
# (by default, /tmp/skia-doxygen). The DOXYGEN_COMMIT env variable determines
|
|
|
|
# whether docs should be commited (true by default).
|
|
|
|
#
|
|
|
|
# Sample Usage:
|
|
|
|
# export DOXYGEN_TEMPDIR=/tmp/doxygen
|
|
|
|
# export DOXYGEN_COMMIT=false
|
|
|
|
# bash update-doxygen.sh
|
2011-12-06 14:52:38 +00:00
|
|
|
|
2013-05-01 14:47:03 +00:00
|
|
|
function check_out_docs {
|
|
|
|
svn checkout https://skia-autogen.googlecode.com/svn/docs # writeable
|
|
|
|
ret_code=$?
|
|
|
|
if [ $ret_code != 0 ]; then
|
|
|
|
# docs directory does not exist, skia-autogen must have been reset.
|
|
|
|
# Create a non svn docs directory instead.
|
|
|
|
mkdir docs
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2011-12-06 14:52:38 +00:00
|
|
|
# Prepare a temporary dir and check out Skia trunk and docs.
|
|
|
|
cd
|
2012-07-09 20:53:03 +00:00
|
|
|
DOXYGEN_TEMPDIR=${DOXYGEN_TEMPDIR:-/tmp/skia-doxygen}
|
|
|
|
DOXYGEN_COMMIT=${DOXYGEN_COMMIT:-true}
|
|
|
|
|
|
|
|
mkdir -p $DOXYGEN_TEMPDIR
|
|
|
|
cd $DOXYGEN_TEMPDIR
|
2012-07-17 18:27:03 +00:00
|
|
|
|
2014-01-09 21:41:39 +00:00
|
|
|
if [ -d "skia" ]; then
|
|
|
|
pushd skia
|
|
|
|
git pull
|
|
|
|
git checkout origin/master
|
|
|
|
popd
|
2012-07-17 18:27:03 +00:00
|
|
|
else
|
2014-01-09 21:41:39 +00:00
|
|
|
git clone https://skia.googlesource.com/skia.git
|
2012-07-17 18:27:03 +00:00
|
|
|
fi
|
|
|
|
if [ -d "docs" ]; then
|
|
|
|
svn update --accept theirs-full docs
|
2013-05-01 14:47:03 +00:00
|
|
|
svn info docs
|
|
|
|
ret_code=$?
|
|
|
|
if [ $ret_code != 0 ]; then
|
|
|
|
# This is not a valid SVN checkout.
|
|
|
|
rm -rf docs
|
|
|
|
check_out_docs
|
|
|
|
fi
|
2012-07-17 18:27:03 +00:00
|
|
|
else
|
2013-05-01 14:47:03 +00:00
|
|
|
check_out_docs
|
|
|
|
fi
|
|
|
|
|
2012-09-26 16:09:43 +00:00
|
|
|
if [ ! -f "docs/static_footer.txt" ]; then
|
2014-01-09 21:41:39 +00:00
|
|
|
cp skia/tools/doxygen_footer.txt docs/static_footer.txt
|
2012-09-26 16:09:43 +00:00
|
|
|
fi
|
2011-12-06 14:52:38 +00:00
|
|
|
|
|
|
|
# Run Doxygen.
|
2014-01-09 21:41:39 +00:00
|
|
|
cd skia
|
2011-12-06 14:52:38 +00:00
|
|
|
doxygen Doxyfile
|
2012-08-24 17:16:05 +00:00
|
|
|
ret_code=$?
|
|
|
|
if [ $ret_code != 0 ]; then
|
|
|
|
echo "Error while executing Doxygen command"
|
|
|
|
exit $ret_code
|
|
|
|
fi
|
|
|
|
|
2011-12-06 14:52:38 +00:00
|
|
|
cd ../docs
|
|
|
|
|
|
|
|
# Add any newly created files to Subversion.
|
|
|
|
NEWFILES=$(svn status | grep ^\? | awk '{print $2}')
|
|
|
|
if [ -n "$NEWFILES" ]; then
|
|
|
|
svn add $NEWFILES
|
|
|
|
fi
|
|
|
|
|
|
|
|
# We haven't updated the timestamp footer yet... if there are no changes
|
|
|
|
# yet, just exit. (We'll wait until there are any actual doc changes before
|
|
|
|
# updating the timestamp and committing changes to the repository.)
|
|
|
|
MODFILES=$(svn status | grep ^[AM])
|
|
|
|
if [ -z "$MODFILES" ]; then
|
|
|
|
echo "No documentation updates, exiting early."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Update the timestamp footer.
|
|
|
|
cat >iframe_footer.html <<EOF
|
|
|
|
<html><body>
|
|
|
|
<address style="text-align: right;"><small>
|
|
|
|
Generated on $(date) for skia by
|
|
|
|
<a href="http://www.doxygen.org/index.html">doxygen</a>
|
|
|
|
$(doxygen --version) </small></address>
|
|
|
|
</body></html>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Make sure that all files have the correct mimetype.
|
2011-12-07 18:52:40 +00:00
|
|
|
find . -name '*.html' -exec svn propset svn:mime-type text/html '{}' \;
|
|
|
|
find . -name '*.css' -exec svn propset svn:mime-type text/css '{}' \;
|
|
|
|
find . -name '*.js' -exec svn propset svn:mime-type text/javascript '{}' \;
|
|
|
|
find . -name '*.gif' -exec svn propset svn:mime-type image/gif '{}' \;
|
|
|
|
find . -name '*.png' -exec svn propset svn:mime-type image/png '{}' \;
|
2011-12-06 14:52:38 +00:00
|
|
|
|
2012-07-09 20:53:03 +00:00
|
|
|
# Output files with documentation updates.
|
|
|
|
echo -e "\n\nThe following are the documentation updates:"
|
|
|
|
echo $MODFILES
|
|
|
|
|
|
|
|
if $DOXYGEN_COMMIT ; then
|
|
|
|
# Commit the updated docs to the subversion repo.
|
|
|
|
svn commit --message 'commit doxygen-generated documentation'
|
|
|
|
fi
|