git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@720156 13f79535-47bb-0310-9956-ffa450edef68master
@@ -544,6 +544,10 @@ Other changes: | |||
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 | |||
============================================= | |||
@@ -487,6 +487,21 @@ to <javadoc> using <tt>classpath</tt>, <tt>classpathref</tt> attributes or | |||
<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> | |||
@@ -449,6 +449,8 @@ public class Javadoc extends Task { | |||
private String noqualifier; | |||
private boolean includeNoSourcePackages = false; | |||
private String executable = null; | |||
private boolean docFilesSubDirs = false; | |||
private String excludeDocFilesSubDir = null; | |||
private ResourceCollectionContainer nestedSourceFiles | |||
= new ResourceCollectionContainer(); | |||
@@ -1632,6 +1634,25 @@ public class Javadoc extends Task { | |||
this.includeNoSourcePackages = b; | |||
} | |||
/** | |||
* 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 {@link #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 @@ public class Javadoc extends Task { | |||
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 @@ public class Javadoc extends Task { | |||
} | |||
} | |||
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, | |||
@@ -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 class A { | |||
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 @@ Hello World | |||
</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> |