git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271763 13f79535-47bb-0310-9956-ffa450edef68master
@@ -18,6 +18,7 @@ Legal: | |||
<property name="build.dir" value="build"/> | |||
<property name="build.lib" value="${build.dir}/lib"/> | |||
<property name="build.custom-tasks" value="${build.dir}/tasks"/> | |||
<property name="src.base" value="src"/> | |||
<property name="java.dir" value="${src.base}/java"/> | |||
@@ -36,6 +37,7 @@ Legal: | |||
<include name="*.jar" /> | |||
</fileset> | |||
<pathelement path="${build.classes}" /> | |||
<pathelement path="${build.custom-tasks}" /> | |||
</path> | |||
<!-- Main target --> | |||
@@ -59,6 +61,7 @@ Legal: | |||
<fileset dir="${java.dir}"> | |||
<patternset refid="antlib.include"/> | |||
</fileset> | |||
<!-- antdoc docsDestDir="${gen.dir}/docs"/--> | |||
</antlib-descriptor> | |||
</target> | |||
@@ -185,12 +185,15 @@ Legal: | |||
<!-- Compiles and installs the custom build tasks --> | |||
<target name="custom-tasks"> | |||
<property name="custom-tasks-dir" value="${build.dir}/tasks"/> | |||
<property name="custom-package-dir" value="${custom-tasks-dir}/org/apache/myrmidon/build"/> | |||
<mkdir dir="${custom-tasks-dir}"/> | |||
<javac srcdir="src/make" destdir="${custom-tasks-dir}"> | |||
<classpath refid="project.class.path"/> | |||
</javac> | |||
<copy file="${manifest.dir}/ant-descriptor.template" todir="${build.dir}/tasks"/> | |||
<copy file="${manifest.dir}/ant-roles.template" todir="${build.dir}/tasks"/> | |||
<copy file="${manifest.dir}/ant-descriptor.template" tofile="${custom-package-dir}/ant-descriptor.j"/> | |||
<copy file="${manifest.dir}/ant-roles.template" tofile="${custom-package-dir}/ant-roles.j"/> | |||
<copy file="${manifest.dir}/type.j" tofile="${custom-package-dir}/type.j"/> | |||
<taskdef name="antlib-jar" classname="org.apache.myrmidon.build.AntlibJarTask"> | |||
<classpath location="${custom-tasks-dir}"/> | |||
@@ -320,6 +323,15 @@ Legal: | |||
<include name="org/apache/myrmidon/launcher/*" /> | |||
</patternset> | |||
<patternset id="myrmidon-api-xdoclet.include"> | |||
<include name="org/apache/myrmidon/api/*" /> | |||
<include name="org/apache/myrmidon/aspects/*" /> | |||
<include name="org/apache/myrmidon/interfaces/**" /> | |||
<include name="org/apache/myrmidon/listeners/*" /> | |||
<include name="org/apache/myrmidon/framework/**" /> | |||
<include name="org/apache/aut/converter/**" /> | |||
</patternset> | |||
<patternset id="myrmidon-api.include"> | |||
<include name="org/apache/myrmidon/api/*" /> | |||
<include name="org/apache/myrmidon/aspects/*" /> | |||
@@ -357,12 +369,13 @@ Legal: | |||
<!-- The "builtin" descriptors include metainfo for both | |||
myrmidon-api and myrmidon-container jars. | |||
(Packaged with myrmidon-api.jar). --> | |||
<antlib-descriptor libName="builtin" | |||
destdir="${gen.dir}" | |||
classpathref="project.class.path"> | |||
<fileset dir="${java.dir}"> | |||
<patternset refid="myrmidon-api.include"/> | |||
<patternset refid="myrmidon-container.include"/> | |||
<patternset refid="myrmidon-api-xdoclet.include"/> | |||
<!-- <patternset refid="myrmidon-container.include"/>--> | |||
</fileset> | |||
</antlib-descriptor> | |||
@@ -373,6 +386,7 @@ Legal: | |||
<patternset refid="selftest.include"/> | |||
</fileset> | |||
</antlib-descriptor> | |||
</target> | |||
<!-- Package the jar files --> | |||
@@ -0,0 +1,87 @@ | |||
/* | |||
* Copyright (C) The Apache Software Foundation. All rights reserved. | |||
* | |||
* This software is published under the terms of the Apache Software License | |||
* version 1.1, a copy of which has been included with this distribution in | |||
* the LICENSE.txt file. | |||
*/ | |||
package org.apache.myrmidon.build; | |||
import com.sun.javadoc.ClassDoc; | |||
import java.io.File; | |||
import java.net.URL; | |||
import xdoclet.TemplateSubTask; | |||
import xdoclet.XDocletException; | |||
/** | |||
* Generates the XML Documentation for Ant types (including tasks and DataTypes). | |||
* | |||
* @author <a href="mailto:peter@apache.org">Peter Donald</a> | |||
* @version $Revision$ $Date$ | |||
*/ | |||
public class AntDocSubTask | |||
extends TemplateSubTask | |||
{ | |||
public final static String SUBTASK_NAME = "antdoc"; | |||
private static final String GENERATED_FILE_NAME = "{0}.xml"; | |||
private static final String DEFAULT_TEMPLATE_FILE = | |||
"/org/apache/myrmidon/build/type.j"; | |||
private File m_docsDestDir; | |||
public AntDocSubTask() | |||
{ | |||
setTemplateFile( new File( DEFAULT_TEMPLATE_FILE ) ); | |||
setDestinationFile( GENERATED_FILE_NAME ); | |||
final TemplateSubTask.ExtentTypes extent = new TemplateSubTask.ExtentTypes(); | |||
extent.setValue( "hierarchy" ); | |||
setExtent( extent ); | |||
} | |||
/** | |||
* Specifies the directory that is the destination of generated generated | |||
* xml documentation for types. | |||
*/ | |||
public void setDocsDestDir( final File docsDestDir ) | |||
{ | |||
m_docsDestDir = docsDestDir; | |||
} | |||
public String getSubTaskName() | |||
{ | |||
return SUBTASK_NAME; | |||
} | |||
/** | |||
* Called to validate configuration parameters. | |||
*/ | |||
public void validateOptions() | |||
throws XDocletException | |||
{ | |||
super.validateOptions(); | |||
if( null == m_docsDestDir ) | |||
{ | |||
throw new XDocletException( "'docsDestDir' attribute is missing ." ); | |||
} | |||
} | |||
protected boolean matchesGenerationRules( final ClassDoc clazz ) | |||
throws XDocletException | |||
{ | |||
if( !super.matchesGenerationRules( clazz ) ) | |||
{ | |||
return false; | |||
} | |||
else if( clazz.isAbstract() ) | |||
{ | |||
return false; | |||
} | |||
else | |||
{ | |||
return true; | |||
} | |||
} | |||
} |
@@ -25,13 +25,14 @@ import xdoclet.TemplateSubTask; | |||
public class AntlibDescriptorTask | |||
extends DocletTask | |||
{ | |||
private static final String DESCRIPTOR_TEMPLATE = "/org/apache/myrmidon/build/ant-descriptor.j"; | |||
private static final String ROLES_TEMPLATE = "/org/apache/myrmidon/build/ant-roles.j"; | |||
private TemplateSubTask m_antDocs; | |||
private String m_libName; | |||
private String m_descriptorFileName; | |||
private String m_rolesFileName; | |||
private static final String DESCRIPTOR_TEMPLATE = "/ant-descriptor.template"; | |||
private static final String ROLES_TEMPLATE = "/ant-roles.template"; | |||
/** | |||
* Specifies the Antlib name, which is used to name the generated files. | |||
*/ | |||
@@ -56,6 +57,11 @@ public class AntlibDescriptorTask | |||
m_rolesFileName = rolesFileName; | |||
} | |||
public void addAntdoc( final AntDocSubTask antDocs ) | |||
{ | |||
m_antDocs = antDocs; | |||
} | |||
public void execute() throws BuildException | |||
{ | |||
// Add the base directories of all the filesets to the sourcepath | |||
@@ -76,6 +82,11 @@ public class AntlibDescriptorTask | |||
makeTemplateSubTask( ROLES_TEMPLATE, getRolesFileName() ); | |||
addTemplate( rolesTemplate ); | |||
if( null != m_antDocs ) | |||
{ | |||
addTemplate( m_antDocs ); | |||
} | |||
if( !upToDate() ) | |||
{ | |||
log( "Generating Antlib descriptors for: " + m_libName ); | |||