epoger@google.com | b0c5e07 | 2011-12-06 14:52:38 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
epoger@google.com | 338ef65 | 2011-12-07 18:52:40 +0000 | [diff] [blame] | 3 | # 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.com | bcf0c52 | 2012-07-09 20:53:03 +0000 | [diff] [blame] | 5 | # |
| 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.com | b0c5e07 | 2011-12-06 14:52:38 +0000 | [diff] [blame] | 15 | |
| 16 | # Prepare a temporary dir and check out Skia trunk and docs. |
| 17 | cd |
rmistry@google.com | bcf0c52 | 2012-07-09 20:53:03 +0000 | [diff] [blame] | 18 | DOXYGEN_TEMPDIR=${DOXYGEN_TEMPDIR:-/tmp/skia-doxygen} |
| 19 | DOXYGEN_COMMIT=${DOXYGEN_COMMIT:-true} |
| 20 | |
rmistry@google.com | bcf0c52 | 2012-07-09 20:53:03 +0000 | [diff] [blame] | 21 | mkdir -p $DOXYGEN_TEMPDIR |
| 22 | cd $DOXYGEN_TEMPDIR |
rmistry@google.com | a8a977a | 2012-07-17 18:27:03 +0000 | [diff] [blame] | 23 | |
| 24 | if [ -d "trunk" ]; then |
| 25 | svn update --accept theirs-full trunk |
| 26 | else |
| 27 | svn checkout http://skia.googlecode.com/svn/trunk # read-only |
| 28 | fi |
| 29 | if [ -d "docs" ]; then |
| 30 | svn update --accept theirs-full docs |
| 31 | else |
| 32 | svn checkout https://skia-autogen.googlecode.com/svn/docs # writeable |
| 33 | fi |
epoger@google.com | b0c5e07 | 2011-12-06 14:52:38 +0000 | [diff] [blame] | 34 | |
| 35 | # Run Doxygen. |
| 36 | cd trunk |
| 37 | doxygen Doxyfile |
| 38 | cd ../docs |
| 39 | |
| 40 | # Add any newly created files to Subversion. |
| 41 | NEWFILES=$(svn status | grep ^\? | awk '{print $2}') |
| 42 | if [ -n "$NEWFILES" ]; then |
| 43 | svn add $NEWFILES |
| 44 | fi |
| 45 | |
| 46 | # We haven't updated the timestamp footer yet... if there are no changes |
| 47 | # yet, just exit. (We'll wait until there are any actual doc changes before |
| 48 | # updating the timestamp and committing changes to the repository.) |
| 49 | MODFILES=$(svn status | grep ^[AM]) |
| 50 | if [ -z "$MODFILES" ]; then |
| 51 | echo "No documentation updates, exiting early." |
| 52 | exit 0 |
| 53 | fi |
| 54 | |
| 55 | # Update the timestamp footer. |
| 56 | cat >iframe_footer.html <<EOF |
| 57 | <html><body> |
| 58 | <address style="text-align: right;"><small> |
| 59 | Generated on $(date) for skia by |
| 60 | <a href="http://www.doxygen.org/index.html">doxygen</a> |
| 61 | $(doxygen --version) </small></address> |
| 62 | </body></html> |
| 63 | EOF |
| 64 | |
| 65 | # Make sure that all files have the correct mimetype. |
epoger@google.com | 338ef65 | 2011-12-07 18:52:40 +0000 | [diff] [blame] | 66 | find . -name '*.html' -exec svn propset svn:mime-type text/html '{}' \; |
| 67 | find . -name '*.css' -exec svn propset svn:mime-type text/css '{}' \; |
| 68 | find . -name '*.js' -exec svn propset svn:mime-type text/javascript '{}' \; |
| 69 | find . -name '*.gif' -exec svn propset svn:mime-type image/gif '{}' \; |
| 70 | find . -name '*.png' -exec svn propset svn:mime-type image/png '{}' \; |
epoger@google.com | b0c5e07 | 2011-12-06 14:52:38 +0000 | [diff] [blame] | 71 | |
rmistry@google.com | bcf0c52 | 2012-07-09 20:53:03 +0000 | [diff] [blame] | 72 | # Output files with documentation updates. |
| 73 | echo -e "\n\nThe following are the documentation updates:" |
| 74 | echo $MODFILES |
| 75 | |
| 76 | if $DOXYGEN_COMMIT ; then |
| 77 | # Commit the updated docs to the subversion repo. |
| 78 | svn commit --message 'commit doxygen-generated documentation' |
| 79 | fi |