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