Browse Source

Optionally create javadocs for packages that only contain a

package.html file.

PR: 25339


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278005 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 20 years ago
parent
commit
03c6952a50
3 changed files with 31 additions and 6 deletions
  1. +4
    -0
      WHATSNEW
  2. +11
    -2
      docs/manual/CoreTasks/javadoc.html
  3. +16
    -4
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java

+ 4
- 0
WHATSNEW View File

@@ -281,6 +281,10 @@ Other changes:
This was confusing so the definitions are now treated as similar. This was confusing so the definitions are now treated as similar.
Bugzilla Report 31215. Bugzilla Report 31215.


* <javadoc> has a new attribute "includenosourcepackages" that can be
used to document packages that don't hold source files but a
package.html file. Bugzilla Report 25339.

Fixed bugs: Fixed bugs:
----------- -----------




+ 11
- 2
docs/manual/CoreTasks/javadoc.html View File

@@ -433,6 +433,14 @@ means any VM of at least version 1.2.</p>
<td align="center" valign="top">1.4+</td> <td align="center" valign="top">1.4+</td>
<td align="center" valign="top">No</td> <td align="center" valign="top">No</td>
</tr> </tr>
<tr>
<td valign="top">includenosourcepackages</td>
<td valign="top">If set to true, packages that don't contain Java
source but a package.html will get documented as well.
<em>since Ant 1.6.3</em>.</td>
<td align="center" valign="top">all</td>
<td align="center" valign="top">No (default is <code>false</code>)</td>
</tr>
</table> </table>


<h4><a name="groupattribute">Format of the group attribute</a></h4> <h4><a name="groupattribute">Format of the group attribute</a></h4>
@@ -465,8 +473,9 @@ the nested <code>&lt;packageset&gt;</code> elements.</p>


<p>A <a href="../CoreTypes/fileset.html">FileSet</a>. All matched <p>A <a href="../CoreTypes/fileset.html">FileSet</a>. All matched
files will be passed to javadoc as source files. Ant will files will be passed to javadoc as source files. Ant will
automatically add the include pattern <code>**/*.java</code> to these
filesets.</p>
automatically add the include pattern <code>**/*.java</code> (and
<code>**/package.html</code> if inncludenosourcepackages is true) to
these filesets.</p>


<p>Nested filesets can be used to document sources that are in the <p>Nested filesets can be used to document sources that are in the
default package or if you want to exclude certain files from default package or if you want to exclude certain files from


+ 16
- 4
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -434,6 +434,7 @@ public class Javadoc extends Task {
private boolean linksource = false; private boolean linksource = false;
private boolean breakiterator = false; private boolean breakiterator = false;
private String noqualifier; private String noqualifier;
private boolean includeNoSourcePackages = false;


private Vector fileSets = new Vector(); private Vector fileSets = new Vector();
private Vector packageSets = new Vector(); private Vector packageSets = new Vector();
@@ -1623,6 +1624,15 @@ public class Javadoc extends Task {
this.noqualifier = noqualifier; this.noqualifier = noqualifier;
} }


/**
* If set to true, Ant will also accept packages that only hold
* package.html files but no Java sources.
* @since Ant 1.6.3
*/
public void setIncludeNoSourcePackages(boolean b) {
this.includeNoSourcePackages = b;
}

/** /**
* Execute the task. * Execute the task.
* @throws BuildException on error * @throws BuildException on error
@@ -2080,6 +2090,9 @@ public class Javadoc extends Task {
if (!fs.hasPatterns() && !fs.hasSelectors()) { if (!fs.hasPatterns() && !fs.hasSelectors()) {
fs = (FileSet) fs.clone(); fs = (FileSet) fs.clone();
fs.createInclude().setName("**/*.java"); fs.createInclude().setName("**/*.java");
if (includeNoSourcePackages) {
fs.createInclude().setName("**/package.html");
}
} }
File baseDir = fs.getDir(getProject()); File baseDir = fs.getDir(getProject());
DirectoryScanner ds = fs.getDirectoryScanner(getProject()); DirectoryScanner ds = fs.getDirectoryScanner(getProject());
@@ -2152,10 +2165,9 @@ public class Javadoc extends Task {
File pd = new File(baseDir, dirs[i]); File pd = new File(baseDir, dirs[i]);
String[] files = pd.list(new FilenameFilter () { String[] files = pd.list(new FilenameFilter () {
public boolean accept(File dir1, String name) { public boolean accept(File dir1, String name) {
if (name.endsWith(".java")) {
return true;
}
return false; // ignore dirs
return name.endsWith(".java")
|| (includeNoSourcePackages
&& name.equals("package.html"));
} }
}); });




Loading…
Cancel
Save