annotate extra/soundsoftware/extract-javadoc.sh @ 180:3a353bd04976 feature_20

* Stylesheet for Doxygen, and some generation fixes
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 03 Feb 2011 11:07:55 +0000
parents 2cec5c53cd68
children fc1ffeca7437
rev   line source
chris@168 1 #!/bin/sh
chris@168 2
chris@168 3 # Run this script from /var/doc/<project-name>
chris@168 4
chris@168 5 # Find Hg repo and update it
chris@168 6
chris@168 7 docdir=$(pwd)
chris@168 8 name=$(basename $(pwd))
chris@168 9 hgdir="/var/hg/$name"
chris@168 10 echo "Extracting doc for $name"
chris@168 11 if [ ! -d "$hgdir" ]; then
chris@168 12 echo "Error: No $hgdir found for project $name"
chris@168 13 exit 1
chris@168 14 fi
chris@168 15 ( cd "$hgdir" ; hg update ) || exit 1
chris@168 16
chris@168 17 # Identify either a Doxyfile or some Java packages
chris@168 18
chris@168 19 # TODO: Doxyfile
chris@168 20
chris@178 21 doxyfile=`find "$hgdir" -type f -name Doxyfile -print | head -1`
chris@178 22
chris@178 23 echo "This project contains a Doxyfile:"
chris@178 24 echo "$doxyfile"
chris@178 25
chris@178 26 if [ -z "$doxyfile" ]; then
chris@178 27 echo "No Doxyfile: skipping"
chris@178 28 else
chris@178 29
chris@178 30 # hmm. should be a whitelist
chris@178 31
chris@180 32 ( cd "$hgdir" && grep -vi OUTPUT_DIRECTORY "$doxyfile" | grep -vi HTML_OUTPUT | grep -vi SEARCHENGINE | grep -vi HAVE_DOT | grep -vi DOT_FONTNAME | grep -vi DOT_FONTPATH | grep -vi DOT_TRANSPARENT | \
chris@180 33 sed -e '$a OUTPUT_DIRECTORY='"$docdir" -e '$a HTML_OUTPUT = .' -e '$a SEARCHENGINE = NO' -e '$a HAVE_DOT = YES' -e '$a DOT_FONTNAME = FreeMono.ttf' -e '$a DOT_TRANSPARENT = YES' | doxygen - )
chris@178 34
chris@178 35 fi
chris@168 36
chris@168 37 # This is very rough; check what is actually permitted for package
chris@168 38 # declarations
chris@168 39
chris@168 40 java_packages=`find "$hgdir" -type f -name \*.java -print | \
chris@178 41 xargs grep -h '^ *package [a-zA-Z][a-zA-Z0-9\._-]* *; *' | \
chris@178 42 sort | uniq | \
chris@178 43 sed -e 's/^ *package //' -e 's/ *; *$//'`
chris@168 44
chris@178 45 echo "This project contains Java packages:"
chris@168 46 echo "$java_packages"
chris@168 47
chris@178 48 if [ -z "$java_packages" ]; then
chris@178 49 echo "No Java packages: skipping"
chris@178 50 exit 0
chris@178 51 fi
chris@178 52
chris@178 53 # This won't work if code is in a subdir,
chris@178 54 # e.g. src/com/example/project/Hello.java
chris@178 55
chris@178 56 # We need to convert the package name back to a path, and check
chris@178 57 # whether that matches the tail of the path to a java file that
chris@178 58 # declares itself to be in that package... but we don't have that list
chris@178 59 # of java files to hand here... hm
chris@168 60
chris@168 61 javadoc -sourcepath "$hgdir" -d . -subpackages $java_packages -verbose
chris@168 62
chris@168 63 # If we have just written something to a doc directory that was
chris@168 64 # previously empty, we should switch on Embedded for this project