Author: bodewig
Date: Mon Nov 24 02:39:46 2008
New Revision: 720156
URL: http://svn.apache.org/viewvc?rev=720156&view=rev
Log:
Add attributes for javadoc's -docfilessubdirs and -excludedocfilessubdir CLI
args. PR 34455
Modified:
ant/core/trunk/WHATSNEW
ant/core/trunk/docs/manual/CoreTasks/javadoc.html
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
ant/core/trunk/src/tests/antunit/taskdefs/javadoc-test.xml
Modified: ant/core/trunk/WHATSNEW
URL:
http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=720156&r1=720155&r2=720156&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Mon Nov 24 02:39:46 2008
@@ -544,6 +544,10 @@
break the build if the archive doesn't exist.
Bugzilla Report 46091.
+ * <javadoc> has new attributes that correspond to the
+ -docfilessubdirs and -excludedocfilessubdir command line arguments.
+ Bugzilla Report 34455.
+
Changes from Ant 1.7.0 TO Ant 1.7.1
=============================================
Modified: ant/core/trunk/docs/manual/CoreTasks/javadoc.html
URL:
http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/javadoc.html?rev=720156&r1=720155&r2=720156&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/javadoc.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/javadoc.html Mon Nov 24 02:39:46 2008
@@ -487,6 +487,21 @@
<td align="center" valign="top">all</td>
<td align="center" valign="top">No</td>
</tr>
+ <tr>
+ <td valign="top">docfilessubdirs</td>
+ <td valign="top">Enables deep-copying of <code>doc-files</code>
+ subdirectories. Defaults to false. <em>since Ant 1.8.0</em>.</td>
+ <td align="center" valign="top">1.4</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">excludedocfilessubdir</td>
+ <td valign="top">Colon-separated list of <code>doc-files</code>'
+ subdirectories to exclude if <code>docfilessubdirs</code> is
+ true. <em>since Ant 1.8.0</em>.</td>
+ <td align="center" valign="top">1.4</td>
+ <td align="center" valign="top">No</td>
+ </tr>
</table>
<h4><a name="groupattribute">Format of the group attribute</a></h4>
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java?rev=720156&r1=720155&r2=720156&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java Mon Nov
24 02:39:46 2008
@@ -449,6 +449,8 @@
private String noqualifier;
private boolean includeNoSourcePackages = false;
private String executable = null;
+ private boolean docFilesSubDirs = false;
+ private String excludeDocFilesSubDir = null;
private ResourceCollectionContainer nestedSourceFiles
= new ResourceCollectionContainer();
@@ -1633,6 +1635,25 @@
}
/**
+ * Enables deep-copying of <code>doc-files</code> directories.
+ *
+ * @since Ant 1.8.0
+ */
+ public void setDocFilesSubDirs(boolean b) {
+ docFilesSubDirs = b;
+ }
+
+ /**
+ * Colon-separated list of <code>doc-files</code> subdirectories
+ * to skip if [EMAIL PROTECTED] #setDocFilesSubDirs docFilesSubDirs is
true}.
+ *
+ * @since Ant 1.8.0
+ */
+ public void setExcludeDocFilesSubDir(String s) {
+ excludeDocFilesSubDir = s;
+ }
+
+ /**
* Execute the task.
* @throws BuildException on error
*/
@@ -1673,6 +1694,7 @@
doLinks(toExecute); // links arguments
doGroup(toExecute); // group attribute
doGroups(toExecute); // groups attribute
+ doDocFilesSubDirs(toExecute); // docfilessubdir attribute
doJava14(toExecute);
if (breakiterator && (doclet == null || JAVADOC_5)) {
@@ -2131,6 +2153,17 @@
}
}
+ private void doDocFilesSubDirs(Commandline toExecute) {
+ if (docFilesSubDirs) {
+ toExecute.createArgument().setValue("-docfilessubdirs");
+ if (excludeDocFilesSubDir != null
+ && excludeDocFilesSubDir.trim().length() > 0) {
+ toExecute.createArgument().setValue("-excludedocfilessubdir");
+ toExecute.createArgument().setValue(excludeDocFilesSubDir);
+ }
+ }
+ }
+
private void doSourceAndPackageNames(
Commandline toExecute,
Vector packagesToDoc,
Modified: ant/core/trunk/src/tests/antunit/taskdefs/javadoc-test.xml
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/javadoc-test.xml?rev=720156&r1=720155&r2=720156&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/javadoc-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/javadoc-test.xml Mon Nov 24
02:39:46 2008
@@ -18,7 +18,7 @@
<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
<import file="../antunit-base.xml" />
- <target name="testBottomWithLineBreaksWithFile">
+ <target name="-makeTestClass">
<mkdir dir="${input}/test"/>
<echo file="${input}/test/A.java"><![CDATA[
package test;
@@ -33,6 +33,9 @@
public void foo(String bar) {}
}
]]></echo>
+ </target>
+
+ <target name="testBottomWithLineBreaksWithFile" depends="-makeTestClass">
<javadoc destdir="${output}" useexternalfile="true">
<fileset dir="${input}"/>
<bottom><![CDATA[
@@ -42,4 +45,46 @@
</javadoc>
<au:assertFileExists file="${output}/test/A.html"/>
</target>
+
+ <target name="-setUpDocFilesTests" depends="-makeTestClass">
+ <mkdir dir="${input}/test/doc-files/a"/>
+ <mkdir dir="${input}/test/doc-files/b"/>
+ <macrodef name="mkfoo">
+ <attribute name="file"/>
+ <sequential>
+ <echo file="@{file}"><![CDATA[<p>Hello, world!</p>]]></echo>
+ </sequential>
+ </macrodef>
+ <mkfoo file="${input}/test/doc-files/foo.html"/>
+ <mkfoo file="${input}/test/doc-files/a/foo.html"/>
+ <mkfoo file="${input}/test/doc-files/b/foo.html"/>
+ </target>
+
+ <target name="XtestNoDocFiles" depends="-setUpDocFilesTests">
+ <javadoc destdir="${output}">
+ <packageset dir="${input}"/>
+ </javadoc>
+ <au:assertFileExists file="${output}/test/doc-files/foo.html"/>
+ <au:assertFileDoesntExist file="${output}/test/doc-files/a/foo.html"/>
+ </target>
+
+ <target name="XtestDocFiles" depends="-setUpDocFilesTests">
+ <javadoc destdir="${output}" docfilessubdirs="true">
+ <packageset dir="${input}"/>
+ </javadoc>
+ <au:assertFileExists file="${output}/test/doc-files/foo.html"/>
+ <au:assertFileExists file="${output}/test/doc-files/a/foo.html"/>
+ <au:assertFileExists file="${output}/test/doc-files/b/foo.html"/>
+ </target>
+
+ <target name="XtestDocFilesWithExclude" depends="-setUpDocFilesTests">
+ <javadoc destdir="${output}" docfilessubdirs="true"
+ excludedocfilessubdir="a">
+ <packageset dir="${input}"/>
+ </javadoc>
+ <au:assertFileExists file="${output}/test/doc-files/foo.html"/>
+ <au:assertFileDoesntExist file="${output}/test/doc-files/a/foo.html"/>
+ <au:assertFileExists file="${output}/test/doc-files/b/foo.html"/>
+ </target>
+
</project>