| OLD | NEW |
| (Empty) |
| 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 # To install doxygen on most Linux systems, you can run: | |
| 17 # sudo apt-get install doxygen | |
| 18 | |
| 19 function check_out_docs { | |
| 20 svn checkout https://skia-autogen.googlecode.com/svn/docs # writeable | |
| 21 ret_code=$? | |
| 22 if [ $ret_code != 0 ]; then | |
| 23 # docs directory does not exist, skia-autogen must have been reset. | |
| 24 # Create a non svn docs directory instead. | |
| 25 mkdir docs | |
| 26 fi | |
| 27 } | |
| 28 | |
| 29 # Prepare a temporary dir and check out Skia trunk and docs. | |
| 30 cd | |
| 31 DOXYGEN_TEMPDIR=${DOXYGEN_TEMPDIR:-/tmp/skia-doxygen} | |
| 32 DOXYGEN_COMMIT=${DOXYGEN_COMMIT:-true} | |
| 33 | |
| 34 mkdir -p $DOXYGEN_TEMPDIR | |
| 35 cd $DOXYGEN_TEMPDIR | |
| 36 | |
| 37 if [ -d "skia" ]; then | |
| 38 pushd skia | |
| 39 git pull | |
| 40 git checkout origin/master | |
| 41 popd | |
| 42 else | |
| 43 git clone https://skia.googlesource.com/skia.git | |
| 44 fi | |
| 45 if [ -d "docs" ]; then | |
| 46 svn update --accept theirs-full docs | |
| 47 svn info docs | |
| 48 ret_code=$? | |
| 49 if [ $ret_code != 0 ]; then | |
| 50 # This is not a valid SVN checkout. | |
| 51 rm -rf docs | |
| 52 check_out_docs | |
| 53 fi | |
| 54 else | |
| 55 check_out_docs | |
| 56 fi | |
| 57 | |
| 58 if [ ! -f "docs/static_footer.txt" ]; then | |
| 59 cp skia/tools/doxygen_footer.txt docs/static_footer.txt | |
| 60 fi | |
| 61 | |
| 62 # Run Doxygen. | |
| 63 cd skia | |
| 64 doxygen Doxyfile | |
| 65 ret_code=$? | |
| 66 if [ $ret_code != 0 ]; then | |
| 67 echo "Error while executing Doxygen command" | |
| 68 exit $ret_code | |
| 69 fi | |
| 70 | |
| 71 cd ../docs | |
| 72 | |
| 73 # Add any newly created files to Subversion. | |
| 74 NEWFILES=$(svn status | grep ^\? | awk '{print $2}') | |
| 75 if [ -n "$NEWFILES" ]; then | |
| 76 svn add $NEWFILES | |
| 77 fi | |
| 78 | |
| 79 # We haven't updated the timestamp footer yet... if there are no changes | |
| 80 # yet, just exit. (We'll wait until there are any actual doc changes before | |
| 81 # updating the timestamp and committing changes to the repository.) | |
| 82 MODFILES=$(svn status | grep ^[AM]) | |
| 83 if [ -z "$MODFILES" ]; then | |
| 84 echo "No documentation updates, exiting early." | |
| 85 exit 0 | |
| 86 fi | |
| 87 | |
| 88 # Update the timestamp footer. | |
| 89 cat >iframe_footer.html <<EOF | |
| 90 <html><body> | |
| 91 <address style="text-align: right;"><small> | |
| 92 Generated on $(date) for skia by | |
| 93 <a href="http://www.doxygen.org/index.html">doxygen</a> | |
| 94 $(doxygen --version) </small></address> | |
| 95 </body></html> | |
| 96 EOF | |
| 97 | |
| 98 # Make sure that all files have the correct mimetype. | |
| 99 find . -name '*.html' -exec svn propset svn:mime-type text/html '{}' \; | |
| 100 find . -name '*.css' -exec svn propset svn:mime-type text/css '{}' \; | |
| 101 find . -name '*.js' -exec svn propset svn:mime-type text/javascript '{}' \; | |
| 102 find . -name '*.gif' -exec svn propset svn:mime-type image/gif '{}' \; | |
| 103 find . -name '*.png' -exec svn propset svn:mime-type image/png '{}' \; | |
| 104 | |
| 105 # Output files with documentation updates. | |
| 106 echo -e "\n\nThe following are the documentation updates:" | |
| 107 echo $MODFILES | |
| 108 | |
| 109 if $DOXYGEN_COMMIT ; then | |
| 110 # Commit the updated docs to the subversion repo. | |
| 111 svn commit --message 'commit doxygen-generated documentation' | |
| 112 fi | |
| OLD | NEW |