ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Exec.java
Date Fri, 07 Jul 2000 11:24:01 GMT
bodewig     00/07/07 04:24:01

  Modified:    docs     index.html
               src/main/org/apache/tools/ant/taskdefs Exec.java
  Log:
  Added failonerror attribute to Exec.
  
  If this attribute is set to true, a BuildException will be thrown
  effectively ending the build process.
  
  Suggested by:	Sebastien Pierre <spierre@rational.com>
  
  Revision  Changes    Path
  1.39      +30 -0     jakarta-ant/docs/index.html
  
  Index: index.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/index.html,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- index.html	2000/07/07 07:20:16	1.38
  +++ index.html	2000/07/07 11:23:59	1.39
  @@ -900,6 +900,12 @@
       <td valign="top">report only, don't change any files.</td>
       <td align="center" valign="top">No, default &quot;false&quot;</td>
     </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">No</td>
  +  </tr>
   </table>
   <h3>Examples</h3>
   <pre>  &lt;cvs cvsRoot=&quot;:pserver:anoncvs@jakarta.apache.org:/home/cvspublic&quot;
  @@ -1067,6 +1073,12 @@
         redirected.</td>
       <td align="center" valign="top">Yes</td>
     </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">No</td>
  +  </tr>
   </table>
   <h3>Examples</h3>
   <blockquote>
  @@ -1569,6 +1581,12 @@
         disabled)</td>
       <td align="center" valign="top">No</td>
     </tr>
  +  <tr>
  +    <td valign="top">failonerror</td>
  +    <td valign="top">Stop the buildprocess if the command exits with a
  +      returncode other than 0. Only available if fork is true.</td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
   </table>
   <h3>Examples</h3>
   <pre>  &lt;java classname=&quot;test.Main&quot; /&gt;</pre>
  @@ -2077,6 +2095,12 @@
       <td align="center" valign="top">1.2</td>
       <td align="center" valign="top">No</td>
     </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">No</td>
  +  </tr>
   </table>
   
   <h3>Parameters specified as nested elements</h3>
  @@ -2282,6 +2306,12 @@
       <td valign="top">strip</td> 
       <td valign="top">Strip the smallest prefix containing <i>num</i>
leading 
         slashes from filenames.</td>
  +    <td align="center" valign="top">No</td>
  +  </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">No</td>
     </tr>
   </table>
  
  
  
  1.14      +10 -1     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java
  
  Index: Exec.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Exec.java	2000/07/06 16:48:14	1.13
  +++ Exec.java	2000/07/07 11:24:00	1.14
  @@ -70,6 +70,7 @@
       private File dir;
       private String command;
       protected PrintWriter fos = null;
  +    private boolean failOnError = false;
   
       private static final int BUFFER_SIZE = 512;
   
  @@ -138,7 +139,11 @@
               // check its exit value
               err = proc.exitValue();
               if (err != 0) {
  -                log("Result: " + err, Project.MSG_ERR);
  +                if (failOnError) {
  +                    throw new BuildException("Exec returned: "+err, location);
  +                } else {
  +                    log("Result: " + err, Project.MSG_ERR);
  +                }
               }
           } catch (IOException ioe) {
               throw new BuildException("Error exec: " + command, ioe, location);
  @@ -161,6 +166,10 @@
   
       public void setOutput(String out) {
           this.out = out;
  +    }
  +
  +    public void setFailonerror(String fail) {
  +        failOnError = Project.toBoolean(fail);
       }
   
       protected void outputLog(String line, int messageLevel) {
  
  
  

Mime
View raw message