diff extra/soundsoftware/extract-javadoc.sh @ 178:2cec5c53cd68 feature_20

* Another minor stylesheet update, start hacking around with Doxyfiles
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Wed, 02 Feb 2011 17:04:56 +0000
parents c1e9f2dab1d5
children 3a353bd04976
line wrap: on
line diff
--- a/extra/soundsoftware/extract-javadoc.sh	Wed Feb 02 12:18:27 2011 +0000
+++ b/extra/soundsoftware/extract-javadoc.sh	Wed Feb 02 17:04:56 2011 +0000
@@ -18,18 +18,44 @@
 
 # TODO: Doxyfile
 
+doxyfile=`find "$hgdir" -type f -name Doxyfile -print | head -1`
+
+echo "This project contains a Doxyfile:"
+echo "$doxyfile"
+
+if [ -z "$doxyfile" ]; then
+    echo "No Doxyfile: skipping"
+else
+
+# hmm. should be a whitelist
+
+    ( cd "$hgdir" && grep -vi OUTPUT_DIRECTORY "$doxyfile" | grep -vi HTML_OUTPUT | sed -e '$a OUTPUT_DIRECTORY='"$docdir" -e '$a HTML_OUTPUT = .' | doxygen - )
+
+fi
 
 # This is very rough; check what is actually permitted for package
 # declarations
 
 java_packages=`find "$hgdir" -type f -name \*.java -print | \
-     xargs grep -h '^ *package [a-zA-Z][a-zA-Z0-9\._-]* *; *' | sort | uniq | \
-     sed -e 's/^ *package //' -e 's/ *; *$//'`
+    xargs grep -h '^ *package [a-zA-Z][a-zA-Z0-9\._-]* *; *' | \
+    sort | uniq | \
+    sed -e 's/^ *package //' -e 's/ *; *$//'`
 
-echo "This project contains java packages:"
+echo "This project contains Java packages:"
 echo "$java_packages"
 
-# This won't work if code is in a subdir, e.g. src/com/example/project/Hello.java
+if [ -z "$java_packages" ]; then
+    echo "No Java packages: skipping"
+    exit 0
+fi
+
+# This won't work if code is in a subdir,
+# e.g. src/com/example/project/Hello.java
+
+# We need to convert the package name back to a path, and check
+# whether that matches the tail of the path to a java file that
+# declares itself to be in that package... but we don't have that list
+# of java files to hand here... hm
 
 javadoc -sourcepath "$hgdir" -d . -subpackages $java_packages -verbose