diff --git a/WHATSNEW b/WHATSNEW index 48c39d73d..a896217b8 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -234,6 +234,9 @@ Other changes: possible to save the output into a property for use within the build file as was possible with in Ant 1.5 +* The task subelement has been enhanced to allow files + with tag mappings to be used. + Changes from Ant 1.5.1Beta1 to 1.5.1 ==================================== diff --git a/docs/manual/CoreTasks/javadoc.html b/docs/manual/CoreTasks/javadoc.html index 185e81fa4..2a0fed68c 100644 --- a/docs/manual/CoreTasks/javadoc.html +++ b/docs/manual/CoreTasks/javadoc.html @@ -22,16 +22,16 @@ this task is used much less frequently.

1.2 and 1.4), with the obvious restriction that the 1.2 attributes will be ignored if run in a 1.1 VM.

NOTE: since javadoc calls System.exit(), javadoc cannot be run inside the -same VM as ant without breaking functionality. For this reason, this task +same VM as ant without breaking functionality. For this reason, this task always forks the VM. This overhead is not significant since javadoc is normally a heavy application and will be called infrequently.

-

NOTE: the packagelist attribute allows you to specify the list of packages to -document outside of the Ant file. It's a much better practice to include everything -inside the build.xml file. This option was added in order to make it easier to -migrate from regular makefiles, where you would use this option of javadoc. -The packages listed in packagelist are not checked, so the task performs even -if some packages are missing or broken. Use this option if you wish to convert from -an existing makefile. Once things are running you should then switch to the regular +

NOTE: the packagelist attribute allows you to specify the list of packages to +document outside of the Ant file. It's a much better practice to include everything +inside the build.xml file. This option was added in order to make it easier to +migrate from regular makefiles, where you would use this option of javadoc. +The packages listed in packagelist are not checked, so the task performs even +if some packages are missing or broken. Use this option if you wish to convert from +an existing makefile. Once things are running you should then switch to the regular notation.

DEPRECATION: the javadoc2 task simply points to the javadoc task and it's @@ -462,7 +462,7 @@ the nested <fileset> elements.

Yes - +

excludepackage

Same as one entry in the list given by excludepackagenames.

@@ -523,7 +523,7 @@ specify multiple occurrences of the arguments.

offline - True if this link is not available online at the time of + True if this link is not available online at the time of generating the documentation No @@ -534,8 +534,8 @@ specify multiple occurrences of the arguments.

Only if the offline attribute is true - -

group

+ +

group

Separates packages on the overview page into whatever groups you specify, one group per table. This performs the same role as the group attribute. You can use either syntax (or both at once), but with the @@ -566,15 +566,15 @@ with text contents, and the packages may be listed with nested <package> elements as for the main task.

doclet

-

The doclet nested element is used to specify the doclet that javadoc will +

The doclet nested element is used to specify the doclet that javadoc will use to process the input source files. A number of the standard javadoc arguments are actually arguments of the standard doclet. If these are specified in the javadoc -task's attributes, they will be passed to the doclet specified in the -<doclet> nested element. Such attributes should only be specified, +task's attributes, they will be passed to the doclet specified in the +<doclet> nested element. Such attributes should only be specified, therefore, if they can be interpreted by the doclet in use.

If the doclet requires additional parameters, these can be specified with -<param> elements within the <doclet> +<param> elements within the <doclet> element. These paramaters are restricted to simple strings. An example usage of the doclet element is shown below:

@@ -587,7 +587,7 @@ of the doclet element is shown below:

</javadoc> -

tag

+

tag

The tag nested element is used to specify custom tags. This option is only available with Java 1.4.

@@ -602,12 +602,12 @@ is only available with Java 1.4.

name Name of the tag (e.g. todo) - Yes + Yes, unless the dir attribute is specified. description Description for tag (e.g. To do:) - Yes + Yes, unless the dir attribute is specified. enabled @@ -617,15 +617,32 @@ is only available with Java 1.4.

scope Scope for the tag - the elements in which it can be used. This - is a comma separated list of some of the elements: overview, - packages, types, constructors, + is a comma separated list of some of the elements: overview, + packages, types, constructors, methods, fields or the default, all. No + + dir + If this attribute is specified, this element will behave as an implicit + fileset. The files included by this fileset should + contain each tag definition on a separate line, as described in the + javadoc reference guide: +

+ + ejb.bean:t:"XDoclet EJB Tag"
+ todo:a:"To Do"
+
+

+ Note: If this attribute is specified, all the other attributes in this + element will be ignored. + + No + -

taglet

-

The taglet nested element is used to specify custom taglets. This option is +

taglet

+

The taglet nested element is used to specify custom taglets. This option is only available with Java 1.4.

Parameters
@@ -637,7 +654,7 @@ only available with Java 1.4.

name - The name of the taglet class + The name of the taglet class (e.g. com.sun.tools.doclets.ToDoTaglet) Yes @@ -675,10 +692,10 @@ respectively.

<link offline="true" href="http://java.sun.com/products/jdk/1.2/docs/api/" packagelistLoc="C:\tmp"/> <link href="http://developer.java.sun.com/developer/products/xml/docs/api/"/> </javadoc> - +

is the same as

-
  <javadoc 
+
  <javadoc
            destdir="docs/api"
            author="true"
            version="true"
@@ -700,8 +717,8 @@ respectively.

</javadoc>

or

- -
  <javadoc 
+
+
  <javadoc
            destdir="docs/api"
            author="true"
            version="true"
@@ -723,7 +740,7 @@ respectively.

</javadoc>

-

Copyright © 2000-2002 Apache Software Foundation. All rights +

Copyright © 2000-2003 Apache Software Foundation. All rights Reserved.

diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java index 8459a5392..b277d1bb0 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java @@ -58,6 +58,8 @@ import java.io.FileWriter; import java.io.FilenameFilter; import java.io.IOException; import java.io.PrintWriter; +import java.io.BufferedReader; +import java.io.FileReader; import java.net.MalformedURLException; import java.net.URL; import java.util.Enumeration; @@ -1244,7 +1246,7 @@ public class Javadoc extends Task { /** * Class representing a -tag argument. */ - public class TagArgument { + public class TagArgument extends FileSet { /** Name of the tag. */ private String name = null; /** Description of the tag to place in the JavaDocs. */ @@ -1468,7 +1470,7 @@ public class Javadoc extends Task { */ public void setSource(String source) { if (!javadoc4) { - log ("-source option not supported on JavaDoc < 1.4", + log ("-source option not supported on JavaDoc < 1.4", Project.MSG_VERBOSE); } this.source = source; @@ -1744,8 +1746,32 @@ public class Javadoc extends Task { Object element = e.nextElement(); if (element instanceof TagArgument) { TagArgument ta = (TagArgument) element; - toExecute.createArgument().setValue ("-tag"); - toExecute.createArgument().setValue (ta.getParameter()); + File tagDir = ta.getDir(getProject()); + if (tagDir == null ) { + // The tag element is not used as a fileset, + // but specifies the tag directly. + toExecute.createArgument().setValue ("-tag"); + toExecute.createArgument().setValue (ta.getParameter()); + } else { + // The tag element is used as a fileset. Parse all the files and + // create -tag arguments. + DirectoryScanner tagDefScanner = ta.getDirectoryScanner(getProject()); + String[] files = tagDefScanner.getIncludedFiles(); + for (int i = 0; i < files.length; i++) { + File tagDefFile = new File( tagDir, files[i] ); + try { + BufferedReader in = new BufferedReader( new FileReader(tagDefFile) ); + String line = null; + while( (line = in.readLine()) != null ) { + toExecute.createArgument().setValue ("-tag"); + toExecute.createArgument().setValue (line); + } + in.close(); + } catch( IOException ioe ) { + throw new BuildException( "Couldn't read tag file from " + tagDefFile.getAbsolutePath(), ioe ); + } + } + } } else { ExtensionInfo tagletInfo = (ExtensionInfo) element; toExecute.createArgument().setValue("-taglet");