Browse Source

Add -source switch to <javadoc>

PR: 5645


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272299 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
e2aa7c41ea
3 changed files with 46 additions and 1 deletions
  1. +3
    -0
      WHATSNEW
  2. +10
    -0
      docs/manual/CoreTasks/javadoc.html
  3. +33
    -1
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java

+ 3
- 0
WHATSNEW View File

@@ -287,6 +287,9 @@ Other changes:
* <java> now supports a timeout attribute analog to <exec> - it is
highly recommended to only use it together with fork="true".

* <javadoc> now supports a source attribute to enable javadoc to
handle assertions present in JDK 1.4 source code.

Changes from Ant 1.4 to Ant 1.4.1
===========================================



+ 10
- 0
docs/manual/CoreTasks/javadoc.html View File

@@ -386,6 +386,16 @@ instead.</i></p>
<td align="center" valign="top">all</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">source</td>
<td valign="top">Necessary to enable javadoc to handle assertions
present in J2SE v 1.4 source code. Set this to &quot;1.4&quot; to
documents code that compiles using <code>&quot;javac -source
1.4&quot;</code>. Will be ignored if you use a custom
doclet.</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>


+ 33
- 1
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -281,6 +281,7 @@ public class Javadoc extends Task {
private boolean useExternalFile = false;
private File tmpList = null;
private FileUtils fileUtils = FileUtils.newFileUtils();
private String source = null;

/**
* Work around command line length limit by using an external file
@@ -431,7 +432,17 @@ public class Javadoc extends Task {
}
public void setOld(boolean b) {
add12ArgIf(b, "-1.1");
if (b) {
if (javadoc1) {
log("Javadoc 1.1 doesn't support the -1.1 switch",
Project.MSG_WARN);
} else if (javadoc4) {
log("Javadoc 1.4 doesn't support the -1.1 switch anymore",
Project.MSG_WARN);
} else {
cmd.createArgument().setValue("-1.1");
}
}
}
public void setClasspath(Path src) {
if (classpath == null) {
@@ -896,6 +907,17 @@ public class Javadoc extends Task {
failOnError = b;
}

/**
* Enables the -source switch, will be ignored if javadoc is not
* the 1.4 version or a different doclet than the standard doclet
* is used.
*
* @since 1.86, Ant 1.5
*/
public void setSource(String source) {
this.source = source;
}

public void execute() throws BuildException {
if ("javadoc2".equals(taskType)) {
log("!! javadoc2 is deprecated. Use javadoc instead. !!");
@@ -1096,6 +1118,16 @@ public class Javadoc extends Task {
}
}
}

if (source != null) {
if (doclet != null) {
log("ignoring source option for custom doclet",
Project.MSG_WARN);
} else {
toExecute.createArgument().setValue("-source");
toExecute.createArgument().setValue(source);
}
}
}

}


Loading…
Cancel
Save