conor 2003/01/31 05:11:00 Modified: . Tag: ANT_15_BRANCH WHATSNEW src/main/org/apache/tools/ant Tag: ANT_15_BRANCH DemuxOutputStream.java Project.java Task.java UnknownElement.java src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH Ant.java CallTarget.java Java.java src/main/org/apache/tools/ant/taskdefs/optional/junit Tag: ANT_15_BRANCH JUnitTask.java JUnitTestRunner.java Log: Merge across changes for 16555 Revision Changes Path No revision No revision 1.263.2.119 +4 -3 jakarta-ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/jakarta-ant/WHATSNEW,v retrieving revision 1.263.2.118 retrieving revision 1.263.2.119 diff -u -w -u -r1.263.2.118 -r1.263.2.119 --- WHATSNEW 30 Jan 2003 10:47:42 -0000 1.263.2.118 +++ WHATSNEW 31 Jan 2003 13:10:53 -0000 1.263.2.119 @@ -78,6 +78,8 @@ * <uptodate> now works when using attributes (i.e. not filesets) and pointing to the same file +* Java task (and output system) now stores output which doos not end with a line feed. + Other changes: -------------- @@ -91,9 +93,8 @@ * **/.DS_Store has been added to the list of default pattern excludes. - -* The Created-BY header in the default manifest now contains the JVM vendor and - version according to the jar specification. A new header Ant-Version provides +* The Created-By header in the default manifest now contains the JVM vendor and + version according to the jar specification. A new header, Ant-Versio,n provides the Ant version used to create the jar. Changes from Ant 1.5.1Beta1 to 1.5.1 No revision No revision 1.9.2.1 +16 -2 jakarta-ant/src/main/org/apache/tools/ant/DemuxOutputStream.java Index: DemuxOutputStream.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/DemuxOutputStream.java,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -u -w -u -r1.9 -r1.9.2.1 --- DemuxOutputStream.java 9 Apr 2002 15:27:07 -0000 1.9 +++ DemuxOutputStream.java 31 Jan 2003 13:10:53 -0000 1.9.2.1 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -197,6 +197,20 @@ } /** + * Converts the buffer to a string and sends it to the project. + * + * @param buffer the ByteArrayOutputStream used to collect the output + * until a line separator is seen. + * + * @see Project#demuxOutput(String,boolean) + */ + protected void processFlush(ByteArrayOutputStream buffer) { + String output = buffer.toString(); + project.demuxFlush(output, isErrorStream); + resetBufferInfo(); + } + + /** * Equivalent to flushing the stream. * * @exception IOException if there is a problem closing the stream. @@ -217,7 +231,7 @@ public void flush() throws IOException { BufferInfo bufferInfo = getBufferInfo(); if (bufferInfo.buffer.size() > 0) { - processBuffer(bufferInfo.buffer); + processFlush(bufferInfo.buffer); } } } 1.108.2.9 +29 -1 jakarta-ant/src/main/org/apache/tools/ant/Project.java Index: Project.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v retrieving revision 1.108.2.8 retrieving revision 1.108.2.9 diff -u -w -u -r1.108.2.8 -r1.108.2.9 --- Project.java 8 Nov 2002 12:20:26 -0000 1.108.2.8 +++ Project.java 31 Jan 2003 13:10:53 -0000 1.108.2.9 @@ -1274,6 +1274,34 @@ } /** + * Demultiplexes flush operation so that each task receives the appropriate + * messages. If the current thread is not currently executing a task, + * the message is logged directly. + * + * @since Ant 1.5.2 + * + * @param line Message to handle. Should not be <code>null</code>. + * @param isError Whether the text represents an error (<code>true</code>) + * or information (<code>false</code>). + * @param terminated true if this line should be terminated with an + * end-of-line marker + */ + public void demuxFlush(String line, boolean isError) { + Task task = (Task) threadTasks.get(Thread.currentThread()); + if (task == null) { + fireMessageLogged(this, line, isError ? MSG_ERR : MSG_INFO); + } else { + if (isError) { + task.handleErrorFlush(line); + } else { + task.handleFlush(line); + } + } + } + + + + /** * Executes the specified target and any targets it depends on. * * @param targetName The name of the target to execute. 1.27.2.5 +29 -7 jakarta-ant/src/main/org/apache/tools/ant/Task.java Index: Task.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Task.java,v retrieving revision 1.27.2.4 retrieving revision 1.27.2.5 diff -u -w -u -r1.27.2.4 -r1.27.2.5 --- Task.java 6 Aug 2002 06:32:40 -0000 1.27.2.4 +++ Task.java 31 Jan 2003 13:10:56 -0000 1.27.2.5 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -273,6 +273,17 @@ } /** + * Handles a line of output by logging it with the INFO priority. + * + * @param line The line of output to log. Should not be <code>null</code>. + * + * @since Ant 1.5.2 + */ + protected void handleFlush(String line) { + handleOutput(line); + } + + /** * Handles an error line by logging it with the INFO priority. * * @param line The error line to log. Should not be <code>null</code>. @@ -282,6 +293,17 @@ } /** + * Handles an error line by logging it with the INFO priority. + * + * @param line The error line to log. Should not be <code>null</code>. + * + * @since Ant 1.5.2 + */ + protected void handleErrorFlush(String line) { + handleErrorOutput(line); + } + + /** * Logs a message with the default (INFO) priority. * * @param msg The message to be logged. Should not be <code>null</code>. 1.26.2.3 +27 -0 jakarta-ant/src/main/org/apache/tools/ant/UnknownElement.java Index: UnknownElement.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/UnknownElement.java,v retrieving revision 1.26.2.2 retrieving revision 1.26.2.3 diff -u -w -u -r1.26.2.2 -r1.26.2.3 --- UnknownElement.java 23 Sep 2002 11:08:03 -0000 1.26.2.2 +++ UnknownElement.java 31 Jan 2003 13:10:56 -0000 1.26.2.3 @@ -138,6 +138,19 @@ } /** + * Handles output sent to System.out by this task or its real task. + * + * @param line The line of output to log. Should not be <code>null</code>. + */ + protected void handleFlush(String line) { + if (realThing instanceof Task) { + ((Task) realThing).handleFlush(line); + } else { + super.handleFlush(line); + } + } + + /** * Handles error output sent to System.err by this task or its real task. * * @param line The error line to log. Should not be <code>null</code>. @@ -150,6 +163,20 @@ } } + + /** + * Handles error output sent to System.err by this task or its real task. + * + * @param line The error line to log. Should not be <code>null</code>. + */ + protected void handleErrorFlush(String line) { + if (realThing instanceof Task) { + ((Task) realThing).handleErrorOutput(line); + } else { + super.handleErrorOutput(line); + } + } + /** * Executes the real object if it's a task. If it's not a task * (e.g. a data type) then this method does nothing. No revision No revision 1.56.2.11 +28 -2 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java Index: Ant.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v retrieving revision 1.56.2.10 retrieving revision 1.56.2.11 diff -u -w -u -r1.56.2.10 -r1.56.2.11 --- Ant.java 6 Jan 2003 14:11:53 -0000 1.56.2.10 +++ Ant.java 31 Jan 2003 13:10:58 -0000 1.56.2.11 @@ -288,7 +288,7 @@ * * @since Ant 1.5 */ - protected void handleOutput(String line) { + public void handleOutput(String line) { if (newProject != null) { newProject.demuxOutput(line, false); } else { @@ -297,15 +297,41 @@ } /** + * Pass output sent to System.out to the new project. + * + * @since Ant 1.5.2 + */ + public void handleFlush(String line) { + if (newProject != null) { + newProject.demuxFlush(line, false); + } else { + super.handleFlush(line); + } + } + + /** * Pass output sent to System.err to the new project. * * @since Ant 1.5 */ - protected void handleErrorOutput(String line) { + public void handleErrorOutput(String line) { if (newProject != null) { newProject.demuxOutput(line, true); } else { super.handleErrorOutput(line); + } + } + + /** + * Pass output sent to System.err to the new project. + * + * @since Ant 1.5.2 + */ + public void handleErrorFlush(String line) { + if (newProject != null) { + newProject.demuxFlush(line, true); + } else { + super.handleErrorFlush(line); } } 1.21.2.4 +25 -0 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/CallTarget.java Index: CallTarget.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/CallTarget.java,v retrieving revision 1.21.2.3 retrieving revision 1.21.2.4 diff -u -w -u -r1.21.2.3 -r1.21.2.4 --- CallTarget.java 31 Jan 2003 12:35:13 -0000 1.21.2.3 +++ CallTarget.java 31 Jan 2003 13:10:58 -0000 1.21.2.4 @@ -186,6 +186,19 @@ } /** + * Pass output sent to System.out to the new project. + * + * @since Ant 1.5.2 + */ + public void handleFlush(String line) { + if (callee != null) { + callee.handleFlush(line); + } else { + super.handleFlush(line); + } + } + + /** * Pass output sent to System.err to the new project. * * @since Ant 1.5 @@ -198,4 +211,16 @@ } } + /** + * Pass output sent to System.err to the new project. + * + * @since Ant 1.5.2 + */ + public void handleErrorFlush(String line) { + if (callee != null) { + callee.handleErrorFlush(line); + } else { + super.handleErrorFlush(line); + } + } } 1.45.2.3 +30 -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.45.2.2 retrieving revision 1.45.2.3 diff -u -w -u -r1.45.2.2 -r1.45.2.3 --- Java.java 22 Jun 2002 23:40:22 -0000 1.45.2.2 +++ Java.java 31 Jan 2003 13:10:58 -0000 1.45.2.3 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -376,6 +376,19 @@ } /** + * Pass output sent to System.out to specified output file. + * + * @since Ant 1.5.2 + */ + protected void handleFlush(String line) { + if (outStream != null) { + outStream.print(line); + } else { + super.handleFlush(line); + } + } + + /** * Pass output sent to System.err to specified output file. * * @since Ant 1.5 @@ -389,6 +402,19 @@ } /** + * Pass output sent to System.err to specified output file. + * + * @since Ant 1.5.2 + */ + protected void handleErrorFlush(String line) { + if (outStream != null) { + outStream.println(line); + } else { + super.handleErrorOutput(line); + } + } + + /** * Executes the given classname with the given arguments as it * was a command line application. */ @@ -403,7 +429,9 @@ outStream = new PrintStream(new FileOutputStream(out.getAbsolutePath(), append)); - exe.execute(project); + exe.execute(getProject()); + System.out.flush(); + System.err.flush(); } catch (IOException io) { throw new BuildException(io, location); } finally { No revision No revision 1.44.2.5 +37 -2 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java Index: JUnitTask.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v retrieving revision 1.44.2.4 retrieving revision 1.44.2.5 diff -u -w -u -r1.44.2.4 -r1.44.2.5 --- JUnitTask.java 7 Nov 2002 07:51:35 -0000 1.44.2.4 +++ JUnitTask.java 31 Jan 2003 13:10:59 -0000 1.44.2.5 @@ -718,12 +718,29 @@ } /** + * Pass output sent to System.out to the TestRunner so it can + * collect ot for the formatters. + * + * @since Ant 1.5.2 + */ + protected void handleFlush(String line) { + if (runner != null) { + runner.handleFlush(line); + if (showOutput) { + super.handleFlush(line); + } + } else { + super.handleFlush(line); + } + } + + /** * Pass output sent to System.err to the TestRunner so it can * collect ot for the formatters. * * @since Ant 1.5 */ - protected void handleErrorOutput(String line) { + public void handleErrorOutput(String line) { if (runner != null) { runner.handleErrorOutput(line); if (showOutput) { @@ -731,6 +748,24 @@ } } else { super.handleErrorOutput(line); + } + } + + + /** + * Pass output sent to System.err to the TestRunner so it can + * collect ot for the formatters. + * + * @since Ant 1.5.2 + */ + public void handleErrorFlush(String line) { + if (runner != null) { + runner.handleErrorFlush(line); + if (showOutput) { + super.handleErrorFlush(line); + } + } else { + super.handleErrorFlush(line); } } 1.23.2.3 +13 -1 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java Index: JUnitTestRunner.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java,v retrieving revision 1.23.2.2 retrieving revision 1.23.2.3 diff -u -w -u -r1.23.2.2 -r1.23.2.3 --- JUnitTestRunner.java 6 Nov 2002 11:31:55 -0000 1.23.2.2 +++ JUnitTestRunner.java 31 Jan 2003 13:10:59 -0000 1.23.2.3 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -415,6 +415,18 @@ protected void handleErrorOutput(String line) { if (systemError != null) { systemError.println(line); + } + } + + protected void handleFlush(String line) { + if (systemOut != null) { + systemOut.print(line); + } + } + + protected void handleErrorFlush(String line) { + if (systemError != null) { + systemError.print(line); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]