Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 5008 invoked from network); 24 Sep 2004 18:55:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 24 Sep 2004 18:55:24 -0000 Received: (qmail 534 invoked by uid 500); 24 Sep 2004 18:57:34 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 427 invoked by uid 500); 24 Sep 2004 18:57:32 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 408 invoked by uid 500); 24 Sep 2004 18:57:31 -0000 Received: (qmail 403 invoked by uid 99); 24 Sep 2004 18:57:31 -0000 X-ASF-Spam-Status: No, hits=-10.0 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 24 Sep 2004 11:57:30 -0700 Received: (qmail 4968 invoked by uid 1818); 24 Sep 2004 18:55:16 -0000 Date: 24 Sep 2004 18:55:16 -0000 Message-ID: <20040924185516.4967.qmail@minotaur.apache.org> From: mbenson@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant WHATSNEW X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N mbenson 2004/09/24 11:55:16 Modified: docs/manual/CoreTypes redirector.html src/main/org/apache/tools/ant/taskdefs Redirector.java src/main/org/apache/tools/ant/types RedirectorElement.java src/testcases/org/apache/tools/ant/taskdefs ExecTaskTest.java src/etc/testcases/taskdefs/exec exec.xml . WHATSNEW Log: Add alwayslog attribute to . Revision Changes Path 1.3 +35 -23 ant/docs/manual/CoreTypes/redirector.html Index: redirector.html =================================================================== RCS file: /home/cvs/ant/docs/manual/CoreTypes/redirector.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- redirector.html 23 Apr 2004 07:33:51 -0000 1.2 +++ redirector.html 24 Sep 2004 18:55:16 -0000 1.3 @@ -27,62 +27,66 @@ output - Name of a file to which to write the output. If the error stream - is not also redirected to a file or property, it will appear in this output. + Name of a file to which output should be written. + If the error stream is not also redirected to a file or property, + it will appear in this output. No error The file to which the standard error of the - command should be redirected. + command should be redirected. No logError - This attribute is used when you wish to see error output in Ant's - log and you are redirecting output to a file/property. The error - output will not be included in the output file/property. If you - redirect error with the error or errorProperty - attributes, this will have no effect. + This attribute is used when you wish to see + error output in Ant's log and you are redirecting output to + a file/property. The error output will not be included in + the output file/property. If you redirect error with the + error or errorProperty attributes, this will + have no effect. No append - Whether output and error files should be appended to or overwritten. - Defaults to false. + Whether output and error files should be + appended to rather than overwritten. Defaults to + false. No createemptyfiles - Whether output and error files should be created even when empty. - Defaults to true. + Whether output and error files should be + created even when empty. Defaults to true. No outputproperty The name of a property in which the output of the - command should be stored. Unless the error stream is redirected to a separate - file or stream, this property will include the error output. + command should be stored. Unless the error stream is redirected + to a separate file or stream, this property will include the + error output. No errorproperty - The name of a property in which the standard error of the - command should be stored. + The name of a property in which the standard error + of the command should be stored. No input A file from which the executed command's standard input - is taken. This attribute is mutually exclusive with the - inputstring attribute. + is taken. This attribute is mutually exclusive with the + inputstring attribute. No inputstring A string which serves as the input stream for the - executed command. This attribute is mutually exclusive with the - input attribute. + executed command. This attribute is mutually exclusive with the + input attribute. No @@ -100,6 +104,14 @@ The error encoding. No + + alwayslog + Always send to the log in addition to + any other destination. Default false. + Since Ant 1.6.3. + + No +

Parameters specified as nested elements

inputmapper

@@ -122,13 +134,13 @@ A nested <errormapper> is not compatible with the error attribute.

inputfilterchain

-

One or more FilterChains can be +

A FilterChain can be applied to the process input.

outputfilterchain

-

One or more FilterChains can be +

A FilterChain can be applied to the process output.

errorfilterchain

-

One or more FilterChains can be +

A FilterChain can be applied to the error output.

Usage

Tasks known to support I/O redirection: 1.20 +47 -37 ant/src/main/org/apache/tools/ant/taskdefs/Redirector.java Index: Redirector.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Redirector.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- Redirector.java 23 Apr 2004 07:33:51 -0000 1.19 +++ Redirector.java 24 Sep 2004 18:55:16 -0000 1.20 @@ -122,6 +122,9 @@ /** Flag which indicates if error and output files are to be appended. */ private boolean append = false; + /** Flag which indicates that output should be always sent to the log */ + private boolean alwaysLog = false; + /** Flag which indicates whether files should be created even when empty. */ private boolean createEmptyFiles = true; @@ -334,11 +337,22 @@ } /** + * If true, (error and non-error) output will be "teed", redirected + * as specified while being sent to Ant's logging mechanism as if no + * redirection had taken place. Defaults to false. + * @param alwaysLog boolean + * @since Ant 1.6.3 + */ + public synchronized void setAlwaysLog(boolean alwaysLog) { + this.alwaysLog = alwaysLog; + } + + /** * Whether output and error files should be created even when empty. * Defaults to true. * @param createEmptyFiles boolean. */ - public void setCreateEmptyFiles(boolean createEmptyFiles) { + public synchronized void setCreateEmptyFiles(boolean createEmptyFiles) { this.createEmptyFiles = createEmptyFiles; } @@ -371,7 +385,7 @@ * * @param outputFilterChains Vector containing FilterChain. */ - public void setOutputFilterChains(Vector outputFilterChains) { + public synchronized void setOutputFilterChains(Vector outputFilterChains) { this.outputFilterChains = outputFilterChains; } @@ -380,7 +394,7 @@ * * @param errorFilterChains Vector containing FilterChain. */ - public void setErrorFilterChains(Vector errorFilterChains) { + public synchronized void setErrorFilterChains(Vector errorFilterChains) { this.errorFilterChains = errorFilterChains; } @@ -413,35 +427,24 @@ * configuration options. */ public synchronized void createStreams() { - if ((out == null || out.length == 0) && outputProperty == null) { - outputStream = new LogOutputStream(managingTask, Project.MSG_INFO); - } else { - if (out != null && out.length > 0) { - String logHead = new StringBuffer("Output ").append( - ((append) ? "appended" : "redirected")).append( - " to ").toString(); - outputStream = foldFiles(out, logHead, Project.MSG_VERBOSE); - } - - if (outputProperty != null) { - if (baos == null) { - baos = new PropertyOutputStream(outputProperty); - managingTask.log("Output redirected to property: " - + outputProperty, Project.MSG_VERBOSE); - } - //shield it from being closed by a filtering StreamPumper - OutputStream keepAliveOutput = new KeepAliveOutputStream(baos); - if (outputStream == null) { - outputStream = keepAliveOutput; - } else { - outputStream - = new TeeOutputStream(outputStream, keepAliveOutput); - } - } else { - baos = null; + if (out != null && out.length > 0) { + String logHead = new StringBuffer("Output ").append( + ((append) ? "appended" : "redirected")).append( + " to ").toString(); + outputStream = foldFiles(out, logHead, Project.MSG_VERBOSE); + } + if (outputProperty != null) { + if (baos == null) { + baos = new PropertyOutputStream(outputProperty); + managingTask.log("Output redirected to property: " + + outputProperty, Project.MSG_VERBOSE); } - - errorStream = outputStream; + //shield it from being closed by a filtering StreamPumper + OutputStream keepAliveOutput = new KeepAliveOutputStream(baos); + outputStream = (outputStream == null) ? keepAliveOutput + : new TeeOutputStream(outputStream, keepAliveOutput); + } else { + baos = null; } if (error != null && error.length > 0) { @@ -449,10 +452,7 @@ ((append) ? "appended" : "redirected")).append( " to ").toString(); errorStream = foldFiles(error, logHead, Project.MSG_VERBOSE); - - } else if (logError || errorStream == null) { - errorStream = new LogOutputStream(managingTask, Project.MSG_WARN); - } else { //must be errorStream == outputStream + } else if (!(logError || outputStream == null)) { long funnelTimeout = 0L; OutputStreamFunneler funneler = new OutputStreamFunneler(outputStream, funnelTimeout); @@ -464,7 +464,6 @@ "error splitting output/error streams", eyeOhEx); } } - if (errorProperty != null) { if (errorBaos == null) { errorBaos = new PropertyOutputStream(errorProperty); @@ -478,7 +477,18 @@ } else { errorBaos = null; } - + if (alwaysLog || outputStream == null) { + OutputStream outputLog + = new LogOutputStream(managingTask, Project.MSG_INFO); + outputStream = (outputStream == null) + ? outputLog : new TeeOutputStream(outputLog, outputStream); + } + if (alwaysLog || errorStream == null) { + OutputStream errorLog + = new LogOutputStream(managingTask, Project.MSG_WARN); + errorStream = (errorStream == null) + ? errorLog : new TeeOutputStream(errorLog, errorStream); + } if ((outputFilterChains != null && outputFilterChains.size() > 0) || !(outputEncoding.equalsIgnoreCase(inputEncoding))) { try { 1.3 +21 -0 ant/src/main/org/apache/tools/ant/types/RedirectorElement.java Index: RedirectorElement.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/RedirectorElement.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- RedirectorElement.java 23 Apr 2004 07:33:51 -0000 1.2 +++ RedirectorElement.java 24 Sep 2004 18:55:16 -0000 1.3 @@ -65,6 +65,9 @@ /** Flag which indicates if error and output files are to be appended. */ private Boolean append; + /** Flag which indicates that output should be always sent to the log */ + private Boolean alwaysLog; + /** Flag which indicates whether files should be created even if empty. */ private Boolean createEmptyFiles; @@ -317,6 +320,21 @@ } /** + * If true, (error and non-error) output will be "teed", redirected + * as specified while being sent to Ant's logging mechanism as if no + * redirection had taken place. Defaults to false. + * @param alwaysLog boolean + * @since Ant 1.6.3 + */ + public void setAlwaysLog(boolean alwaysLog) { + if (isReference()) { + throw tooManyAttributes(); + } + //pre JDK 1.4 compatible + this.alwaysLog = ((alwaysLog) ? Boolean.TRUE : Boolean.FALSE); + } + + /** * Whether output and error files should be created even when empty. * Defaults to true. * @param createEmptyFiles boolean. @@ -400,6 +418,9 @@ * @param sourcefile String. */ public void configure(Redirector redirector, String sourcefile) { + if (alwaysLog != null) { + redirector.setAlwaysLog(alwaysLog.booleanValue()); + } if (logError != null) { redirector.setLogError(logError.booleanValue()); } 1.15 +8 -0 ant/src/testcases/org/apache/tools/ant/taskdefs/ExecTaskTest.java Index: ExecTaskTest.java =================================================================== RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/ExecTaskTest.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- ExecTaskTest.java 27 Mar 2004 21:22:59 -0000 1.14 +++ ExecTaskTest.java 24 Sep 2004 18:55:16 -0000 1.15 @@ -329,6 +329,14 @@ executeTarget("redirector17"); } + public void testRedirector18() { + if (getProject().getProperty("test.can.run") == null) { + return; + } + expectLog("redirector18", getProject().getProperty("ant.file") + + " out" + getProject().getProperty("ant.file") + " err"); + } + public void testspawn() { project.executeTarget("init"); if (project.getProperty("test.can.run") == null) { 1.5 +16 -0 ant/src/etc/testcases/taskdefs/exec/exec.xml Index: exec.xml =================================================================== RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/exec/exec.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- exec.xml 27 Mar 2004 21:22:58 -0000 1.4 +++ exec.xml 24 Sep 2004 18:55:16 -0000 1.5 @@ -313,6 +313,22 @@ Files were created. + + + + + + + + + + + + + + + 1.667 +3 -1 ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/ant/WHATSNEW,v retrieving revision 1.666 retrieving revision 1.667 diff -u -r1.666 -r1.667 --- WHATSNEW 24 Sep 2004 15:30:45 -0000 1.666 +++ WHATSNEW 24 Sep 2004 18:55:16 -0000 1.667 @@ -77,12 +77,14 @@ * Enable to choose the regexp implementation without system property. Bugzilla Report 15390. -* Expose objects and methods in IntrospectionHelper. Bugzilla Report 30794. +* Expose objects and methods in IntrospectionHelper. Bugzilla Report 30794. * Allow file attribute of to rename a directory. Bugzilla Report 22863. * Add xmlcatalog nested element to XmlProperty. Bugzilla report 27053. + +* New attribute alwayslog for type. Fixed bugs: ----------- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org