Browse Source

Reinstate javadoc's failonerror attribute.

Requested by:	Corey Puffalt <corey@kelman.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268134 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
73db4788f6
3 changed files with 25 additions and 3 deletions
  1. +8
    -1
      docs/index.html
  2. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/ExecTask.java
  3. +16
    -1
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java

+ 8
- 1
docs/index.html View File

@@ -382,7 +382,7 @@ name of the operating system.</p>
<p>In addition Ant knows some built in properties:</p> <p>In addition Ant knows some built in properties:</p>
<ul> <ul>
<li>basedir - the absolute path of the project's basedir (as set <li>basedir - the absolute path of the project's basedir (as set
with the basedir attribute of &lt;project&gt;.</li>
with the basedir attribute of &lt;project&gt;).</li>
<li>ant.file - the absolute path of the build file.</li> <li>ant.file - the absolute path of the build file.</li>
<li>ant.java.version - the JVM version Ant detected. Currently it <li>ant.java.version - the JVM version Ant detected. Currently it
can hold the values &quot;1.1&quot;, &quot;1.2&quot; and can hold the values &quot;1.1&quot;, &quot;1.2&quot; and
@@ -3094,6 +3094,13 @@ instead.</p>
<td align="center" valign="top">1.2</td> <td align="center" valign="top">1.2</td>
<td align="center" valign="top">No</td> <td align="center" valign="top">No</td>
</tr> </tr>
<tr>
<td valign="top">failonerror</td>
<td valign="top">Stop the buildprocess if the command exits with a
returncode other than 0.</td>
<td align="center" valign="top">all</td>
<td align="center" valign="top">No</td>
</tr>
</table> </table>


<h3>Parameters specified as nested elements</h3> <h3>Parameters specified as nested elements</h3>


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

@@ -65,7 +65,7 @@ import java.io.*;
* @author duncan@x180.com * @author duncan@x180.com
* @author rubys@us.ibm.com * @author rubys@us.ibm.com
* @author thomas.haas@softwired-inc.com * @author thomas.haas@softwired-inc.com
* @author <a href="mailto:stefan.bodewig@megabit.net">Stefan Bodewig</a>
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
* @author <a href="mailto:mariusz@rakiura.org">Mariusz Nowostawski</a> * @author <a href="mailto:mariusz@rakiura.org">Mariusz Nowostawski</a>
*/ */
public class ExecTask extends Task { public class ExecTask extends Task {


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

@@ -90,6 +90,7 @@ import java.util.*;
* @author Stefano Mazzocchi <a href="mailto:stefano@apache.org">stefano@apache.org</a> * @author Stefano Mazzocchi <a href="mailto:stefano@apache.org">stefano@apache.org</a>
* @author Patrick Chanezon <a href="mailto:chanezon@netscape.com">chanezon@netscape.com</a> * @author Patrick Chanezon <a href="mailto:chanezon@netscape.com">chanezon@netscape.com</a>
* @author Ernst de Haan <a href="mailto:ernst@jollem.com">ernst@jollem.com</a> * @author Ernst de Haan <a href="mailto:ernst@jollem.com">ernst@jollem.com</a>
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
*/ */


public class Javadoc extends Task { public class Javadoc extends Task {
@@ -191,6 +192,7 @@ public class Javadoc extends Task {
} }


private boolean foundJavaFile = false; private boolean foundJavaFile = false;
private boolean failOnError = false;
private Path sourcePath = null; private Path sourcePath = null;
private File destDir = null; private File destDir = null;
private String sourceFiles = null; private String sourceFiles = null;
@@ -543,6 +545,16 @@ public class Javadoc extends Task {
} }
} }


/**
* Should the build process fail if javadoc fails (as indicated by
* a non zero return code)?
*
* <p>Default is false.</p>
*/
public void setFailonerror(boolean b) {
failOnError = b;
}

public void execute() throws BuildException { public void execute() throws BuildException {
if ("javadoc2".equals(taskType)) { if ("javadoc2".equals(taskType)) {
log("!! javadoc2 is deprecated. Use javadoc instead. !!"); log("!! javadoc2 is deprecated. Use javadoc instead. !!");
@@ -726,7 +738,10 @@ public class Javadoc extends Task {
exe.setWorkingDirectory(project.getBaseDir()); exe.setWorkingDirectory(project.getBaseDir());
try { try {
exe.setCommandline(toExecute.getCommandline()); exe.setCommandline(toExecute.getCommandline());
exe.execute();
int ret = exe.execute();
if (ret != 0 && failOnError) {
throw new BuildException("Javadoc returned "+ret, location);
}
} catch (IOException e) { } catch (IOException e) {
throw new BuildException("Javadoc failed: " + e, e, location); throw new BuildException("Javadoc failed: " + e, e, location);
} finally { } finally {


Loading…
Cancel
Save