Turn javadoc comments for packages and classes into key/value pairs in a properties file. Embed the properties file

in GenomeAnalysisTK.jar.  Still no support for actually displaying the archived javadoc.  Also change the approach 
to providing package javadocs: retired the deprecated package.html file in favor of Java1.5-style package-info.java.


git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2263 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2009-12-04 20:08:41 +00:00
parent c1263e841c
commit 4c147329a9
24 changed files with 181 additions and 169 deletions

View File

@ -2,7 +2,9 @@
<description>Compile and distribute the Sting toolkit</description>
<property name="source.dir" value="java/src" />
<property name="build.dir" value="build" />
<property name="dist.dir" value="dist" />
<property name="help.file" value="${build.dir}/help.properties" />
<property name="single" value="*Test" />
<property name="singleintegration" value="*IntegrationTest" />
@ -24,6 +26,25 @@
<property environment="env"/>
<property name="target" value="${env.STING_BUILD_TYPE}" />
<dirset id="source.files" dir="${source.dir}">
<patternset>
<include name="org/broadinstitute/sting/**"/>
<exclude name="**/playground/**" unless="include.playground" />
<exclude name="**/oneoffprojects/**" unless="include.oneoffs" />
</patternset>
</dirset>
<patternset id="dependency.mask" includes="*.jar">
<exclude name="junit*.jar" />
<exclude name="bcel*.jar" />
</patternset>
<path id="runtime.dependencies">
<fileset dir="lib">
<patternset refid="dependency.mask" />
</fileset>
</path>
<!-- ivy properties -->
<property name="ivy.install.version" value="2.0.0"/>
<property name="ivy.home" value="${user.home}/.ant"/>
@ -60,17 +81,6 @@
</or>
</condition>
<patternset id="dependency.mask" includes="*.jar">
<exclude name="junit*.jar" />
<exclude name="bcel*.jar" />
</patternset>
<path id="runtime.dependencies">
<fileset dir="lib">
<patternset refid="dependency.mask" />
</fileset>
</path>
<!-- Create the build directory structure used by compile -->
<mkdir dir="build"/>
</target>
@ -84,7 +94,17 @@
</javac>
</target>
<target name="dist" depends="compile"
<target name="extracthelp" depends="compile"
description="Extract help key/value pair file from the JavaDoc tags.">
<javadoc doclet="org.broadinstitute.sting.utils.doc.HelpExtractorDoclet"
docletpath="build"
classpathref="runtime.dependencies"
additionalparam="-out ${help.file}">
<packageset refid="source.files"/>
</javadoc>
</target>
<target name="dist" depends="compile,extracthelp"
description="generate the distribution">
<mkdir dir="${dist.dir}"/>
<delete>
@ -101,6 +121,7 @@
<jar jarfile="${dist.dir}/GenomeAnalysisTK.jar">
<fileset dir="build">
<include name="help.properties" />
<include name="**/gatk/**/*.class" />
<include name="**/alignment/**/*.class"/>
<include name="**/oneoffprojects/**/*.class" />
@ -251,8 +272,8 @@
<!-- where to put reports and tests-->
<property name="report" value="build/report"/>
<property name="test.classes" value="build/testclasses"/>
<property name="report" value="${build.dir}/report"/>
<property name="test.classes" value="${build.dir}/testclasses"/>
<property name="test.output" value="${dist.dir}/test"/>
<property name="test.sources" value="java/test"/>
@ -261,7 +282,7 @@
<mkdir dir="${report}"/>
<echo message="Sting: Running test cases!"/>
<junit printsummary="yes" showoutput="yes" clonevm="yes" haltonfailure="${halt}" failureProperty="test.failure">
<jvmarg value="-javaagent:build/TestAgent.jar"/>
<jvmarg value="-javaagent:${build.dir}/TestAgent.jar"/>
<formatter type="${testOutput}" usefile="${usefile}" />
<classpath>
<path refid="runtime.dependencies"/>
@ -306,7 +327,7 @@
<!-- this builds the instrumentation library we're going to use for test cases -->
<target name="agent" description="build the agent">
<echo message="Sting: Creating test agent!"/>
<jar jarfile="build/TestAgent.jar">
<jar jarfile="${build.dir}/TestAgent.jar">
<fileset dir="build">
<include name="**/TrivialInstrumenter.class" />
</fileset>
@ -322,13 +343,7 @@
<mkdir dir="javadoc"/>
<javadoc destdir="javadoc"
classpathref="runtime.dependencies">
<fileset dir="${source.dir}">
<patternset>
<include name="**/*.java"/>
<exclude name="**/playground/**" unless="include.playground"/>
<exclude name="**/oneoffprojects/**" unless="include.oneoffs"/>
</patternset>
</fileset>
<packageset refid="source.files"/>
</javadoc>
</target>

View File

@ -0,0 +1,5 @@
/**
* Provides efficient access to GATK primary data sources
* such as SAM files, fasta files, and reference-ordered data.
*/
package org.broadinstitute.sting.gatk.datasources;

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
Provides efficient access to GATK primary data sources
such as SAM files, fasta files, and reference-ordered data.
</body>
</html>

View File

@ -0,0 +1,6 @@
/**
* Provides a bridge from the block-at-a-time data access provided by
* the datasource system to the locus / read-at-a-time data access
* required by the traversal engine.
*/
package org.broadinstitute.sting.gatk.datasources.providers;

View File

@ -1,12 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
Provides a bridge from the block-at-a-time data access provided by
the datasource system to the locus / read-at-a-time data access
required by the traversal engine.
</body>
</html>

View File

@ -0,0 +1,6 @@
/**
* Divides core input data into manageable blocks, each representing
* a subsection of data that is small enough to be processed by a single
* worker.
*/
package org.broadinstitute.sting.gatk.datasources.shards;

View File

@ -1,12 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
Divides core input data into manageable blocks, each representing
a subsection of data that is small enough to be processed by a single
worker.
</body>
</html>

View File

@ -0,0 +1,6 @@
/**
* Retrieves core GATK data, given a shard which represents a contiguous
* subsequence of core GATK data (reads, reference, or reference-ordered
* data).
*/
package org.broadinstitute.sting.gatk.datasources.simpleDataSources;

View File

@ -1,12 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
Retrieves core GATK data, given a shard which represents a contiguous
subsequence of core GATK data (reads, reference, or reference-ordered
data).
</body>
</html>

View File

@ -0,0 +1,4 @@
/**
* Manages individual analyses by shattering data, pushing individual shards to the traversal engines, and gathering results and presenting them to the user.
*/
package org.broadinstitute.sting.gatk.executive;

View File

@ -1,10 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
Manages individual analyses by shattering data, pushing individual shards to the traversal engines, and gathering results and presenting them to the user.
</body>
</html>

View File

@ -0,0 +1,4 @@
/**
* Provides a commonly used set of filters for determining which data should and should not be applied.
*/
package org.broadinstitute.sting.gatk.filters;

View File

@ -1,34 +0,0 @@
<!--
~ Copyright (c) 2009 The Broad Institute
~ Permission is hereby granted, free of charge, to any person
~ obtaining a copy of this software and associated documentation
~ files (the "Software"), to deal in the Software without
~ restriction, including without limitation the rights to use,
~ copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the
~ Software is furnished to do so, subject to the following
~ conditions:
~
~ The above copyright notice and this permission notice shall be
~ included in all copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
~ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
~ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
~ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
~ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
~ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
~ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
~ OTHER DEALINGS IN THE SOFTWARE.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body>
Provides a commonly used set of filters for determining which data should and should not be applied.
</body>
</html>

View File

@ -0,0 +1,4 @@
/**
* Tools for iterating over different views of GATK data.
*/
package org.broadinstitute.sting.gatk.iterators;

View File

@ -1,10 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
Tools for iterating over different views of GATK data.
</body>
</html>

View File

@ -0,0 +1,5 @@
/**
* Provides map/reduce application framework highly optimized for
* analysis of sequencing data.
*/
package org.broadinstitute.sting.gatk;

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
Provides map/reduce application framework highly optimized for
analysis of sequencing data.
</body>
</html>

View File

@ -0,0 +1,5 @@
/**
* Reads and preprocesses the various types of data represented by the
* GATK.
*/
package org.broadinstitute.sting.gatk.refdata;

View File

@ -1,10 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
Reads and preprocesses the various types of data represented by the
GATK.
</body>
</html>

View File

@ -0,0 +1,5 @@
/**
* Traverses over a shard of data, performing a mini-map/reduce on that
* dataset.
*/
package org.broadinstitute.sting.gatk.traversals;

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
Traverses over a shard of data, performing a mini-map/reduce on that
dataset.
</body>
</html>

View File

@ -0,0 +1,6 @@
/**
* Runs the desired analysis on the smallest meaningful subset of the
* dataset. Traditionally, the smallest subset is either an individual
* locus or read.
*/
package org.broadinstitute.sting.gatk.walkers;

View File

@ -1,13 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
Runs the desired analysis on the smallest meaningful subset of the
dataset. Traditionally, the smallest subset is either an individual
locus or read.
</body>
</html>

View File

@ -0,0 +1,87 @@
package org.broadinstitute.sting.utils.doc;
import com.sun.javadoc.RootDoc;
import com.sun.javadoc.PackageDoc;
import com.sun.javadoc.ClassDoc;
import java.util.HashSet;
import java.util.Set;
import java.util.Scanner;
import java.io.PrintStream;
import java.io.FileNotFoundException;
/**
* Extracts certain types of javadoc (specifically package and class descriptions) and makes them available
* to applications at runtime.
*
* @author mhanna
* @version 0.1
*/
public class HelpExtractorDoclet {
/**
* Extracts the contents of certain types of javadoc and adds them to an XML file.
* @param rootDoc The documentation root.
* @return Whether the JavaDoc run succeeded.
*/
public static boolean start(RootDoc rootDoc) throws FileNotFoundException {
PrintStream out = System.out;
for(String[] options: rootDoc.options()) {
if(options[0].equals("-out"))
out = new PrintStream(options[1]);
}
// Cache packages as we see them, since there's no direct way to iterate over packages.
Set<PackageDoc> packages = new HashSet<PackageDoc>();
for(ClassDoc currentClass: rootDoc.classes()) {
PackageDoc containingPackage = currentClass.containingPackage();
packages.add(containingPackage);
String className = containingPackage.name().length() > 0 ?
String.format("%s.%s",containingPackage.name(),currentClass.name()) :
String.format("%s",currentClass.name());
String commentText = formatText(currentClass.commentText());
if(commentText.length() > 0)
out.printf("%s=%s%n",className,commentText);
}
for(PackageDoc currentPackage: packages) {
String commentText = formatText(currentPackage.commentText());
if(commentText.length() > 0)
out.printf("%s=%s%n",currentPackage.name(),commentText);
}
return true;
}
/**
* Validate the given options against
* @param option
* @return
*/
public static int optionLength(String option) {
if(option.equals("-out")) {
return 2;
}
return 0;
}
/**
* Format text for consumption by the properties file.
* @param text Text to format.
* @return Formatted text; string trimmed, newlines removed.
*/
private static String formatText(String text) {
Scanner scanner = new Scanner(text);
StringBuilder output = new StringBuilder();
while(scanner.hasNextLine()) {
if(output.length() > 0)
output.append(' ');
output.append(scanner.nextLine().trim());
}
return output.toString();
}
}