annotate extra/soundsoftware/extract-javadoc.sh @ 168:c1e9f2dab1d5 feature_75

* Start on script for extracting Doxygen/Javadoc
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Tue, 01 Feb 2011 16:43:25 +0000
parents
children 2cec5c53cd68
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@168 21
chris@168 22 # This is very rough; check what is actually permitted for package
chris@168 23 # declarations
chris@168 24
chris@168 25 java_packages=`find "$hgdir" -type f -name \*.java -print | \
chris@168 26 xargs grep -h '^ *package [a-zA-Z][a-zA-Z0-9\._-]* *; *' | sort | uniq | \
chris@168 27 sed -e 's/^ *package //' -e 's/ *; *$//'`
chris@168 28
chris@168 29 echo "This project contains java packages:"
chris@168 30 echo "$java_packages"
chris@168 31
chris@168 32 # This won't work if code is in a subdir, e.g. src/com/example/project/Hello.java
chris@168 33
chris@168 34 javadoc -sourcepath "$hgdir" -d . -subpackages $java_packages -verbose
chris@168 35
chris@168 36 # If we have just written something to a doc directory that was
chris@168 37 # previously empty, we should switch on Embedded for this project