git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271596 13f79535-47bb-0310-9956-ffa450edef68master
@@ -83,11 +83,6 @@ public class AntSubTask extends TemplateSubTask { | |||||
* - and only throw BuildException if at all | * - and only throw BuildException if at all | ||||
*/ | */ | ||||
protected boolean matchesGenerationRules(ClassDoc clazz) throws XDocletException { | protected boolean matchesGenerationRules(ClassDoc clazz) throws XDocletException { | ||||
if (clazz.isAbstract()) { | |||||
return false; | |||||
} | |||||
return isAntTask(clazz);; | return isAntTask(clazz);; | ||||
} | } | ||||
@@ -124,8 +119,7 @@ public class AntSubTask extends TemplateSubTask { | |||||
String dir = getDestDir().getAbsolutePath(); | String dir = getDestDir().getAbsolutePath(); | ||||
if (filename.indexOf("{0}") != -1) { | if (filename.indexOf("{0}") != -1) { | ||||
PackageDoc pak = clazz.containingPackage(); | |||||
dir = PackageTagsHandler.packageNameAsPathFor(pak); | |||||
dir = AntTagsHandler.getCategoryName(clazz); | |||||
String taskName = AntTagsHandler.getTaskName(clazz); | String taskName = AntTagsHandler.getTaskName(clazz); | ||||
filename = MessageFormat.format(getDestinationFile(), new Object[]{taskName}); | filename = MessageFormat.format(getDestinationFile(), new Object[]{taskName}); | ||||
} | } | ||||
@@ -81,6 +81,9 @@ import java.util.Properties; | |||||
*/ | */ | ||||
public class AntTagsHandler extends XDocletTagSupport { | public class AntTagsHandler extends XDocletTagSupport { | ||||
/** Default category for tasks without a category attribute. */ | |||||
public static final String DEFAULT_CATEGORY = "other"; | |||||
/** | /** | ||||
* @todo add check for execute method | * @todo add check for execute method | ||||
*/ | */ | ||||
@@ -163,6 +166,7 @@ public class AntTagsHandler extends XDocletTagSupport { | |||||
* Provides the Ant task name. | * Provides the Ant task name. | ||||
* | * | ||||
* @see getTaskName | * @see getTaskName | ||||
* @doc:tag type="content" | |||||
*/ | */ | ||||
public String taskName() throws XDocletException { | public String taskName() throws XDocletException { | ||||
return getTaskName(getCurrentClass()); | return getTaskName(getCurrentClass()); | ||||
@@ -197,6 +201,33 @@ public class AntTagsHandler extends XDocletTagSupport { | |||||
} | } | ||||
/** | |||||
* Provides the Ant category name. | |||||
* | |||||
* @see getCategoryName | |||||
*/ | |||||
public String categoryName() throws XDocletException { | |||||
return getCategoryName(getCurrentClass()); | |||||
} | |||||
/** | |||||
* Provides the Ant category name as the Value of the category attribute, | |||||
* <code>@ant:task category="..."</code>. This attribute is mandatory. | |||||
*/ | |||||
public static final String getCategoryName(ClassDoc clazz) throws XDocletException { | |||||
String tagValue = getTagValue(clazz, "ant:task", "category", -1, | |||||
null, null, null, null, | |||||
null, false, XDocletTagSupport.FOR_CLASS, true); | |||||
if (tagValue != null) { | |||||
tagValue = tagValue.toLowerCase(); | |||||
} | |||||
else { | |||||
tagValue = DEFAULT_CATEGORY; | |||||
} | |||||
return tagValue; | |||||
} | |||||
/** | /** | ||||
* Returns true if the method corresponds to an Ant task attribute using | * Returns true if the method corresponds to an Ant task attribute using | ||||
* the rules from IntrospectionHelper | * the rules from IntrospectionHelper | ||||
@@ -1,6 +1,7 @@ | |||||
<XDtTagDef:tagDef namespace="Ant" handler="org.apache.tools.ant.xdoclet.AntTagsHandler"/> | <XDtTagDef:tagDef namespace="Ant" handler="org.apache.tools.ant.xdoclet.AntTagsHandler"/> | ||||
<task name="<XDtAnt:taskName/>" classname="<XDtClass:fullClassName/>"> | |||||
<task name="<XDtAnt:taskName/>" category="<XDtAnt:categoryName/>" | |||||
classname="<XDtClass:fullClassName/>"> | |||||
<short-description><![CDATA[<XDtClass:firstSentenceDescription/>]]></short-description> | <short-description><![CDATA[<XDtClass:firstSentenceDescription/>]]></short-description> | ||||
<long-description> | <long-description> | ||||