Browse Source

Merge branch '1.9.x'

master
Stefan Bodewig 6 years ago
parent
commit
872a9bcded
3 changed files with 199 additions and 10 deletions
  1. +3
    -0
      WHATSNEW
  2. +64
    -7
      manual/Tasks/javadoc.html
  3. +132
    -3
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java

+ 3
- 0
WHATSNEW View File

@@ -46,6 +46,9 @@ Other changes:
command line arguments that are not supported explicitly by the
tasks via attributes.

* added several attributes to <javadoc> that support modules.
Bugzilla Report 62424

Changes from Ant 1.10.4 TO Ant 1.10.5
=====================================



+ 64
- 7
manual/Tasks/javadoc.html View File

@@ -89,8 +89,9 @@ with the <var>exclude</var> patterns of the <code>packageset</code> (and vice ve
<td>sourcepath</td>
<td>Specify where to find source files</td>
<td>all</td>
<td rowspan="3">At least one of the three or
nested <code>&lt;sourcepath&gt;</code>, <code>&lt;fileset&gt;</code>
<td rowspan="4">At least one of the three or
nested <code>&lt;sourcepath&gt;</code>, <code>&lt;fileset&gt;</code>,
<code>module</code> or <code>&lt;packageset&gt;</code></td>
or <code>&lt;packageset&gt;</code></td>
</tr>
<tr>
@@ -105,6 +106,12 @@ with the <var>exclude</var> patterns of the <code>packageset</code> (and vice ve
element.</td>
<td class="left">all</td>
</tr>
<tr>
<td>modulenames</td>
<td>Comma separated list of module names -- see also
the nested <code>module</code> element. <em>since Ant 1.10.6</em></td>
<td>all</td>
</tr>
<tr>
<td>destdir</td>
<td>Destination directory for output files</td>
@@ -500,6 +507,36 @@ with the <var>exclude</var> patterns of the <code>packageset</code> (and vice ve
<td>1.4</td>
<td>No; defaults to <q>true</q></td>
</tr>
<tr>
<td>modulesourcepath</td>
<td>Specify where to find module source files
<em>since Ant 1.10.6</em></td>
<td>all</td>
<td>No</td>
</tr>
<tr>
<td>modulesourcepathref</td>
<td>Specify where to find module source files by <a
href="../using.html#references">reference</a> to a PATH defined elsewhere.
<em>since Ant 1.10.6</em></td>
<td>all</td>
<td>No</td>
</tr>
<tr>
<td>modulepath</td>
<td>Specify where to find module files
<em>since Ant 1.10.6</em></td>
<td>all</td>
<td>No</td>
</tr>
<tr>
<td>modulepathref</td>
<td>Specify where to find module files by <a
href="../using.html#references">reference</a> to a PATH defined elsewhere.
<em>since Ant 1.10.6</em></td>
<td>all</td>
<td>No</td>
</tr>
</table>

<h4 id="groupattribute">Format of the group attribute</h4>
@@ -567,6 +604,24 @@ filesets, filelists or paths) will be passed to javadoc as source files.</p>
<h5>Parameters</h5>
Same as for <code>package</code>.

<h4>module</h4>
<p><em>since Ant 1.10.6</em></p>
<p>Same as one entry in the list given by <code>modulenames</code>.</p>

<h5>Parameters</h5>
<table width="90%" border="1" cellpadding="2" cellspacing="0">
<tr>
<td scope="col"><b>Attribute</b></td>
<td scope="col"><b>Description</b></td>
<td scope="col"><b>Required</b></td>
</tr>
<tr>
<td>name</td>
<td>The module name</td>
<td>Yes</td>
</tr>
</table>

<h4>source</h4>
<p>Same as one entry in the list given by <var>sourcefiles</var>.</p>

@@ -786,11 +841,13 @@ target="_top">the default taglets</a>.</p>
</tr>
</table>

<h4>sourcepath, classpath and bootclasspath</h4>
<p><code>Javadoc</code>'s <var>sourcepath</var>, <var>classpath</var> and <var>bootclasspath</var>
attributes are <a href="../using.html#path">path-like structure</a> and can also be set via
nested <code>sourcepath</code>, <code>classpath</code> and <code>bootclasspath</code> elements
respectively.</p>
<h4>sourcepath, classpath, bootclasspath, modulepath, modulesourcepath</h4>
<p><code>Javadoc</code>'s <i>sourcepath</i>, <i>classpath</i>,
<i>bootclasspath</i>, <i>modulepath</i>, and <i>modulesourcepath</i>
attributes are <a href="../using.html#path">PATH like structure</a>
and can also be set via nested <i>sourcepath</i>,
<i>classpath</i>, <i>bootclasspath</i>, <i>modulepath</i>,
and <i>modulesourcepath</i> elements respectively.</p>

<h4>arg</h4>
<p><em>Since Ant 1.6</em></p>


+ 132
- 3
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -451,11 +451,14 @@ public class Javadoc extends Task {
private final List<SourceFile> sourceFiles = new Vector<>();
private final List<PackageName> packageNames = new Vector<>();
private final List<PackageName> excludePackageNames = new Vector<>(1);
private final List<PackageName> moduleNames = new ArrayList<>();
private boolean author = true;
private boolean version = true;
private DocletInfo doclet = null;
private Path classpath = null;
private Path bootclasspath = null;
private Path modulePath = null;
private Path moduleSourcePath = null;
private String group = null;
private String packageList = null;
private final List<LinkArgument> links = new Vector<>();
@@ -566,6 +569,88 @@ public class Javadoc extends Task {
createSourcepath().setRefid(r);
}

/**
* Specify where to find modules
*
* @param src a Path instance containing the modules.
*
* @since Ant 1.10.6
*/
public void setModulePath(final Path mp) {
if (modulePath == null) {
modulePath = mp;
} else {
modulePath.append(mp);
}
}

/**
* Create a path to be configured with the locations of the module
* files.
*
* @return a new Path instance to be configured by the Ant core.
*
* @since Ant 1.10.6
*/
public Path createModulePath() {
if (modulePath == null) {
modulePath = new Path(getProject());
}
return modulePath.createPath();
}

/**
* Adds a reference to a path defined elsewhere that defines the module path.
*
* @param r the reference containing the module path definition.
*
* @since Ant 1.10.6
*/
public void setModulePathref(final Reference r) {
createModulePath().setRefid(r);
}

/**
* Specify where to find sources for modules
*
* @param src a Path instance containing the sources for modules.
*
* @since Ant 1.10.6
*/
public void setModuleSourcePath(final Path mp) {
if (moduleSourcePath == null) {
moduleSourcePath = mp;
} else {
moduleSourcePath.append(mp);
}
}

/**
* Create a path to be configured with the locations of the module
* source files.
*
* @return a new Path instance to be configured by the Ant core.
*
* @since Ant 1.10.6
*/
public Path createModuleSourcePath() {
if (moduleSourcePath == null) {
moduleSourcePath = new Path(getProject());
}
return moduleSourcePath.createPath();
}

/**
* Adds a reference to a path defined elsewhere that defines the module source path.
*
* @param r the reference containing the module source path definition.
*
* @since Ant 1.10.6
*/
public void setModuleSourcePathref(final Reference r) {
createModuleSourcePath().setRefid(r);
}

/**
* Set the directory where the Javadoc output will be generated.
*
@@ -619,6 +704,21 @@ public class Javadoc extends Task {
}
}

/**
* Set the module names to be processed.
*
* @param modules a comma separated list of module names
*
* @since Ant 1.10.6
*/
public void setModulenames(final String modules) {
for (String m : modules.split(",")) {
final PackageName mn = new PackageName();
mn.setName(m);
addModule(mn);
}
}

/**
* Add a single package to be processed.
*
@@ -631,6 +731,17 @@ public class Javadoc extends Task {
packageNames.add(pn);
}

/**
* Add a single module to be processed.
*
* @param mn the module name
*
* @since Ant 1.10.6
*/
public void addModule(final PackageName mn) {
moduleNames.add(mn);
}

/**
* Set the list of packages to be excluded.
*
@@ -1737,6 +1848,7 @@ public class Javadoc extends Task {
doGroup(toExecute); // group attribute
doGroups(toExecute); // groups attribute
doDocFilesSubDirs(toExecute); // docfilessubdir attribute
doModuleArguments(toExecute);

doJava14(toExecute);
if (breakiterator && (doclet == null || JAVADOC_5)) {
@@ -1852,9 +1964,9 @@ public class Javadoc extends Task {
private void checkPackagesToDoc(
final List<String> packagesToDoc, final List<SourceFile> sourceFilesToDoc) {
if (packageList == null && packagesToDoc.isEmpty()
&& sourceFilesToDoc.isEmpty()) {
throw new BuildException(
"No source files and no packages have been specified.");
&& sourceFilesToDoc.isEmpty() && moduleNames.isEmpty()) {
throw new BuildException("No source files, no packages and no modules have "
+ "been specified.");
}
}

@@ -2479,6 +2591,23 @@ public class Javadoc extends Task {
return fileContents;
}

private void doModuleArguments(Commandline toExecute) {
if (!moduleNames.isEmpty()) {
toExecute.createArgument().setValue("--module");
toExecute.createArgument()
.setValue(moduleNames.stream().map(PackageName::getName)
.collect(Collectors.joining(",")));
}
if (modulePath != null) {
toExecute.createArgument().setValue("--module-path");
toExecute.createArgument().setPath(modulePath);
}
if (moduleSourcePath != null) {
toExecute.createArgument().setValue("--module-source-path");
toExecute.createArgument().setPath(moduleSourcePath);
}
}

private class JavadocOutputStream extends LogOutputStream {
JavadocOutputStream(final int level) {
super(Javadoc.this, level);


Loading…
Cancel
Save