Create update-doxygen script that generates and uploads docs
(but only causes an SVN commit if any documentation actually changed).
Review URL: http://codereview.appspot.com/5440109

git-svn-id: http://skia.googlecode.com/svn/trunk@2807 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/Doxyfile b/Doxyfile
index 69c9ddb..6735c19 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -1,30 +1,11 @@
-# How to run doxygen and store its results in the Skia repo, so that they can be
-# browsed at http://skia.googlecode.com/svn/docs/html/index.html :
-#
-# cd
-# TEMPDIR=/tmp/skia-doxygen
-# rm -rf $TEMPDIR
-# mkdir -p $TEMPDIR
-# cd $TEMPDIR
-# svn checkout https://skia.googlecode.com/svn/trunk
-# svn checkout https://skia.googlecode.com/svn/docs
-# cd trunk
-# doxygen Doxyfile
-# cd ../docs
-# NEWFILES=$(svn status | grep ^\? | awk '{print $2}')
-# svn add $NEWFILES
-# 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 '{}' \;
-# svn commit --message 'commit doxygen-generated documentation'
-# cd
-# rm -rf $TEMPDIR
+# To update the Doxygen output checked into the Skia subversion repo (which is
+# browsable at http://skia.googlecode.com/svn/docs/html/index.html ), run:
+# tools/update-doxygen.sh
 
 PROJECT_NAME = skia
 PROJECT_BRIEF = 2D Graphics Library
 OUTPUT_DIRECTORY = ../docs
+HTML_FOOTER = ../docs/static_footer.txt
 
 EXTRACT_ALL = NO
 INHERIT_DOCS = YES
diff --git a/tools/update-doxygen.sh b/tools/update-doxygen.sh
new file mode 100755
index 0000000..65743c4
--- /dev/null
+++ b/tools/update-doxygen.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+#
+# Runs doxygen and stores its results in the Skia repo, so that they can be
+# browsed at http://skia.googlecode.com/svn/docs/html/index.html
+
+# Prepare a temporary dir and check out Skia trunk and docs.
+cd
+TEMPDIR=/tmp/skia-doxygen
+rm -rf $TEMPDIR
+mkdir -p $TEMPDIR
+cd $TEMPDIR
+svn checkout http://skia.googlecode.com/svn/trunk  # read-only
+svn checkout https://skia.googlecode.com/svn/docs  # writeable
+
+# Run Doxygen.
+cd trunk
+doxygen Doxyfile
+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.
+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 '{}' \;
+
+# Commit the updated docs to the subversion repo.
+svn commit --message 'commit doxygen-generated documentation'