ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs ExecTask.java Java.java SQLExec.java
Date Fri, 05 Apr 2002 09:28:55 GMT
bodewig     02/04/05 01:28:55

  Modified:    .        WHATSNEW
               docs/manual/CoreTasks exec.html java.html sql.html
               src/main/org/apache/tools/ant/taskdefs ExecTask.java
                        Java.java SQLExec.java
  Log:
  Add append attributes to <exec>, <java> and <sql>
  
  PR: 3234, part of 5299
  
  Revision  Changes    Path
  1.244     +3 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.243
  retrieving revision 1.244
  diff -u -r1.243 -r1.244
  --- WHATSNEW	4 Apr 2002 14:16:26 -0000	1.243
  +++ WHATSNEW	5 Apr 2002 09:28:54 -0000	1.244
  @@ -275,6 +275,9 @@
   * <uptodate> now has a 'srcfile' attribute to allow specifying a 
     full-path filename.
   
  +* <exec>, <sql> and <java> now support append attributes to allow
  +  appending the output to an existing file.
  +
   Changes from Ant 1.4 to Ant 1.4.1
   ===========================================
   
  
  
  
  1.14      +6 -0      jakarta-ant/docs/manual/CoreTasks/exec.html
  
  Index: exec.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/exec.html,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- exec.html	3 Feb 2002 22:00:42 -0000	1.13
  +++ exec.html	5 Apr 2002 09:28:54 -0000	1.14
  @@ -51,6 +51,12 @@
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  +    <td valign="top">append</td>
  +    <td valign="top">whether output should be appended to or overwrite
  +    an existing file.  Defaults to false.</td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
  +  <tr>
       <td valign="top">outputproperty</td>
       <td valign="top">the name of a property in which the output of the 
         command should be stored.</td>
  
  
  
  1.11      +6 -0      jakarta-ant/docs/manual/CoreTasks/java.html
  
  Index: java.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/java.html,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- java.html	3 Feb 2002 22:00:42 -0000	1.10
  +++ java.html	5 Apr 2002 09:28:54 -0000	1.11
  @@ -95,6 +95,12 @@
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  +    <td valign="top">append</td>
  +    <td valign="top">whether output should be appended to or overwrite
  +    an existing file.  Defaults to false.</td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
  +  <tr>
       <td valign="top">newenvironment</td>
       <td valign="top">Do not propagate old environment when new
         environment variables are specified. Default is &quot;false&quot;
  
  
  
  1.14      +6 -0      jakarta-ant/docs/manual/CoreTasks/sql.html
  
  Index: sql.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/sql.html,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- sql.html	2 Apr 2002 07:49:08 -0000	1.13
  +++ sql.html	5 Apr 2002 09:28:54 -0000	1.14
  @@ -88,6 +88,12 @@
     <td width="78%" valign="top">Output file for result sets (defaults to System.out)</td>
     <td width="10%" valign="top">No (print to System.out by default)</td>
   </tr>
  +  <tr>
  +    <td valign="top">append</td>
  +    <td valign="top">whether output should be appended to or overwrite
  +    an existing file.  Defaults to false.</td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
   <tr>
     <td width="12%" valign="top">classpath</td>
     <td width="78%" valign="top">Classpath used to load driver</td>
  
  
  
  1.30      +11 -1     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java
  
  Index: ExecTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- ExecTask.java	3 Mar 2002 01:46:20 -0000	1.29
  +++ ExecTask.java	5 Apr 2002 09:28:54 -0000	1.30
  @@ -96,6 +96,7 @@
       private String outputprop;
       private String resultProperty;
       private boolean failIfExecFails=true;
  +    private boolean append = false;
   
       /** Controls whether the VM (1.3 and above) is used to execute the command */
       private boolean vmLauncher = true;
  @@ -209,6 +210,15 @@
       }
       
       /**
  +     * Shall we append to an existing file?
  +     *
  +     * @since 1.30, Ant 1.5
  +     */
  +    public void setAppend(boolean append) {
  +        this.append = append;
  +    }
  +
  +    /**
        * Do the work.
        */
       public void execute() throws BuildException {
  @@ -342,7 +352,7 @@
       protected ExecuteStreamHandler createHandler() throws BuildException {
           if(out!=null)  {
               try {
  -                fos = new FileOutputStream(out);
  +                fos = new FileOutputStream(out.getAbsolutePath(), append);
                   log("Output redirected to " + out, Project.MSG_VERBOSE);
                   return new PumpStreamHandler(fos);
               } catch (FileNotFoundException fne) {
  
  
  
  1.36      +14 -2     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Java.java
  
  Index: Java.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Java.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- Java.java	3 Mar 2002 01:46:20 -0000	1.35
  +++ Java.java	5 Apr 2002 09:28:54 -0000	1.36
  @@ -90,6 +90,7 @@
       private File out;
       private PrintStream outStream = null;
       private boolean failOnError = false;
  +    private boolean append = false;
       
       /**
        * Do the execution.
  @@ -299,6 +300,15 @@
           newEnvironment = newenv;
       }
   
  +    /**
  +     * Shall we append to an existing file?
  +     *
  +     * @since 1.36, Ant 1.5
  +     */
  +    public void setAppend(boolean append) {
  +        this.append = append;
  +    }
  +
       protected void handleOutput(String line) {
           if (outStream != null) {
               outStream.println(line);
  @@ -328,7 +338,9 @@
           exe.setSystemProperties(command.getSystemProperties());
           if (out != null) {
               try {
  -                outStream = new PrintStream(new FileOutputStream(out));
  +                outStream = 
  +                    new PrintStream(new FileOutputStream(out.getAbsolutePath(),
  +                                                         append));
                   exe.execute(project);
               } catch (IOException io) {
                   throw new BuildException(io, location);
  @@ -356,7 +368,7 @@
                                                          Project.MSG_WARN), 
                                     null);
               } else {
  -                fos = new FileOutputStream(out);
  +                fos = new FileOutputStream(out.getAbsolutePath(), append);
                   exe = new Execute(new PumpStreamHandler(fos), null);
               }
               
  
  
  
  1.36      +14 -1     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
  
  Index: SQLExec.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- SQLExec.java	3 Mar 2002 01:46:20 -0000	1.35
  +++ SQLExec.java	5 Apr 2002 09:28:54 -0000	1.36
  @@ -227,6 +227,10 @@
        */
       private String encoding = null;
   
  +    /**
  +     * Append to an existing file or overwrite it?
  +     */
  +    private boolean append = false;
   
       public void setCaching(boolean value){
           caching = value;
  @@ -378,6 +382,15 @@
       }
   
       /**
  +     * Shall we append to an existing file?
  +     *
  +     * @since 1.36, Ant 1.5
  +     */
  +    public void setAppend(boolean append) {
  +        this.append = append;
  +    }
  +
  +    /**
        * Set the rdbms required
        */
       public void setRdbms(String vendor) {
  @@ -510,7 +523,7 @@
               try {
                   if (output != null) {
                       log("Opening PrintStream to output file " + output, Project.MSG_VERBOSE);
  -                    out = new PrintStream(new BufferedOutputStream(new FileOutputStream(output)));
  +                    out = new PrintStream(new BufferedOutputStream(new FileOutputStream(output.getAbsolutePath(),
append)));
                   }
                           
                   // Process all transactions
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message