Browse Source

failOnWarning attribute for javadoc. Patch by Tim Boemker. PR 55015

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1555938 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 11 years ago
parent
commit
8128522925
5 changed files with 45 additions and 0 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +3
    -0
      WHATSNEW
  3. +4
    -0
      contributors.xml
  4. +8
    -0
      manual/Tasks/javadoc.html
  5. +29
    -0
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java

+ 1
- 0
CONTRIBUTORS View File

@@ -360,6 +360,7 @@ Thomas Christen
Thomas Christensen
Thomas Haas
Thomas Quas
Tim Boemker
Tim Drury
Tim Fennell
Tim Stephenson


+ 3
- 0
WHATSNEW View File

@@ -85,6 +85,9 @@ Other changes:
process and setting a property from the return code.
Bugzilla Report 48478

* <javadoc> now has an option to fail if javadoc issues warnings.
Bugzilla Report 55015

Changes from Ant 1.9.2 TO Ant 1.9.3
===================================



+ 4
- 0
contributors.xml View File

@@ -1451,6 +1451,10 @@
<first>Thomas</first>
<last>Quas</last>
</name>
<name>
<first>Tim</first>
<last>Boemker</last>
</name>
<name>
<first>Tim</first>
<last>Drury</last>


+ 8
- 0
manual/Tasks/javadoc.html View File

@@ -415,6 +415,14 @@ to &lt;javadoc&gt; 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">failonwarning</td>
<td valign="top">Stop the buildprocess if a warning is emitted -
i.e. if javadoc's output contains the word "warning". <em>since
Ant 1.9.4</em></td>
<td align="center" valign="top">all</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">excludepackagenames</td>
<td valign="top">comma separated list of packages you don't want


+ 29
- 0
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -434,6 +434,11 @@ public class Javadoc extends Task {
* Javadoc error.
*/
private boolean failOnError = false;
/**
* Flag which indicates if the task should fail if there is a
* Javadoc warning.
*/
private boolean failOnWarning = false;
private Path sourcePath = null;
private File destDir = null;
private Vector<SourceFile> sourceFiles = new Vector<SourceFile>();
@@ -1553,6 +1558,18 @@ public class Javadoc extends Task {
failOnError = b;
}

/**
* Should the build process fail if Javadoc warns (as indicated by
* the word "warning" on stdout)?
*
* <p>Default is false.</p>
* @param b a <code>boolean</code> value
* @since Ant 1.9.4
*/
public void setFailonwarning(boolean b) {
failOnWarning = b;
}

/**
* Enables the -source switch, will be ignored if Javadoc is not
* the 1.4 version.
@@ -1787,6 +1804,10 @@ public class Javadoc extends Task {
throw new BuildException("Javadoc returned " + ret,
getLocation());
}
if (out.sawWarnings() && failOnWarning) {
throw new BuildException("Javadoc issued warnings.",
getLocation());
}
postProcessGeneratedJavadocs();
} catch (IOException e) {
throw new BuildException("Javadoc failed: " + e, e, getLocation());
@@ -2548,7 +2569,11 @@ public class Javadoc extends Task {
// unless they appear after what could be an informational message.
//
private String queuedLine = null;
private boolean sawWarnings = false;
protected void processLine(String line, int messageLevel) {
if (line.contains("warning")) {
sawWarnings = true;
}
if (messageLevel == Project.MSG_INFO
&& line.startsWith("Generating ")) {
if (queuedLine != null) {
@@ -2575,6 +2600,10 @@ public class Javadoc extends Task {
queuedLine = null;
}
}
public boolean sawWarnings() {
return sawWarnings;
}
}

/**


Loading…
Cancel
Save