Add the svn version on the fly to the version number properties.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2607 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2010-01-16 00:28:01 +00:00
parent 420cef4094
commit ac4756db20
2 changed files with 17 additions and 6 deletions

View File

@ -99,10 +99,13 @@
<target name="extracthelp" depends="compile"
description="Extract help key/value pair file from the JavaDoc tags."
unless="disable.help">
<exec executable="svnversion" outputproperty="svn.version" failonerror="true">
<arg value="--no-newline" />
</exec>
<javadoc doclet="org.broadinstitute.sting.utils.help.ResourceBundleExtractorDoclet"
docletpath="build"
classpathref="runtime.dependencies"
additionalparam="-out ${build.dir}/${resource.file}">
additionalparam="-version-suffix .${svn.version} -out ${build.dir}/${resource.file}">
<packageset refid="source.files"/>
</javadoc>
</target>

View File

@ -31,10 +31,15 @@ public class ResourceBundleExtractorDoclet {
*/
public static boolean start(RootDoc rootDoc) throws FileNotFoundException {
PrintStream out = System.out;
String versionPrefix = null, versionSuffix = null;
for(String[] options: rootDoc.options()) {
if(options[0].equals("-out"))
out = new PrintStream(options[1]);
if(options[0].equals("-version-prefix"))
versionPrefix = options[1];
if(options[0].equals("-version-suffix"))
versionSuffix = options[1];
}
// Cache packages as we see them, since there's no direct way to iterate over packages.
@ -47,11 +52,11 @@ public class ResourceBundleExtractorDoclet {
String.format("%s.%s",containingPackage.name(),currentClass.name()) :
String.format("%s",currentClass.name());
renderHelpText(className,currentClass,out);
renderHelpText(className,currentClass,out,versionPrefix,versionSuffix);
}
for(PackageDoc currentPackage: packages)
renderHelpText(currentPackage.name(),currentPackage,out);
renderHelpText(currentPackage.name(),currentPackage,out,versionPrefix,versionSuffix);
return true;
}
@ -62,7 +67,7 @@ public class ResourceBundleExtractorDoclet {
* @return Number of potential parameters; 0 if not supported.
*/
public static int optionLength(String option) {
if(option.equals("-out")) {
if(option.equals("-out") || option.equals("-version-prefix") || option.equals("-version-suffix")) {
return 2;
}
return 0;
@ -73,8 +78,9 @@ public class ResourceBundleExtractorDoclet {
* @param elementName element name to use as the key
* @param element Doc element to process.
* @param out Output stream to which to write.
* @param versionSuffix Text to add to the end of the version string.
*/
private static void renderHelpText(String elementName, Doc element, PrintStream out) {
private static void renderHelpText(String elementName, Doc element, PrintStream out, String versionPrefix, String versionSuffix) {
// Extract overrides from the doc tags.
String name = null;
String version = null;
@ -91,7 +97,9 @@ public class ResourceBundleExtractorDoclet {
name = tag.text();
}
else if(tag.name().equals("@"+VERSION_TAGLET_NAME))
version = tag.text();
version = String.format("%s%s%s", (versionPrefix != null) ? versionPrefix : "",
tag.text(),
(versionSuffix != null) ? versionSuffix : "");
else if(tag.name().equals("@"+SummaryTaglet.NAME))
summary = tag.text();
else if(tag.name().equals("@"+DescriptionTaglet.NAME))