blob: 596506453ea4d5631ea924155316d879371ece5c [file] [log] [blame]
epoger@google.comb0c5e072011-12-06 14:52:38 +00001#!/bin/bash
2#
epoger@google.com338ef652011-12-07 18:52:40 +00003# Runs doxygen and stores its results in the skia-autogen repo, so that they
4# can be browsed at http://skia-autogen.googlecode.com/svn/docs/html/index.html
rmistry@google.combcf0c522012-07-09 20:53:03 +00005#
6# The DOXYGEN_TEMPDIR env variable is the working directory within which we will
7# check out the code, generate documentation, and store the doxygen log
8# (by default, /tmp/skia-doxygen). The DOXYGEN_COMMIT env variable determines
9# whether docs should be commited (true by default).
10#
11# Sample Usage:
12# export DOXYGEN_TEMPDIR=/tmp/doxygen
13# export DOXYGEN_COMMIT=false
14# bash update-doxygen.sh
epoger@google.comb0c5e072011-12-06 14:52:38 +000015
16# Prepare a temporary dir and check out Skia trunk and docs.
17cd
rmistry@google.combcf0c522012-07-09 20:53:03 +000018DOXYGEN_TEMPDIR=${DOXYGEN_TEMPDIR:-/tmp/skia-doxygen}
19DOXYGEN_COMMIT=${DOXYGEN_COMMIT:-true}
20
rmistry@google.combcf0c522012-07-09 20:53:03 +000021mkdir -p $DOXYGEN_TEMPDIR
22cd $DOXYGEN_TEMPDIR
epoger@google.comb0c5e072011-12-06 14:52:38 +000023svn checkout http://skia.googlecode.com/svn/trunk # read-only
epoger@google.com338ef652011-12-07 18:52:40 +000024svn checkout https://skia-autogen.googlecode.com/svn/docs # writeable
epoger@google.comb0c5e072011-12-06 14:52:38 +000025
26# Run Doxygen.
27cd trunk
28doxygen Doxyfile
29cd ../docs
30
31# Add any newly created files to Subversion.
32NEWFILES=$(svn status | grep ^\? | awk '{print $2}')
33if [ -n "$NEWFILES" ]; then
34 svn add $NEWFILES
35fi
36
37# We haven't updated the timestamp footer yet... if there are no changes
38# yet, just exit. (We'll wait until there are any actual doc changes before
39# updating the timestamp and committing changes to the repository.)
40MODFILES=$(svn status | grep ^[AM])
41if [ -z "$MODFILES" ]; then
42 echo "No documentation updates, exiting early."
43 exit 0
44fi
45
46# Update the timestamp footer.
47cat >iframe_footer.html <<EOF
48<html><body>
49<address style="text-align: right;"><small>
50Generated on $(date) for skia by
51<a href="http://www.doxygen.org/index.html">doxygen</a>
52$(doxygen --version) </small></address>
53</body></html>
54EOF
55
56# Make sure that all files have the correct mimetype.
epoger@google.com338ef652011-12-07 18:52:40 +000057find . -name '*.html' -exec svn propset svn:mime-type text/html '{}' \;
58find . -name '*.css' -exec svn propset svn:mime-type text/css '{}' \;
59find . -name '*.js' -exec svn propset svn:mime-type text/javascript '{}' \;
60find . -name '*.gif' -exec svn propset svn:mime-type image/gif '{}' \;
61find . -name '*.png' -exec svn propset svn:mime-type image/png '{}' \;
epoger@google.comb0c5e072011-12-06 14:52:38 +000062
rmistry@google.combcf0c522012-07-09 20:53:03 +000063# Output files with documentation updates.
64echo -e "\n\nThe following are the documentation updates:"
65echo $MODFILES
66
67if $DOXYGEN_COMMIT ; then
68 # Commit the updated docs to the subversion repo.
69 svn commit --message 'commit doxygen-generated documentation'
70fi