git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270408 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -143,8 +143,8 @@ public class Patch extends Task | |||||
| } | } | ||||
| Execute exe = new Execute(); | Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| exe.setCommandline( toExecute.getCommandline() ); | exe.setCommandline( toExecute.getCommandline() ); | ||||
| try | try | ||||
| { | { | ||||
| @@ -179,7 +179,7 @@ public abstract class DefaultCompilerAdapter | |||||
| // as well as "bootclasspath" and "extdirs" | // as well as "bootclasspath" and "extdirs" | ||||
| if( Project.getJavaVersion().startsWith( "1.1" ) ) | if( Project.getJavaVersion().startsWith( "1.1" ) ) | ||||
| { | { | ||||
| Path cp = new Path( m_project ); | |||||
| Path cp = new Path(); | |||||
| /* | /* | ||||
| * XXX - This doesn't mix very well with build.systemclasspath, | * XXX - This doesn't mix very well with build.systemclasspath, | ||||
| */ | */ | ||||
| @@ -324,7 +324,7 @@ public abstract class DefaultCompilerAdapter | |||||
| protected Path getCompileClasspath() | protected Path getCompileClasspath() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| Path classpath = new Path( m_project ); | |||||
| Path classpath = new Path(); | |||||
| // add dest dir to classpath so that previously compiled and | // add dest dir to classpath so that previously compiled and | ||||
| // untouched classes are on classpath | // untouched classes are on classpath | ||||
| @@ -438,8 +438,8 @@ public abstract class DefaultCompilerAdapter | |||||
| try | try | ||||
| { | { | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( m_attributes, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( m_attributes, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( m_attributes.hackGetLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( m_attributes.hackGetLogger(), true ) ); | |||||
| exe.setWorkingDirectory( m_project.getBaseDir() ); | exe.setWorkingDirectory( m_project.getBaseDir() ); | ||||
| exe.setCommandline( commandArray ); | exe.setCommandline( commandArray ); | ||||
| return exe.execute(); | return exe.execute(); | ||||
| @@ -308,8 +308,8 @@ public class ExecTask extends Task | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -18,6 +18,7 @@ import org.apache.myrmidon.framework.exec.ExecMetaData; | |||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.avalon.framework.logger.Logger; | |||||
| /** | /** | ||||
| * Runs an external program. | * Runs an external program. | ||||
| @@ -65,10 +66,11 @@ public class Execute | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| task.hackGetLogger().debug( Commandline.toString( cmdline ) ); | |||||
| final Logger logger = task.hackGetLogger(); | |||||
| logger.debug( Commandline.toString( cmdline ) ); | |||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( task, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( task, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( logger, false ) ); | |||||
| exe.setError( new LogOutputStream( logger, true ) ); | |||||
| exe.setCommandline( cmdline ); | exe.setCommandline( cmdline ); | ||||
| int retval = exe.execute(); | int retval = exe.execute(); | ||||
| @@ -512,7 +512,7 @@ public class Javadoc | |||||
| { | { | ||||
| if( m_bootclasspath == null ) | if( m_bootclasspath == null ) | ||||
| { | { | ||||
| m_bootclasspath = new Path( getProject() ); | |||||
| m_bootclasspath = new Path(); | |||||
| } | } | ||||
| return m_bootclasspath.createPath(); | return m_bootclasspath.createPath(); | ||||
| } | } | ||||
| @@ -522,7 +522,7 @@ public class Javadoc | |||||
| { | { | ||||
| if( m_classpath == null ) | if( m_classpath == null ) | ||||
| { | { | ||||
| m_classpath = new Path( getProject() ); | |||||
| m_classpath = new Path(); | |||||
| } | } | ||||
| return m_classpath.createPath(); | return m_classpath.createPath(); | ||||
| } | } | ||||
| @@ -552,7 +552,7 @@ public class Javadoc | |||||
| { | { | ||||
| if( m_sourcePath == null ) | if( m_sourcePath == null ) | ||||
| { | { | ||||
| m_sourcePath = new Path( getProject() ); | |||||
| m_sourcePath = new Path(); | |||||
| } | } | ||||
| return m_sourcePath.createPath(); | return m_sourcePath.createPath(); | ||||
| } | } | ||||
| @@ -838,8 +838,8 @@ public class Javadoc | |||||
| getLogger().info( "Javadoc execution" ); | getLogger().info( "Javadoc execution" ); | ||||
| JavadocOutputStream out = new JavadocOutputStream( this, Project.MSG_INFO ); | |||||
| JavadocOutputStream err = new JavadocOutputStream( this, Project.MSG_WARN ); | |||||
| final JavadocOutputStream out = new JavadocOutputStream( getLogger(), false ); | |||||
| final JavadocOutputStream err = new JavadocOutputStream( getLogger(), true ); | |||||
| Execute exe = new Execute(); | Execute exe = new Execute(); | ||||
| exe.setOutput( out ); | exe.setOutput( out ); | ||||
| exe.setError( err ); | exe.setError( err ); | ||||
| @@ -10,30 +10,29 @@ package org.apache.tools.ant.taskdefs.javadoc; | |||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | ||||
| import org.apache.avalon.framework.logger.Logger; | |||||
| class JavadocOutputStream | class JavadocOutputStream | ||||
| extends LogOutputStream | extends LogOutputStream | ||||
| { | { | ||||
| // | |||||
| // Override the logging of output in order to filter out Generating | // Override the logging of output in order to filter out Generating | ||||
| // messages. Generating messages are set to a priority of VERBOSE | // messages. Generating messages are set to a priority of VERBOSE | ||||
| // unless they appear after what could be an informational message. | // unless they appear after what could be an informational message. | ||||
| // | // | ||||
| private String m_queuedLine; | private String m_queuedLine; | ||||
| JavadocOutputStream( Task javadoc, int level ) | |||||
| JavadocOutputStream( final Logger logger, final boolean isError ) | |||||
| { | { | ||||
| super( javadoc, level ); | |||||
| super( logger, isError ); | |||||
| } | } | ||||
| protected void processLine( String line, int messageLevel ) | |||||
| protected void processLine( final String line ) | |||||
| { | { | ||||
| if( messageLevel == Project.MSG_INFO && line.startsWith( "Generating " ) ) | |||||
| if( !isError() && line.startsWith( "Generating " ) ) | |||||
| { | { | ||||
| if( m_queuedLine != null ) | if( m_queuedLine != null ) | ||||
| { | { | ||||
| super.processLine( m_queuedLine, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( m_queuedLine ); | |||||
| } | } | ||||
| m_queuedLine = line; | m_queuedLine = line; | ||||
| } | } | ||||
| @@ -42,12 +41,16 @@ class JavadocOutputStream | |||||
| if( m_queuedLine != null ) | if( m_queuedLine != null ) | ||||
| { | { | ||||
| if( line.startsWith( "Building " ) ) | if( line.startsWith( "Building " ) ) | ||||
| super.processLine( m_queuedLine, Project.MSG_VERBOSE ); | |||||
| { | |||||
| getLogger().debug( m_queuedLine ); | |||||
| } | |||||
| else | else | ||||
| super.processLine( m_queuedLine, Project.MSG_INFO ); | |||||
| { | |||||
| getLogger().info( m_queuedLine ); | |||||
| } | |||||
| m_queuedLine = null; | m_queuedLine = null; | ||||
| } | } | ||||
| super.processLine( line, messageLevel ); | |||||
| getLogger().warn( line ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -225,8 +225,8 @@ public class ANTLR extends Task | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| if( workingdir != null ) | if( workingdir != null ) | ||||
| { | { | ||||
| @@ -14,6 +14,7 @@ import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; | import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| /** | /** | ||||
| @@ -127,6 +128,9 @@ public abstract class Continuus | |||||
| protected int run( final Commandline cmd ) | protected int run( final Commandline cmd ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| return run( cmd, new LogStreamHandler( this, Project.MSG_VERBOSE, Project.MSG_WARN ) ); | |||||
| final LogOutputStream output = new LogOutputStream( getLogger(), false ); | |||||
| final LogOutputStream error = new LogOutputStream( getLogger(), true ); | |||||
| final LogStreamHandler handler = new LogStreamHandler( output, error ); | |||||
| return run( cmd, handler ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -109,8 +109,8 @@ public abstract class ClearCase extends Task | |||||
| try | try | ||||
| { | { | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| exe.setWorkingDirectory( getBaseDirectory() ); | exe.setWorkingDirectory( getBaseDirectory() ); | ||||
| exe.setCommandline( cmd.getCommandline() ); | exe.setCommandline( cmd.getCommandline() ); | ||||
| return exe.execute(); | return exe.execute(); | ||||
| @@ -11,7 +11,6 @@ import java.io.File; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | import org.apache.avalon.framework.logger.AbstractLogEnabled; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | ||||
| @@ -202,8 +201,8 @@ public class NetCommand | |||||
| // default directory to the project's base directory | // default directory to the project's base directory | ||||
| File dir = _owner.getBaseDirectory(); | File dir = _owner.getBaseDirectory(); | ||||
| _exe = new Execute(); | _exe = new Execute(); | ||||
| _exe.setOutput( new LogOutputStream( _owner, Project.MSG_INFO ) ); | |||||
| _exe.setError( new LogOutputStream( _owner, Project.MSG_WARN ) ); | |||||
| _exe.setOutput( new LogOutputStream( _owner.hackGetLogger(), false ) ); | |||||
| _exe.setError( new LogOutputStream( _owner.hackGetLogger(), true ) ); | |||||
| _exe.setWorkingDirectory( dir ); | _exe.setWorkingDirectory( dir ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -185,8 +185,8 @@ public class JJTree extends Task | |||||
| arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); | arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), false ) ); | |||||
| getLogger().debug( cmdl.toString() ); | getLogger().debug( cmdl.toString() ); | ||||
| exe.setCommandline( cmdl.getCommandline() ); | exe.setCommandline( cmdl.getCommandline() ); | ||||
| @@ -205,7 +205,7 @@ public class JDependTask extends Task | |||||
| { | { | ||||
| if( _compileClasspath == null ) | if( _compileClasspath == null ) | ||||
| { | { | ||||
| _compileClasspath = new Path( getProject() ); | |||||
| _compileClasspath = new Path(); | |||||
| } | } | ||||
| return _compileClasspath.createPath(); | return _compileClasspath.createPath(); | ||||
| } | } | ||||
| @@ -232,7 +232,7 @@ public class JDependTask extends Task | |||||
| { | { | ||||
| if( _sourcesPath == null ) | if( _sourcesPath == null ) | ||||
| { | { | ||||
| _sourcesPath = new Path( getProject() ); | |||||
| _sourcesPath = new Path(); | |||||
| } | } | ||||
| return _sourcesPath.createPath(); | return _sourcesPath.createPath(); | ||||
| } | } | ||||
| @@ -328,8 +328,8 @@ public class JDependTask extends Task | |||||
| } | } | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| exe.setCommandline( commandline.getCommandline() ); | exe.setCommandline( commandline.getCommandline() ); | ||||
| if( getDir() != null ) | if( getDir() != null ) | ||||
| @@ -405,7 +405,7 @@ public class JUnitTask extends Task | |||||
| */ | */ | ||||
| protected OutputStream getDefaultOutput() | protected OutputStream getDefaultOutput() | ||||
| { | { | ||||
| return new LogOutputStream( this, Project.MSG_INFO ); | |||||
| return new LogOutputStream( getLogger(), false ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -650,8 +650,8 @@ public class JUnitTask extends Task | |||||
| } | } | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| exe.setCommandline( cmd.getCommandline() ); | exe.setCommandline( cmd.getCommandline() ); | ||||
| if( dir != null ) | if( dir != null ) | ||||
| @@ -135,7 +135,7 @@ public class MAudit extends AbstractMetamataTask | |||||
| { | { | ||||
| if( searchPath == null ) | if( searchPath == null ) | ||||
| { | { | ||||
| searchPath = new Path( getProject() ); | |||||
| searchPath = new Path(); | |||||
| } | } | ||||
| return searchPath; | return searchPath; | ||||
| } | } | ||||
| @@ -226,8 +226,8 @@ public class MAudit extends AbstractMetamataTask | |||||
| // if we didn't specify a file, then use a screen report | // if we didn't specify a file, then use a screen report | ||||
| if( outFile == null ) | if( outFile == null ) | ||||
| { | { | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -114,7 +114,7 @@ public class MMetrics extends AbstractMetamataTask | |||||
| { | { | ||||
| if( path == null ) | if( path == null ) | ||||
| { | { | ||||
| path = new Path( getProject() ); | |||||
| path = new Path(); | |||||
| } | } | ||||
| return path; | return path; | ||||
| } | } | ||||
| @@ -226,8 +226,8 @@ public class MMetrics extends AbstractMetamataTask | |||||
| */ | */ | ||||
| protected void setupStreamHandler( final Execute exe ) | protected void setupStreamHandler( final Execute exe ) | ||||
| { | { | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), false ) ); | |||||
| } | } | ||||
| protected void execute0( ExecuteStreamHandler handler ) | protected void execute0( ExecuteStreamHandler handler ) | ||||
| @@ -18,6 +18,7 @@ import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; | import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | ||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| @@ -150,7 +151,7 @@ public class MParse extends Task | |||||
| { | { | ||||
| if( classpath == null ) | if( classpath == null ) | ||||
| { | { | ||||
| classpath = new Path( getProject() ); | |||||
| classpath = new Path(); | |||||
| } | } | ||||
| return classpath; | return classpath; | ||||
| } | } | ||||
| @@ -174,7 +175,7 @@ public class MParse extends Task | |||||
| { | { | ||||
| if( sourcepath == null ) | if( sourcepath == null ) | ||||
| { | { | ||||
| sourcepath = new Path( getProject() ); | |||||
| sourcepath = new Path(); | |||||
| } | } | ||||
| return sourcepath; | return sourcepath; | ||||
| } | } | ||||
| @@ -385,7 +386,9 @@ public class MParse extends Task | |||||
| */ | */ | ||||
| protected ExecuteStreamHandler createStreamHandler() | protected ExecuteStreamHandler createStreamHandler() | ||||
| { | { | ||||
| return new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_INFO ); | |||||
| final LogOutputStream output = new LogOutputStream( getLogger(), false ); | |||||
| final LogOutputStream error = new LogOutputStream( getLogger(), false ); | |||||
| return new LogStreamHandler( output, error ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -365,7 +365,8 @@ public class Pvcs extends org.apache.tools.ant.Task | |||||
| tmp = new File( "pvcs_ant_" + rand.nextLong() + ".log" ); | tmp = new File( "pvcs_ant_" + rand.nextLong() + ".log" ); | ||||
| tmp2 = new File( "pvcs_ant_" + rand.nextLong() + ".log" ); | tmp2 = new File( "pvcs_ant_" + rand.nextLong() + ".log" ); | ||||
| getLogger().debug( "Executing " + commandLine.toString() ); | getLogger().debug( "Executing " + commandLine.toString() ); | ||||
| result = runCmd( commandLine, new FileOutputStream( tmp ), new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| result = runCmd( commandLine, new FileOutputStream( tmp ), | |||||
| new LogOutputStream( getLogger(), true ) ); | |||||
| if( result != 0 && !ignorerc ) | if( result != 0 && !ignorerc ) | ||||
| { | { | ||||
| String msg = "Failed executing: " + commandLine.toString(); | String msg = "Failed executing: " + commandLine.toString(); | ||||
| @@ -407,8 +408,8 @@ public class Pvcs extends org.apache.tools.ant.Task | |||||
| commandLine.createArgument().setValue( "@" + tmp2.getAbsolutePath() ); | commandLine.createArgument().setValue( "@" + tmp2.getAbsolutePath() ); | ||||
| getLogger().info( "Getting files" ); | getLogger().info( "Getting files" ); | ||||
| getLogger().debug( "Executing " + commandLine.toString() ); | getLogger().debug( "Executing " + commandLine.toString() ); | ||||
| final LogOutputStream output = new LogOutputStream( this, Project.MSG_INFO ); | |||||
| final LogOutputStream error = new LogOutputStream( this, Project.MSG_WARN ); | |||||
| final LogOutputStream output = new LogOutputStream( getLogger(), false ); | |||||
| final LogOutputStream error = new LogOutputStream( getLogger(), true ); | |||||
| result = runCmd( commandLine, output, error ); | result = runCmd( commandLine, output, error ); | ||||
| if( result != 0 && !ignorerc ) | if( result != 0 && !ignorerc ) | ||||
| @@ -116,8 +116,8 @@ public class CovMerge extends Task | |||||
| cmdl.createArgument().setValue( "-jp_paramfile=" + paramfile.getAbsolutePath() ); | cmdl.createArgument().setValue( "-jp_paramfile=" + paramfile.getAbsolutePath() ); | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| getLogger().debug( cmdl.toString() ); | getLogger().debug( cmdl.toString() ); | ||||
| exe.setCommandline( cmdl.getCommandline() ); | exe.setCommandline( cmdl.getCommandline() ); | ||||
| @@ -203,7 +203,7 @@ public class CovReport extends Task | |||||
| { | { | ||||
| if( coveragePath == null ) | if( coveragePath == null ) | ||||
| { | { | ||||
| coveragePath = new Path( getProject() ); | |||||
| coveragePath = new Path(); | |||||
| } | } | ||||
| return coveragePath.createPath(); | return coveragePath.createPath(); | ||||
| } | } | ||||
| @@ -221,7 +221,7 @@ public class CovReport extends Task | |||||
| { | { | ||||
| if( sourcePath == null ) | if( sourcePath == null ) | ||||
| { | { | ||||
| sourcePath = new Path( getProject() ); | |||||
| sourcePath = new Path(); | |||||
| } | } | ||||
| return sourcePath.createPath(); | return sourcePath.createPath(); | ||||
| } | } | ||||
| @@ -243,8 +243,8 @@ public class CovReport extends Task | |||||
| // use the custom handler for stdin issues | // use the custom handler for stdin issues | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| getLogger().debug( cmdl.toString() ); | getLogger().debug( cmdl.toString() ); | ||||
| exe.setCommandline( cmdl.getCommandline() ); | exe.setCommandline( cmdl.getCommandline() ); | ||||
| int exitValue = exe.execute(); | int exitValue = exe.execute(); | ||||
| @@ -291,7 +291,7 @@ public class CovReport extends Task | |||||
| // as a default -sourcepath use . in JProbe, so use project . | // as a default -sourcepath use . in JProbe, so use project . | ||||
| if( sourcePath == null ) | if( sourcePath == null ) | ||||
| { | { | ||||
| sourcePath = new Path( getProject() ); | |||||
| sourcePath = new Path(); | |||||
| sourcePath.createPath().setLocation( getBaseDirectory() ); | sourcePath.createPath().setLocation( getBaseDirectory() ); | ||||
| } | } | ||||
| v.add( "-sourcepath=" + sourcePath ); | v.add( "-sourcepath=" + sourcePath ); | ||||
| @@ -301,9 +301,7 @@ public class CovReport extends Task | |||||
| v.add( "-inc_src_text=" + ( includeSource ? "on" : "off" ) ); | v.add( "-inc_src_text=" + ( includeSource ? "on" : "off" ) ); | ||||
| } | } | ||||
| String[] params = new String[ v.size() ]; | |||||
| v.copyInto( params ); | |||||
| return params; | |||||
| return (String[])v.toArray( new String[ v.size() ] ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -365,7 +363,7 @@ public class CovReport extends Task | |||||
| { | { | ||||
| if( classPath == null ) | if( classPath == null ) | ||||
| { | { | ||||
| classPath = new Path( CovReport.this.getProject() ); | |||||
| classPath = new Path(); | |||||
| } | } | ||||
| return classPath.createPath(); | return classPath.createPath(); | ||||
| } | } | ||||
| @@ -20,6 +20,7 @@ import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| @@ -294,7 +295,9 @@ public class Coverage extends Task | |||||
| cmdl.createArgument().setValue( "-jp_input=" + paramfile.getAbsolutePath() ); | cmdl.createArgument().setValue( "-jp_input=" + paramfile.getAbsolutePath() ); | ||||
| // use the custom handler for stdin issues | // use the custom handler for stdin issues | ||||
| LogStreamHandler handler = new CoverageStreamHandler( this ); | |||||
| final LogOutputStream output = new LogOutputStream( getLogger(), false ); | |||||
| final LogOutputStream error = new LogOutputStream( getLogger(), true ); | |||||
| final LogStreamHandler handler = new CoverageStreamHandler( output, error ); | |||||
| Execute exec = new Execute( handler ); | Execute exec = new Execute( handler ); | ||||
| getLogger().debug( cmdl.toString() ); | getLogger().debug( cmdl.toString() ); | ||||
| exec.setCommandline( cmdl.getCommandline() ); | exec.setCommandline( cmdl.getCommandline() ); | ||||
| @@ -383,9 +386,7 @@ public class Coverage extends Task | |||||
| params.add( args[ i ] ); | params.add( args[ i ] ); | ||||
| } | } | ||||
| String[] array = new String[ params.size() ]; | |||||
| params.copyInto( array ); | |||||
| return array; | |||||
| return (String[])params.toArray( new String[ params.size() ] ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -540,11 +541,12 @@ public class Coverage extends Task | |||||
| /** | /** | ||||
| * specific pumper to avoid those nasty stdin issues | * specific pumper to avoid those nasty stdin issues | ||||
| */ | */ | ||||
| static class CoverageStreamHandler extends LogStreamHandler | |||||
| static class CoverageStreamHandler | |||||
| extends LogStreamHandler | |||||
| { | { | ||||
| CoverageStreamHandler( Task task ) | |||||
| CoverageStreamHandler( OutputStream output, OutputStream error ) | |||||
| { | { | ||||
| super( task, Project.MSG_INFO, Project.MSG_WARN ); | |||||
| super( output, error ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -206,8 +206,8 @@ public abstract class MSVSS extends Task | |||||
| try | try | ||||
| { | { | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| // If location of ss.ini is specified we need to set the | // If location of ss.ini is specified we need to set the | ||||
| // environment-variable SSDIR to this value | // environment-variable SSDIR to this value | ||||
| @@ -32,7 +32,8 @@ public class SunRmic extends DefaultRmicAdapter | |||||
| // Create an instance of the rmic, redirecting output to | // Create an instance of the rmic, redirecting output to | ||||
| // the project log | // the project log | ||||
| LogOutputStream logstr = new LogOutputStream( getRmic(), Project.MSG_WARN ); | |||||
| LogOutputStream logstr = | |||||
| new LogOutputStream( getRmic().hackGetLogger(), true ); | |||||
| try | try | ||||
| { | { | ||||
| @@ -146,8 +146,8 @@ public class Rpm extends Task | |||||
| if( error == null && output == null ) | if( error == null && output == null ) | ||||
| { | { | ||||
| outputstream = new LogOutputStream( this, Project.MSG_INFO ); | |||||
| errorstream = new LogOutputStream( this, Project.MSG_WARN ); | |||||
| outputstream = new LogOutputStream( getLogger(), false ); | |||||
| errorstream = new LogOutputStream( getLogger(), true ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -164,7 +164,7 @@ public class Rpm extends Task | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| outputstream = new LogOutputStream( this, Project.MSG_INFO ); | |||||
| outputstream = new LogOutputStream( getLogger(), false ); | |||||
| } | } | ||||
| if( error != null ) | if( error != null ) | ||||
| { | { | ||||
| @@ -179,7 +179,7 @@ public class Rpm extends Task | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| errorstream = new LogOutputStream( this, Project.MSG_WARN ); | |||||
| errorstream = new LogOutputStream( getLogger(), true ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -143,8 +143,8 @@ public class Patch extends Task | |||||
| } | } | ||||
| Execute exe = new Execute(); | Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| exe.setCommandline( toExecute.getCommandline() ); | exe.setCommandline( toExecute.getCommandline() ); | ||||
| try | try | ||||
| { | { | ||||
| @@ -179,7 +179,7 @@ public abstract class DefaultCompilerAdapter | |||||
| // as well as "bootclasspath" and "extdirs" | // as well as "bootclasspath" and "extdirs" | ||||
| if( Project.getJavaVersion().startsWith( "1.1" ) ) | if( Project.getJavaVersion().startsWith( "1.1" ) ) | ||||
| { | { | ||||
| Path cp = new Path( m_project ); | |||||
| Path cp = new Path(); | |||||
| /* | /* | ||||
| * XXX - This doesn't mix very well with build.systemclasspath, | * XXX - This doesn't mix very well with build.systemclasspath, | ||||
| */ | */ | ||||
| @@ -324,7 +324,7 @@ public abstract class DefaultCompilerAdapter | |||||
| protected Path getCompileClasspath() | protected Path getCompileClasspath() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| Path classpath = new Path( m_project ); | |||||
| Path classpath = new Path(); | |||||
| // add dest dir to classpath so that previously compiled and | // add dest dir to classpath so that previously compiled and | ||||
| // untouched classes are on classpath | // untouched classes are on classpath | ||||
| @@ -438,8 +438,8 @@ public abstract class DefaultCompilerAdapter | |||||
| try | try | ||||
| { | { | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( m_attributes, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( m_attributes, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( m_attributes.hackGetLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( m_attributes.hackGetLogger(), true ) ); | |||||
| exe.setWorkingDirectory( m_project.getBaseDir() ); | exe.setWorkingDirectory( m_project.getBaseDir() ); | ||||
| exe.setCommandline( commandArray ); | exe.setCommandline( commandArray ); | ||||
| return exe.execute(); | return exe.execute(); | ||||
| @@ -308,8 +308,8 @@ public class ExecTask extends Task | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -18,6 +18,7 @@ import org.apache.myrmidon.framework.exec.ExecMetaData; | |||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.avalon.framework.logger.Logger; | |||||
| /** | /** | ||||
| * Runs an external program. | * Runs an external program. | ||||
| @@ -65,10 +66,11 @@ public class Execute | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| task.hackGetLogger().debug( Commandline.toString( cmdline ) ); | |||||
| final Logger logger = task.hackGetLogger(); | |||||
| logger.debug( Commandline.toString( cmdline ) ); | |||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( task, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( task, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( logger, false ) ); | |||||
| exe.setError( new LogOutputStream( logger, true ) ); | |||||
| exe.setCommandline( cmdline ); | exe.setCommandline( cmdline ); | ||||
| int retval = exe.execute(); | int retval = exe.execute(); | ||||
| @@ -512,7 +512,7 @@ public class Javadoc | |||||
| { | { | ||||
| if( m_bootclasspath == null ) | if( m_bootclasspath == null ) | ||||
| { | { | ||||
| m_bootclasspath = new Path( getProject() ); | |||||
| m_bootclasspath = new Path(); | |||||
| } | } | ||||
| return m_bootclasspath.createPath(); | return m_bootclasspath.createPath(); | ||||
| } | } | ||||
| @@ -522,7 +522,7 @@ public class Javadoc | |||||
| { | { | ||||
| if( m_classpath == null ) | if( m_classpath == null ) | ||||
| { | { | ||||
| m_classpath = new Path( getProject() ); | |||||
| m_classpath = new Path(); | |||||
| } | } | ||||
| return m_classpath.createPath(); | return m_classpath.createPath(); | ||||
| } | } | ||||
| @@ -552,7 +552,7 @@ public class Javadoc | |||||
| { | { | ||||
| if( m_sourcePath == null ) | if( m_sourcePath == null ) | ||||
| { | { | ||||
| m_sourcePath = new Path( getProject() ); | |||||
| m_sourcePath = new Path(); | |||||
| } | } | ||||
| return m_sourcePath.createPath(); | return m_sourcePath.createPath(); | ||||
| } | } | ||||
| @@ -838,8 +838,8 @@ public class Javadoc | |||||
| getLogger().info( "Javadoc execution" ); | getLogger().info( "Javadoc execution" ); | ||||
| JavadocOutputStream out = new JavadocOutputStream( this, Project.MSG_INFO ); | |||||
| JavadocOutputStream err = new JavadocOutputStream( this, Project.MSG_WARN ); | |||||
| final JavadocOutputStream out = new JavadocOutputStream( getLogger(), false ); | |||||
| final JavadocOutputStream err = new JavadocOutputStream( getLogger(), true ); | |||||
| Execute exe = new Execute(); | Execute exe = new Execute(); | ||||
| exe.setOutput( out ); | exe.setOutput( out ); | ||||
| exe.setError( err ); | exe.setError( err ); | ||||
| @@ -10,30 +10,29 @@ package org.apache.tools.ant.taskdefs.javadoc; | |||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | ||||
| import org.apache.avalon.framework.logger.Logger; | |||||
| class JavadocOutputStream | class JavadocOutputStream | ||||
| extends LogOutputStream | extends LogOutputStream | ||||
| { | { | ||||
| // | |||||
| // Override the logging of output in order to filter out Generating | // Override the logging of output in order to filter out Generating | ||||
| // messages. Generating messages are set to a priority of VERBOSE | // messages. Generating messages are set to a priority of VERBOSE | ||||
| // unless they appear after what could be an informational message. | // unless they appear after what could be an informational message. | ||||
| // | // | ||||
| private String m_queuedLine; | private String m_queuedLine; | ||||
| JavadocOutputStream( Task javadoc, int level ) | |||||
| JavadocOutputStream( final Logger logger, final boolean isError ) | |||||
| { | { | ||||
| super( javadoc, level ); | |||||
| super( logger, isError ); | |||||
| } | } | ||||
| protected void processLine( String line, int messageLevel ) | |||||
| protected void processLine( final String line ) | |||||
| { | { | ||||
| if( messageLevel == Project.MSG_INFO && line.startsWith( "Generating " ) ) | |||||
| if( !isError() && line.startsWith( "Generating " ) ) | |||||
| { | { | ||||
| if( m_queuedLine != null ) | if( m_queuedLine != null ) | ||||
| { | { | ||||
| super.processLine( m_queuedLine, Project.MSG_VERBOSE ); | |||||
| getLogger().debug( m_queuedLine ); | |||||
| } | } | ||||
| m_queuedLine = line; | m_queuedLine = line; | ||||
| } | } | ||||
| @@ -42,12 +41,16 @@ class JavadocOutputStream | |||||
| if( m_queuedLine != null ) | if( m_queuedLine != null ) | ||||
| { | { | ||||
| if( line.startsWith( "Building " ) ) | if( line.startsWith( "Building " ) ) | ||||
| super.processLine( m_queuedLine, Project.MSG_VERBOSE ); | |||||
| { | |||||
| getLogger().debug( m_queuedLine ); | |||||
| } | |||||
| else | else | ||||
| super.processLine( m_queuedLine, Project.MSG_INFO ); | |||||
| { | |||||
| getLogger().info( m_queuedLine ); | |||||
| } | |||||
| m_queuedLine = null; | m_queuedLine = null; | ||||
| } | } | ||||
| super.processLine( line, messageLevel ); | |||||
| getLogger().warn( line ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -225,8 +225,8 @@ public class ANTLR extends Task | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| if( workingdir != null ) | if( workingdir != null ) | ||||
| { | { | ||||
| @@ -14,6 +14,7 @@ import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; | import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| /** | /** | ||||
| @@ -127,6 +128,9 @@ public abstract class Continuus | |||||
| protected int run( final Commandline cmd ) | protected int run( final Commandline cmd ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| return run( cmd, new LogStreamHandler( this, Project.MSG_VERBOSE, Project.MSG_WARN ) ); | |||||
| final LogOutputStream output = new LogOutputStream( getLogger(), false ); | |||||
| final LogOutputStream error = new LogOutputStream( getLogger(), true ); | |||||
| final LogStreamHandler handler = new LogStreamHandler( output, error ); | |||||
| return run( cmd, handler ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -109,8 +109,8 @@ public abstract class ClearCase extends Task | |||||
| try | try | ||||
| { | { | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| exe.setWorkingDirectory( getBaseDirectory() ); | exe.setWorkingDirectory( getBaseDirectory() ); | ||||
| exe.setCommandline( cmd.getCommandline() ); | exe.setCommandline( cmd.getCommandline() ); | ||||
| return exe.execute(); | return exe.execute(); | ||||
| @@ -11,7 +11,6 @@ import java.io.File; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | import org.apache.avalon.framework.logger.AbstractLogEnabled; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | ||||
| @@ -202,8 +201,8 @@ public class NetCommand | |||||
| // default directory to the project's base directory | // default directory to the project's base directory | ||||
| File dir = _owner.getBaseDirectory(); | File dir = _owner.getBaseDirectory(); | ||||
| _exe = new Execute(); | _exe = new Execute(); | ||||
| _exe.setOutput( new LogOutputStream( _owner, Project.MSG_INFO ) ); | |||||
| _exe.setError( new LogOutputStream( _owner, Project.MSG_WARN ) ); | |||||
| _exe.setOutput( new LogOutputStream( _owner.hackGetLogger(), false ) ); | |||||
| _exe.setError( new LogOutputStream( _owner.hackGetLogger(), true ) ); | |||||
| _exe.setWorkingDirectory( dir ); | _exe.setWorkingDirectory( dir ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -185,8 +185,8 @@ public class JJTree extends Task | |||||
| arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); | arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), false ) ); | |||||
| getLogger().debug( cmdl.toString() ); | getLogger().debug( cmdl.toString() ); | ||||
| exe.setCommandline( cmdl.getCommandline() ); | exe.setCommandline( cmdl.getCommandline() ); | ||||
| @@ -205,7 +205,7 @@ public class JDependTask extends Task | |||||
| { | { | ||||
| if( _compileClasspath == null ) | if( _compileClasspath == null ) | ||||
| { | { | ||||
| _compileClasspath = new Path( getProject() ); | |||||
| _compileClasspath = new Path(); | |||||
| } | } | ||||
| return _compileClasspath.createPath(); | return _compileClasspath.createPath(); | ||||
| } | } | ||||
| @@ -232,7 +232,7 @@ public class JDependTask extends Task | |||||
| { | { | ||||
| if( _sourcesPath == null ) | if( _sourcesPath == null ) | ||||
| { | { | ||||
| _sourcesPath = new Path( getProject() ); | |||||
| _sourcesPath = new Path(); | |||||
| } | } | ||||
| return _sourcesPath.createPath(); | return _sourcesPath.createPath(); | ||||
| } | } | ||||
| @@ -328,8 +328,8 @@ public class JDependTask extends Task | |||||
| } | } | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| exe.setCommandline( commandline.getCommandline() ); | exe.setCommandline( commandline.getCommandline() ); | ||||
| if( getDir() != null ) | if( getDir() != null ) | ||||
| @@ -405,7 +405,7 @@ public class JUnitTask extends Task | |||||
| */ | */ | ||||
| protected OutputStream getDefaultOutput() | protected OutputStream getDefaultOutput() | ||||
| { | { | ||||
| return new LogOutputStream( this, Project.MSG_INFO ); | |||||
| return new LogOutputStream( getLogger(), false ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -650,8 +650,8 @@ public class JUnitTask extends Task | |||||
| } | } | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| exe.setCommandline( cmd.getCommandline() ); | exe.setCommandline( cmd.getCommandline() ); | ||||
| if( dir != null ) | if( dir != null ) | ||||
| @@ -135,7 +135,7 @@ public class MAudit extends AbstractMetamataTask | |||||
| { | { | ||||
| if( searchPath == null ) | if( searchPath == null ) | ||||
| { | { | ||||
| searchPath = new Path( getProject() ); | |||||
| searchPath = new Path(); | |||||
| } | } | ||||
| return searchPath; | return searchPath; | ||||
| } | } | ||||
| @@ -226,8 +226,8 @@ public class MAudit extends AbstractMetamataTask | |||||
| // if we didn't specify a file, then use a screen report | // if we didn't specify a file, then use a screen report | ||||
| if( outFile == null ) | if( outFile == null ) | ||||
| { | { | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -114,7 +114,7 @@ public class MMetrics extends AbstractMetamataTask | |||||
| { | { | ||||
| if( path == null ) | if( path == null ) | ||||
| { | { | ||||
| path = new Path( getProject() ); | |||||
| path = new Path(); | |||||
| } | } | ||||
| return path; | return path; | ||||
| } | } | ||||
| @@ -226,8 +226,8 @@ public class MMetrics extends AbstractMetamataTask | |||||
| */ | */ | ||||
| protected void setupStreamHandler( final Execute exe ) | protected void setupStreamHandler( final Execute exe ) | ||||
| { | { | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), false ) ); | |||||
| } | } | ||||
| protected void execute0( ExecuteStreamHandler handler ) | protected void execute0( ExecuteStreamHandler handler ) | ||||
| @@ -18,6 +18,7 @@ import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; | import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | ||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| @@ -150,7 +151,7 @@ public class MParse extends Task | |||||
| { | { | ||||
| if( classpath == null ) | if( classpath == null ) | ||||
| { | { | ||||
| classpath = new Path( getProject() ); | |||||
| classpath = new Path(); | |||||
| } | } | ||||
| return classpath; | return classpath; | ||||
| } | } | ||||
| @@ -174,7 +175,7 @@ public class MParse extends Task | |||||
| { | { | ||||
| if( sourcepath == null ) | if( sourcepath == null ) | ||||
| { | { | ||||
| sourcepath = new Path( getProject() ); | |||||
| sourcepath = new Path(); | |||||
| } | } | ||||
| return sourcepath; | return sourcepath; | ||||
| } | } | ||||
| @@ -385,7 +386,9 @@ public class MParse extends Task | |||||
| */ | */ | ||||
| protected ExecuteStreamHandler createStreamHandler() | protected ExecuteStreamHandler createStreamHandler() | ||||
| { | { | ||||
| return new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_INFO ); | |||||
| final LogOutputStream output = new LogOutputStream( getLogger(), false ); | |||||
| final LogOutputStream error = new LogOutputStream( getLogger(), false ); | |||||
| return new LogStreamHandler( output, error ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -365,7 +365,8 @@ public class Pvcs extends org.apache.tools.ant.Task | |||||
| tmp = new File( "pvcs_ant_" + rand.nextLong() + ".log" ); | tmp = new File( "pvcs_ant_" + rand.nextLong() + ".log" ); | ||||
| tmp2 = new File( "pvcs_ant_" + rand.nextLong() + ".log" ); | tmp2 = new File( "pvcs_ant_" + rand.nextLong() + ".log" ); | ||||
| getLogger().debug( "Executing " + commandLine.toString() ); | getLogger().debug( "Executing " + commandLine.toString() ); | ||||
| result = runCmd( commandLine, new FileOutputStream( tmp ), new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| result = runCmd( commandLine, new FileOutputStream( tmp ), | |||||
| new LogOutputStream( getLogger(), true ) ); | |||||
| if( result != 0 && !ignorerc ) | if( result != 0 && !ignorerc ) | ||||
| { | { | ||||
| String msg = "Failed executing: " + commandLine.toString(); | String msg = "Failed executing: " + commandLine.toString(); | ||||
| @@ -407,8 +408,8 @@ public class Pvcs extends org.apache.tools.ant.Task | |||||
| commandLine.createArgument().setValue( "@" + tmp2.getAbsolutePath() ); | commandLine.createArgument().setValue( "@" + tmp2.getAbsolutePath() ); | ||||
| getLogger().info( "Getting files" ); | getLogger().info( "Getting files" ); | ||||
| getLogger().debug( "Executing " + commandLine.toString() ); | getLogger().debug( "Executing " + commandLine.toString() ); | ||||
| final LogOutputStream output = new LogOutputStream( this, Project.MSG_INFO ); | |||||
| final LogOutputStream error = new LogOutputStream( this, Project.MSG_WARN ); | |||||
| final LogOutputStream output = new LogOutputStream( getLogger(), false ); | |||||
| final LogOutputStream error = new LogOutputStream( getLogger(), true ); | |||||
| result = runCmd( commandLine, output, error ); | result = runCmd( commandLine, output, error ); | ||||
| if( result != 0 && !ignorerc ) | if( result != 0 && !ignorerc ) | ||||
| @@ -116,8 +116,8 @@ public class CovMerge extends Task | |||||
| cmdl.createArgument().setValue( "-jp_paramfile=" + paramfile.getAbsolutePath() ); | cmdl.createArgument().setValue( "-jp_paramfile=" + paramfile.getAbsolutePath() ); | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| getLogger().debug( cmdl.toString() ); | getLogger().debug( cmdl.toString() ); | ||||
| exe.setCommandline( cmdl.getCommandline() ); | exe.setCommandline( cmdl.getCommandline() ); | ||||
| @@ -203,7 +203,7 @@ public class CovReport extends Task | |||||
| { | { | ||||
| if( coveragePath == null ) | if( coveragePath == null ) | ||||
| { | { | ||||
| coveragePath = new Path( getProject() ); | |||||
| coveragePath = new Path(); | |||||
| } | } | ||||
| return coveragePath.createPath(); | return coveragePath.createPath(); | ||||
| } | } | ||||
| @@ -221,7 +221,7 @@ public class CovReport extends Task | |||||
| { | { | ||||
| if( sourcePath == null ) | if( sourcePath == null ) | ||||
| { | { | ||||
| sourcePath = new Path( getProject() ); | |||||
| sourcePath = new Path(); | |||||
| } | } | ||||
| return sourcePath.createPath(); | return sourcePath.createPath(); | ||||
| } | } | ||||
| @@ -243,8 +243,8 @@ public class CovReport extends Task | |||||
| // use the custom handler for stdin issues | // use the custom handler for stdin issues | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| getLogger().debug( cmdl.toString() ); | getLogger().debug( cmdl.toString() ); | ||||
| exe.setCommandline( cmdl.getCommandline() ); | exe.setCommandline( cmdl.getCommandline() ); | ||||
| int exitValue = exe.execute(); | int exitValue = exe.execute(); | ||||
| @@ -291,7 +291,7 @@ public class CovReport extends Task | |||||
| // as a default -sourcepath use . in JProbe, so use project . | // as a default -sourcepath use . in JProbe, so use project . | ||||
| if( sourcePath == null ) | if( sourcePath == null ) | ||||
| { | { | ||||
| sourcePath = new Path( getProject() ); | |||||
| sourcePath = new Path(); | |||||
| sourcePath.createPath().setLocation( getBaseDirectory() ); | sourcePath.createPath().setLocation( getBaseDirectory() ); | ||||
| } | } | ||||
| v.add( "-sourcepath=" + sourcePath ); | v.add( "-sourcepath=" + sourcePath ); | ||||
| @@ -301,9 +301,7 @@ public class CovReport extends Task | |||||
| v.add( "-inc_src_text=" + ( includeSource ? "on" : "off" ) ); | v.add( "-inc_src_text=" + ( includeSource ? "on" : "off" ) ); | ||||
| } | } | ||||
| String[] params = new String[ v.size() ]; | |||||
| v.copyInto( params ); | |||||
| return params; | |||||
| return (String[])v.toArray( new String[ v.size() ] ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -365,7 +363,7 @@ public class CovReport extends Task | |||||
| { | { | ||||
| if( classPath == null ) | if( classPath == null ) | ||||
| { | { | ||||
| classPath = new Path( CovReport.this.getProject() ); | |||||
| classPath = new Path(); | |||||
| } | } | ||||
| return classPath.createPath(); | return classPath.createPath(); | ||||
| } | } | ||||
| @@ -20,6 +20,7 @@ import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| @@ -294,7 +295,9 @@ public class Coverage extends Task | |||||
| cmdl.createArgument().setValue( "-jp_input=" + paramfile.getAbsolutePath() ); | cmdl.createArgument().setValue( "-jp_input=" + paramfile.getAbsolutePath() ); | ||||
| // use the custom handler for stdin issues | // use the custom handler for stdin issues | ||||
| LogStreamHandler handler = new CoverageStreamHandler( this ); | |||||
| final LogOutputStream output = new LogOutputStream( getLogger(), false ); | |||||
| final LogOutputStream error = new LogOutputStream( getLogger(), true ); | |||||
| final LogStreamHandler handler = new CoverageStreamHandler( output, error ); | |||||
| Execute exec = new Execute( handler ); | Execute exec = new Execute( handler ); | ||||
| getLogger().debug( cmdl.toString() ); | getLogger().debug( cmdl.toString() ); | ||||
| exec.setCommandline( cmdl.getCommandline() ); | exec.setCommandline( cmdl.getCommandline() ); | ||||
| @@ -383,9 +386,7 @@ public class Coverage extends Task | |||||
| params.add( args[ i ] ); | params.add( args[ i ] ); | ||||
| } | } | ||||
| String[] array = new String[ params.size() ]; | |||||
| params.copyInto( array ); | |||||
| return array; | |||||
| return (String[])params.toArray( new String[ params.size() ] ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -540,11 +541,12 @@ public class Coverage extends Task | |||||
| /** | /** | ||||
| * specific pumper to avoid those nasty stdin issues | * specific pumper to avoid those nasty stdin issues | ||||
| */ | */ | ||||
| static class CoverageStreamHandler extends LogStreamHandler | |||||
| static class CoverageStreamHandler | |||||
| extends LogStreamHandler | |||||
| { | { | ||||
| CoverageStreamHandler( Task task ) | |||||
| CoverageStreamHandler( OutputStream output, OutputStream error ) | |||||
| { | { | ||||
| super( task, Project.MSG_INFO, Project.MSG_WARN ); | |||||
| super( output, error ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -206,8 +206,8 @@ public abstract class MSVSS extends Task | |||||
| try | try | ||||
| { | { | ||||
| final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
| exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) ); | |||||
| exe.setError( new LogOutputStream( this, Project.MSG_WARN ) ); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| // If location of ss.ini is specified we need to set the | // If location of ss.ini is specified we need to set the | ||||
| // environment-variable SSDIR to this value | // environment-variable SSDIR to this value | ||||
| @@ -32,7 +32,8 @@ public class SunRmic extends DefaultRmicAdapter | |||||
| // Create an instance of the rmic, redirecting output to | // Create an instance of the rmic, redirecting output to | ||||
| // the project log | // the project log | ||||
| LogOutputStream logstr = new LogOutputStream( getRmic(), Project.MSG_WARN ); | |||||
| LogOutputStream logstr = | |||||
| new LogOutputStream( getRmic().hackGetLogger(), true ); | |||||
| try | try | ||||
| { | { | ||||
| @@ -146,8 +146,8 @@ public class Rpm extends Task | |||||
| if( error == null && output == null ) | if( error == null && output == null ) | ||||
| { | { | ||||
| outputstream = new LogOutputStream( this, Project.MSG_INFO ); | |||||
| errorstream = new LogOutputStream( this, Project.MSG_WARN ); | |||||
| outputstream = new LogOutputStream( getLogger(), false ); | |||||
| errorstream = new LogOutputStream( getLogger(), true ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -164,7 +164,7 @@ public class Rpm extends Task | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| outputstream = new LogOutputStream( this, Project.MSG_INFO ); | |||||
| outputstream = new LogOutputStream( getLogger(), false ); | |||||
| } | } | ||||
| if( error != null ) | if( error != null ) | ||||
| { | { | ||||
| @@ -179,7 +179,7 @@ public class Rpm extends Task | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| errorstream = new LogOutputStream( this, Project.MSG_WARN ); | |||||
| errorstream = new LogOutputStream( getLogger(), true ); | |||||
| } | } | ||||
| } | } | ||||