Browse Source

Set the output streams to Execute via setters not via constructor

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270359 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
33c937a716
40 changed files with 244 additions and 236 deletions
  1. +10
    -8
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
  2. +3
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  3. +4
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Patch.java
  4. +4
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  5. +5
    -2
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
  6. +4
    -2
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java
  7. +5
    -4
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
  8. +7
    -6
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  9. +9
    -8
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
  10. +13
    -34
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  11. +7
    -7
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
  12. +10
    -6
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java
  13. +6
    -5
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java
  14. +3
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java
  15. +10
    -8
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
  16. +6
    -4
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
  17. +6
    -4
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
  18. +0
    -2
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
  19. +4
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
  20. +6
    -5
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Rpm.java
  21. +10
    -8
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java
  22. +3
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javadoc.java
  23. +4
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Patch.java
  24. +4
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  25. +5
    -2
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java
  26. +4
    -2
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java
  27. +5
    -4
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
  28. +7
    -6
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  29. +9
    -8
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
  30. +13
    -34
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  31. +7
    -7
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
  32. +10
    -6
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java
  33. +6
    -5
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java
  34. +3
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java
  35. +10
    -8
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
  36. +6
    -4
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
  37. +6
    -4
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
  38. +0
    -2
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
  39. +4
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
  40. +6
    -5
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Rpm.java

+ 10
- 8
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java View File

@@ -16,15 +16,13 @@ import org.apache.myrmidon.api.TaskException;
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.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.tools.ant.taskdefs.exec.LogStreamHandler;
import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
import org.apache.tools.ant.taskdefs.exec.PumpStreamHandler; import org.apache.tools.ant.taskdefs.exec.PumpStreamHandler;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.EnvironmentData;
import org.apache.tools.ant.types.EnvironmentVariable;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.types.EnvironmentVariable;
import org.apache.tools.ant.types.Argument;


/** /**
* This task acts as a loader for java applications but allows to use the same * This task acts as a loader for java applications but allows to use the same
@@ -377,13 +375,17 @@ public class Java extends Task
Execute exe = null; Execute exe = null;
if( out == null ) if( out == null )
{ {
exe = new Execute( new LogStreamHandler( this, Project.MSG_INFO,
Project.MSG_WARN ) );
exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );

} }
else else
{ {
fos = new FileOutputStream( out ); fos = new FileOutputStream( out );
exe = new Execute( new PumpStreamHandler( fos ) );
exe = new Execute();
exe.setOutput( fos );
exe.setError( fos );
} }


if( dir == null ) if( dir == null )


+ 3
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -916,7 +916,9 @@ public class Javadoc extends Task


JavadocOutputStream out = new JavadocOutputStream( Project.MSG_INFO ); JavadocOutputStream out = new JavadocOutputStream( Project.MSG_INFO );
JavadocOutputStream err = new JavadocOutputStream( Project.MSG_WARN ); JavadocOutputStream err = new JavadocOutputStream( Project.MSG_WARN );
Execute exe = new Execute( new PumpStreamHandler( out, err ) );
Execute exe = new Execute();
exe.setOutput( out );
exe.setError( err );


/* /*
* No reason to change the working directory as all filenames and * No reason to change the working directory as all filenames and


+ 4
- 3
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Patch.java View File

@@ -13,7 +13,7 @@ import org.apache.myrmidon.api.TaskException;
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.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
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;


/** /**
@@ -142,8 +142,9 @@ public class Patch extends Task
toExecute.createArgument().setFile( originalFile ); toExecute.createArgument().setFile( originalFile );
} }


Execute exe = new Execute( new LogStreamHandler( this, Project.MSG_INFO,
Project.MSG_WARN ) );
Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );
exe.setCommandline( toExecute.getCommandline() ); exe.setCommandline( toExecute.getCommandline() );
try try
{ {


+ 4
- 3
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java View File

@@ -16,6 +16,7 @@ import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.taskdefs.Javac;
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.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;


@@ -434,9 +435,9 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter


try try
{ {
Execute exe = new Execute( new LogStreamHandler( attributes,
Project.MSG_INFO,
Project.MSG_WARN ) );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( attributes, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( attributes, Project.MSG_WARN ) );
exe.setWorkingDirectory( project.getBaseDir() ); exe.setWorkingDirectory( project.getBaseDir() );
exe.setCommandline( commandArray ); exe.setCommandline( commandArray );
return exe.execute(); return exe.execute();


+ 5
- 2
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java View File

@@ -18,6 +18,7 @@ import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.ExecuteJava; import org.apache.tools.ant.taskdefs.ExecuteJava;
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.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
@@ -228,8 +229,10 @@ public class ANTLR extends Task
private int run( String[] command ) private int run( String[] command )
throws TaskException throws TaskException
{ {
Execute exe = new Execute( new LogStreamHandler( this, Project.MSG_INFO,
Project.MSG_WARN ) );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );

if( workingdir != null ) if( workingdir != null )
{ {
exe.setWorkingDirectory( workingdir ); exe.setWorkingDirectory( workingdir );


+ 4
- 2
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java View File

@@ -13,6 +13,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.Commandline; import org.apache.tools.ant.types.Commandline;


/** /**
@@ -108,8 +109,9 @@ public abstract class ClearCase extends Task
{ {
try try
{ {
Project aProj = getProject();
Execute exe = new Execute( new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN ) );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );
exe.setWorkingDirectory( getBaseDirectory() ); exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd.getCommandline() ); exe.setCommandline( cmd.getCommandline() );
return exe.execute(); return exe.execute();


+ 5
- 4
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java View File

@@ -15,6 +15,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;


/** /**
@@ -201,9 +202,9 @@ 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();
ExecuteStreamHandler handler = new LogStreamHandler( _owner,
Project.MSG_INFO, Project.MSG_WARN );
_exe = new Execute( handler );
_exe = new Execute();
_exe.setOutput( new LogOutputStream( _owner, Project.MSG_INFO ) );
_exe.setError( new LogOutputStream( _owner, Project.MSG_WARN ) );
_exe.setWorkingDirectory( dir ); _exe.setWorkingDirectory( dir );
} }
}//class
}

+ 7
- 6
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java View File

@@ -16,6 +16,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.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
@@ -185,16 +186,16 @@ public class JJTree extends Task
arg.setValue( "-mx140M" ); arg.setValue( "-mx140M" );
arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() );


final Execute process =
new Execute( new LogStreamHandler( this,
Project.MSG_INFO,
Project.MSG_INFO ) );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_INFO ) );
log( cmdl.toString(), Project.MSG_VERBOSE ); log( cmdl.toString(), Project.MSG_VERBOSE );
process.setCommandline( cmdl.getCommandline() );
exe.setCommandline( cmdl.getCommandline() );


try try
{ {
if( process.execute() != 0 )
if( exe.execute() != 0 )
{ {
throw new TaskException( "JJTree failed." ); throw new TaskException( "JJTree failed." );
} }


+ 9
- 8
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java View File

@@ -16,14 +16,13 @@ import org.apache.tools.ant.PathTokenizer;
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.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.myrmidon.framework.exec.ExecuteWatchdog;
import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; import org.apache.tools.ant.taskdefs.exec.LogStreamHandler;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.types.Argument;


/** /**
* Ant task to run JDepend tests. <p> * Ant task to run JDepend tests. <p>
@@ -329,12 +328,14 @@ public class JDependTask extends Task
commandline.createArgument().setValue( f.getPath() ); commandline.createArgument().setValue( f.getPath() );
} }


Execute execute =
new Execute( new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN ) );
execute.setCommandline( commandline.getCommandline() );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );

exe.setCommandline( commandline.getCommandline() );
if( getDir() != null ) if( getDir() != null )
{ {
execute.setWorkingDirectory( getDir() );
exe.setWorkingDirectory( getDir() );
} }


if( getOutputFile() != null ) if( getOutputFile() != null )
@@ -342,7 +343,7 @@ public class JDependTask extends Task
log( "Executing: " + commandline.toString(), Project.MSG_VERBOSE ); log( "Executing: " + commandline.toString(), Project.MSG_VERBOSE );
try try
{ {
return execute.execute();
return exe.execute();
} }
catch( IOException e ) catch( IOException e )
{ {


+ 13
- 34
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -13,26 +13,23 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Iterator; import java.util.Iterator;
import java.util.Properties; import java.util.Properties;
import java.util.Random; import java.util.Random;
import java.util.Enumeration;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.AntClassLoader;
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.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.myrmidon.framework.exec.ExecuteWatchdog;
import org.apache.tools.ant.taskdefs.exec.LogOutputStream; 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.Commandline;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.EnvironmentData;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.EnvironmentVariable; import org.apache.tools.ant.types.EnvironmentVariable;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Path;


/** /**
* Ant task to run JUnit tests. <p> * Ant task to run JUnit tests. <p>
@@ -496,22 +493,7 @@ public class JUnitTask extends Task
protected Iterator allTests() protected Iterator allTests()
{ {
Iterator[] enums = {tests.iterator(), batchTests.iterator()}; Iterator[] enums = {tests.iterator(), batchTests.iterator()};
return Iterators.fromCompound( enums );
}

/**
* @return <tt>null</tt> if there is a timeout value, otherwise the watchdog
* instance.
* @exception TaskException Description of Exception
*/
protected ExecuteWatchdog createWatchdog()
throws TaskException
{
if( timeout == null )
{
return null;
}
return new ExecuteWatchdog( timeout.intValue() );
return Iterator.fromCompound( enums );
} }


/** /**
@@ -544,13 +526,7 @@ public class JUnitTask extends Task
} }
else else
{ {
ExecuteWatchdog watchdog = createWatchdog();
exitValue = executeAsForked( test, watchdog );
// null watchdog means no timeout, you'd better not check with null
if( watchdog != null )
{
wasKilled = watchdog.killedProcess();
}
exitValue = executeAsForked( test );
} }


// if there is an error/failure and that it should halt, stop everything otherwise // if there is an error/failure and that it should halt, stop everything otherwise
@@ -622,7 +598,7 @@ public class JUnitTask extends Task
* @return Description of the Returned Value * @return Description of the Returned Value
* @exception TaskException Description of Exception * @exception TaskException Description of Exception
*/ */
private int executeAsForked( JUnitTest test, ExecuteWatchdog watchdog )
private int executeAsForked( JUnitTest test )
throws TaskException throws TaskException
{ {
CommandlineJava cmd = (CommandlineJava)commandline.clone(); CommandlineJava cmd = (CommandlineJava)commandline.clone();
@@ -676,18 +652,21 @@ public class JUnitTask extends Task
throw new TaskException( "Error creating temporary properties file.", ioe ); throw new TaskException( "Error creating temporary properties file.", ioe );
} }


final Execute execute = new Execute( new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN ), watchdog );
execute.setCommandline( cmd.getCommandline() );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );

exe.setCommandline( cmd.getCommandline() );
if( dir != null ) if( dir != null )
{ {
execute.setWorkingDirectory( dir );
exe.setWorkingDirectory( dir );
} }


log( "Executing: " + cmd.toString(), Project.MSG_VERBOSE ); log( "Executing: " + cmd.toString(), Project.MSG_VERBOSE );
int retVal; int retVal;
try try
{ {
retVal = execute.execute();
retVal = exe.execute();
} }
catch( IOException e ) catch( IOException e )
{ {


+ 7
- 7
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java View File

@@ -200,8 +200,7 @@ public abstract class AbstractMetamataTask extends Task
try try
{ {
setUp(); setUp();
ExecuteStreamHandler handler = createStreamHandler();
execute0( handler );
execute0();
} }
finally finally
{ {
@@ -304,7 +303,7 @@ public abstract class AbstractMetamataTask extends Task
* *
* @return Description of the Returned Value * @return Description of the Returned Value
*/ */
protected abstract ExecuteStreamHandler createStreamHandler();
protected abstract void setupStreamHandler( Execute exe );


/** /**
* execute the process with a specific handler * execute the process with a specific handler
@@ -312,15 +311,16 @@ public abstract class AbstractMetamataTask extends Task
* @param handler Description of Parameter * @param handler Description of Parameter
* @exception TaskException Description of Exception * @exception TaskException Description of Exception
*/ */
protected void execute0( ExecuteStreamHandler handler )
protected void execute0()
throws TaskException throws TaskException
{ {
final Execute process = new Execute( handler );
final Execute exe = new Execute();
setupStreamHandler( exe );
log( cmdl.toString(), Project.MSG_VERBOSE ); log( cmdl.toString(), Project.MSG_VERBOSE );
process.setCommandline( cmdl.getCommandline() );
exe.setCommandline( cmdl.getCommandline() );
try try
{ {
if( process.execute() != 0 )
if( exe.execute() != 0 )
{ {
throw new TaskException( "Metamata task failed." ); throw new TaskException( "Metamata task failed." );
} }


+ 10
- 6
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java View File

@@ -16,6 +16,8 @@ import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
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.Execute;
import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;


/** /**
@@ -186,7 +188,7 @@ public class MAudit extends AbstractMetamataTask
options.add( "-unused" ); options.add( "-unused" );
options.add( searchPath.toString() ); options.add( searchPath.toString() );
} }
addAllArrayList( options, includedFiles.keys() );
addAllArrayList( options, includedFiles.keySet().iterator() );
return options; return options;
} }


@@ -220,14 +222,14 @@ public class MAudit extends AbstractMetamataTask
*/ */
} }


protected ExecuteStreamHandler createStreamHandler()
protected void setupStreamHandler( final Execute exe )
throws TaskException throws TaskException
{ {
ExecuteStreamHandler handler = null;
// 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 )
{ {
handler = new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_INFO );
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );
} }
else else
{ {
@@ -235,14 +237,16 @@ public class MAudit extends AbstractMetamataTask
{ {
//XXX //XXX
OutputStream out = new FileOutputStream( outFile ); OutputStream out = new FileOutputStream( outFile );
handler = new MAuditStreamHandler( this, out );
//handler = new MAuditStreamHandler( this, out );
//FIXME: should behave like in Ant1.x
exe.setOutput( out );
exe.setError( out );
} }
catch( IOException e ) catch( IOException e )
{ {
throw new TaskException( "Error", e ); throw new TaskException( "Error", e );
} }
} }
return handler;
} }


/** /**


+ 6
- 5
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java View File

@@ -16,6 +16,8 @@ import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
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.taskdefs.exec.Execute;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;


/** /**
@@ -161,7 +163,7 @@ public class MMetrics extends AbstractMetamataTask
options.add( dirs[ i ] ); options.add( dirs[ i ] );
} }
// files next. // files next.
addAllArrayList( options, includedFiles.keys() );
addAllArrayList( options, includedFiles.keySet().iterator() );
return options; return options;
} }


@@ -223,11 +225,10 @@ public class MMetrics extends AbstractMetamataTask
* *
* @return Description of the Returned Value * @return Description of the Returned Value
*/ */
protected ExecuteStreamHandler createStreamHandler()
protected void setupStreamHandler( final Execute exe )
{ {
// write the report directtly to an XML stream
// return new MMetricsStreamHandler(this, xmlStream);
return new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_INFO );
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_INFO ) );
} }


protected void execute0( ExecuteStreamHandler handler ) protected void execute0( ExecuteStreamHandler handler )


+ 3
- 3
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java View File

@@ -10,10 +10,10 @@ package org.apache.tools.ant.taskdefs.optional.perforce;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;


public class SimpleP4OutputHandler extends P4HandlerAdapter
public class SimpleP4OutputHandler
extends P4HandlerAdapter
{ {

P4Base parent;
private P4Base parent;


public SimpleP4OutputHandler( P4Base parent ) public SimpleP4OutputHandler( P4Base parent )
{ {


+ 10
- 8
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java View File

@@ -15,6 +15,7 @@ import java.io.FileOutputStream;
import java.io.FileReader; import java.io.FileReader;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
@@ -23,10 +24,7 @@ import java.util.Random;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
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.LogOutputStream; import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
import org.apache.tools.ant.taskdefs.exec.LogStreamHandler;
import org.apache.tools.ant.taskdefs.exec.PumpStreamHandler;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;


/** /**
@@ -367,7 +365,7 @@ 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" );
log( "Executing " + commandLine.toString(), Project.MSG_VERBOSE ); log( "Executing " + commandLine.toString(), Project.MSG_VERBOSE );
result = runCmd( commandLine, new PumpStreamHandler( new FileOutputStream( tmp ), new LogOutputStream( this, Project.MSG_WARN ) ) );
result = runCmd( commandLine, new FileOutputStream( tmp ), new LogOutputStream( this, Project.MSG_WARN ) );
if( result != 0 && !ignorerc ) if( result != 0 && !ignorerc )
{ {
String msg = "Failed executing: " + commandLine.toString(); String msg = "Failed executing: " + commandLine.toString();
@@ -409,7 +407,10 @@ public class Pvcs extends org.apache.tools.ant.Task
commandLine.createArgument().setValue( "@" + tmp2.getAbsolutePath() ); commandLine.createArgument().setValue( "@" + tmp2.getAbsolutePath() );
log( "Getting files", Project.MSG_INFO ); log( "Getting files", Project.MSG_INFO );
log( "Executing " + commandLine.toString(), Project.MSG_VERBOSE ); log( "Executing " + commandLine.toString(), Project.MSG_VERBOSE );
result = runCmd( commandLine, new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN ) );
final LogOutputStream output = new LogOutputStream( this, Project.MSG_INFO );
final LogOutputStream error = new LogOutputStream( this, Project.MSG_WARN );
result = runCmd( commandLine, output, error );

if( result != 0 && !ignorerc ) if( result != 0 && !ignorerc )
{ {
String msg = "Failed executing: " + commandLine.toString() + ". Return code was " + result; String msg = "Failed executing: " + commandLine.toString() + ". Return code was " + result;
@@ -445,13 +446,14 @@ public class Pvcs extends org.apache.tools.ant.Task
} }
} }


protected int runCmd( Commandline cmd, ExecuteStreamHandler out )
protected int runCmd( Commandline cmd, OutputStream output, OutputStream error )
throws TaskException throws TaskException
{ {
try try
{ {
Project aProj = getProject();
Execute exe = new Execute( out );
final Execute exe = new Execute();
exe.setOutput( output );
exe.setError( error );
exe.setWorkingDirectory( getBaseDirectory() ); exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd.getCommandline() ); exe.setCommandline( cmd.getCommandline() );
return exe.execute(); return exe.execute();


+ 6
- 4
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java View File

@@ -19,6 +19,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.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;


@@ -115,14 +116,15 @@ public class CovMerge extends Task
} }
cmdl.createArgument().setValue( "-jp_paramfile=" + paramfile.getAbsolutePath() ); cmdl.createArgument().setValue( "-jp_paramfile=" + paramfile.getAbsolutePath() );


LogStreamHandler handler = new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN );
Execute exec = new Execute( handler );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );
log( cmdl.toString(), Project.MSG_VERBOSE ); log( cmdl.toString(), Project.MSG_VERBOSE );
exec.setCommandline( cmdl.getCommandline() );
exe.setCommandline( cmdl.getCommandline() );


// JProbe process always return 0 so we will not be // JProbe process always return 0 so we will not be
// able to check for failure ! :-( // able to check for failure ! :-(
int exitValue = exec.execute();
int exitValue = exe.execute();
if( exitValue != 0 ) if( exitValue != 0 )
{ {
throw new TaskException( "JProbe Coverage Merging failed (" + exitValue + ")" ); throw new TaskException( "JProbe Coverage Merging failed (" + exitValue + ")" );


+ 6
- 4
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java View File

@@ -22,6 +22,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.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
@@ -242,11 +243,12 @@ public class CovReport extends Task
} }


// use the custom handler for stdin issues // use the custom handler for stdin issues
LogStreamHandler handler = new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN );
Execute exec = new Execute( handler );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );
log( cmdl.toString(), Project.MSG_VERBOSE ); log( cmdl.toString(), Project.MSG_VERBOSE );
exec.setCommandline( cmdl.getCommandline() );
int exitValue = exec.execute();
exe.setCommandline( cmdl.getCommandline() );
int exitValue = exe.execute();
if( exitValue != 0 ) if( exitValue != 0 )
{ {
throw new TaskException( "JProbe Coverage Report failed (" + exitValue + ")" ); throw new TaskException( "JProbe Coverage Report failed (" + exitValue + ")" );


+ 0
- 2
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java View File

@@ -539,8 +539,6 @@ public class Coverage extends Task


/** /**
* specific pumper to avoid those nasty stdin issues * specific pumper to avoid those nasty stdin issues
*
* @author RT
*/ */
static class CoverageStreamHandler extends LogStreamHandler static class CoverageStreamHandler extends LogStreamHandler
{ {


+ 4
- 3
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java View File

@@ -15,6 +15,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.Commandline; import org.apache.tools.ant.types.Commandline;


/** /**
@@ -206,9 +207,9 @@ public abstract class MSVSS extends Task
{ {
try try
{ {
Execute exe = new Execute( new LogStreamHandler( this,
Project.MSG_INFO,
Project.MSG_WARN ) );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );


// 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


+ 6
- 5
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Rpm.java View File

@@ -144,13 +144,13 @@ public class Rpm extends Task


toExecute.createArgument().setValue( "SPECS/" + specFile ); toExecute.createArgument().setValue( "SPECS/" + specFile );


ExecuteStreamHandler streamhandler = null;
OutputStream outputstream = null; OutputStream outputstream = null;
OutputStream errorstream = null; OutputStream errorstream = null;

if( error == null && output == null ) if( error == null && output == null )
{ {
streamhandler = new LogStreamHandler( this, Project.MSG_INFO,
Project.MSG_WARN );
outputstream = new LogOutputStream( this, Project.MSG_INFO );
errorstream = new LogOutputStream( this, Project.MSG_WARN );
} }
else else
{ {
@@ -184,10 +184,11 @@ public class Rpm extends Task
{ {
errorstream = new LogOutputStream( this, Project.MSG_WARN ); errorstream = new LogOutputStream( this, Project.MSG_WARN );
} }
streamhandler = new PumpStreamHandler( outputstream, errorstream );
} }


Execute exe = new Execute( streamhandler );
Execute exe = new Execute();
exe.setOutput( outputstream );
exe.setError( errorstream );


if( topDir == null ) topDir = getBaseDirectory(); if( topDir == null ) topDir = getBaseDirectory();
exe.setWorkingDirectory( topDir ); exe.setWorkingDirectory( topDir );


+ 10
- 8
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java View File

@@ -16,15 +16,13 @@ import org.apache.myrmidon.api.TaskException;
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.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.tools.ant.taskdefs.exec.LogStreamHandler;
import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
import org.apache.tools.ant.taskdefs.exec.PumpStreamHandler; import org.apache.tools.ant.taskdefs.exec.PumpStreamHandler;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.EnvironmentData;
import org.apache.tools.ant.types.EnvironmentVariable;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.types.EnvironmentVariable;
import org.apache.tools.ant.types.Argument;


/** /**
* This task acts as a loader for java applications but allows to use the same * This task acts as a loader for java applications but allows to use the same
@@ -377,13 +375,17 @@ public class Java extends Task
Execute exe = null; Execute exe = null;
if( out == null ) if( out == null )
{ {
exe = new Execute( new LogStreamHandler( this, Project.MSG_INFO,
Project.MSG_WARN ) );
exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );

} }
else else
{ {
fos = new FileOutputStream( out ); fos = new FileOutputStream( out );
exe = new Execute( new PumpStreamHandler( fos ) );
exe = new Execute();
exe.setOutput( fos );
exe.setError( fos );
} }


if( dir == null ) if( dir == null )


+ 3
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -916,7 +916,9 @@ public class Javadoc extends Task


JavadocOutputStream out = new JavadocOutputStream( Project.MSG_INFO ); JavadocOutputStream out = new JavadocOutputStream( Project.MSG_INFO );
JavadocOutputStream err = new JavadocOutputStream( Project.MSG_WARN ); JavadocOutputStream err = new JavadocOutputStream( Project.MSG_WARN );
Execute exe = new Execute( new PumpStreamHandler( out, err ) );
Execute exe = new Execute();
exe.setOutput( out );
exe.setError( err );


/* /*
* No reason to change the working directory as all filenames and * No reason to change the working directory as all filenames and


+ 4
- 3
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Patch.java View File

@@ -13,7 +13,7 @@ import org.apache.myrmidon.api.TaskException;
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.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
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;


/** /**
@@ -142,8 +142,9 @@ public class Patch extends Task
toExecute.createArgument().setFile( originalFile ); toExecute.createArgument().setFile( originalFile );
} }


Execute exe = new Execute( new LogStreamHandler( this, Project.MSG_INFO,
Project.MSG_WARN ) );
Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );
exe.setCommandline( toExecute.getCommandline() ); exe.setCommandline( toExecute.getCommandline() );
try try
{ {


+ 4
- 3
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java View File

@@ -16,6 +16,7 @@ import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.taskdefs.Javac;
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.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;


@@ -434,9 +435,9 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter


try try
{ {
Execute exe = new Execute( new LogStreamHandler( attributes,
Project.MSG_INFO,
Project.MSG_WARN ) );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( attributes, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( attributes, Project.MSG_WARN ) );
exe.setWorkingDirectory( project.getBaseDir() ); exe.setWorkingDirectory( project.getBaseDir() );
exe.setCommandline( commandArray ); exe.setCommandline( commandArray );
return exe.execute(); return exe.execute();


+ 5
- 2
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java View File

@@ -18,6 +18,7 @@ import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.ExecuteJava; import org.apache.tools.ant.taskdefs.ExecuteJava;
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.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
@@ -228,8 +229,10 @@ public class ANTLR extends Task
private int run( String[] command ) private int run( String[] command )
throws TaskException throws TaskException
{ {
Execute exe = new Execute( new LogStreamHandler( this, Project.MSG_INFO,
Project.MSG_WARN ) );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );

if( workingdir != null ) if( workingdir != null )
{ {
exe.setWorkingDirectory( workingdir ); exe.setWorkingDirectory( workingdir );


+ 4
- 2
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java View File

@@ -13,6 +13,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.Commandline; import org.apache.tools.ant.types.Commandline;


/** /**
@@ -108,8 +109,9 @@ public abstract class ClearCase extends Task
{ {
try try
{ {
Project aProj = getProject();
Execute exe = new Execute( new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN ) );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );
exe.setWorkingDirectory( getBaseDirectory() ); exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd.getCommandline() ); exe.setCommandline( cmd.getCommandline() );
return exe.execute(); return exe.execute();


+ 5
- 4
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java View File

@@ -15,6 +15,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;


/** /**
@@ -201,9 +202,9 @@ 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();
ExecuteStreamHandler handler = new LogStreamHandler( _owner,
Project.MSG_INFO, Project.MSG_WARN );
_exe = new Execute( handler );
_exe = new Execute();
_exe.setOutput( new LogOutputStream( _owner, Project.MSG_INFO ) );
_exe.setError( new LogOutputStream( _owner, Project.MSG_WARN ) );
_exe.setWorkingDirectory( dir ); _exe.setWorkingDirectory( dir );
} }
}//class
}

+ 7
- 6
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java View File

@@ -16,6 +16,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.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
@@ -185,16 +186,16 @@ public class JJTree extends Task
arg.setValue( "-mx140M" ); arg.setValue( "-mx140M" );
arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() );


final Execute process =
new Execute( new LogStreamHandler( this,
Project.MSG_INFO,
Project.MSG_INFO ) );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_INFO ) );
log( cmdl.toString(), Project.MSG_VERBOSE ); log( cmdl.toString(), Project.MSG_VERBOSE );
process.setCommandline( cmdl.getCommandline() );
exe.setCommandline( cmdl.getCommandline() );


try try
{ {
if( process.execute() != 0 )
if( exe.execute() != 0 )
{ {
throw new TaskException( "JJTree failed." ); throw new TaskException( "JJTree failed." );
} }


+ 9
- 8
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java View File

@@ -16,14 +16,13 @@ import org.apache.tools.ant.PathTokenizer;
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.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.myrmidon.framework.exec.ExecuteWatchdog;
import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; import org.apache.tools.ant.taskdefs.exec.LogStreamHandler;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.types.Argument;


/** /**
* Ant task to run JDepend tests. <p> * Ant task to run JDepend tests. <p>
@@ -329,12 +328,14 @@ public class JDependTask extends Task
commandline.createArgument().setValue( f.getPath() ); commandline.createArgument().setValue( f.getPath() );
} }


Execute execute =
new Execute( new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN ) );
execute.setCommandline( commandline.getCommandline() );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );

exe.setCommandline( commandline.getCommandline() );
if( getDir() != null ) if( getDir() != null )
{ {
execute.setWorkingDirectory( getDir() );
exe.setWorkingDirectory( getDir() );
} }


if( getOutputFile() != null ) if( getOutputFile() != null )
@@ -342,7 +343,7 @@ public class JDependTask extends Task
log( "Executing: " + commandline.toString(), Project.MSG_VERBOSE ); log( "Executing: " + commandline.toString(), Project.MSG_VERBOSE );
try try
{ {
return execute.execute();
return exe.execute();
} }
catch( IOException e ) catch( IOException e )
{ {


+ 13
- 34
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -13,26 +13,23 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Iterator; import java.util.Iterator;
import java.util.Properties; import java.util.Properties;
import java.util.Random; import java.util.Random;
import java.util.Enumeration;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.AntClassLoader;
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.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.myrmidon.framework.exec.ExecuteWatchdog;
import org.apache.tools.ant.taskdefs.exec.LogOutputStream; 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.Commandline;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.EnvironmentData;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.EnvironmentVariable; import org.apache.tools.ant.types.EnvironmentVariable;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Path;


/** /**
* Ant task to run JUnit tests. <p> * Ant task to run JUnit tests. <p>
@@ -496,22 +493,7 @@ public class JUnitTask extends Task
protected Iterator allTests() protected Iterator allTests()
{ {
Iterator[] enums = {tests.iterator(), batchTests.iterator()}; Iterator[] enums = {tests.iterator(), batchTests.iterator()};
return Iterators.fromCompound( enums );
}

/**
* @return <tt>null</tt> if there is a timeout value, otherwise the watchdog
* instance.
* @exception TaskException Description of Exception
*/
protected ExecuteWatchdog createWatchdog()
throws TaskException
{
if( timeout == null )
{
return null;
}
return new ExecuteWatchdog( timeout.intValue() );
return Iterator.fromCompound( enums );
} }


/** /**
@@ -544,13 +526,7 @@ public class JUnitTask extends Task
} }
else else
{ {
ExecuteWatchdog watchdog = createWatchdog();
exitValue = executeAsForked( test, watchdog );
// null watchdog means no timeout, you'd better not check with null
if( watchdog != null )
{
wasKilled = watchdog.killedProcess();
}
exitValue = executeAsForked( test );
} }


// if there is an error/failure and that it should halt, stop everything otherwise // if there is an error/failure and that it should halt, stop everything otherwise
@@ -622,7 +598,7 @@ public class JUnitTask extends Task
* @return Description of the Returned Value * @return Description of the Returned Value
* @exception TaskException Description of Exception * @exception TaskException Description of Exception
*/ */
private int executeAsForked( JUnitTest test, ExecuteWatchdog watchdog )
private int executeAsForked( JUnitTest test )
throws TaskException throws TaskException
{ {
CommandlineJava cmd = (CommandlineJava)commandline.clone(); CommandlineJava cmd = (CommandlineJava)commandline.clone();
@@ -676,18 +652,21 @@ public class JUnitTask extends Task
throw new TaskException( "Error creating temporary properties file.", ioe ); throw new TaskException( "Error creating temporary properties file.", ioe );
} }


final Execute execute = new Execute( new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN ), watchdog );
execute.setCommandline( cmd.getCommandline() );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );

exe.setCommandline( cmd.getCommandline() );
if( dir != null ) if( dir != null )
{ {
execute.setWorkingDirectory( dir );
exe.setWorkingDirectory( dir );
} }


log( "Executing: " + cmd.toString(), Project.MSG_VERBOSE ); log( "Executing: " + cmd.toString(), Project.MSG_VERBOSE );
int retVal; int retVal;
try try
{ {
retVal = execute.execute();
retVal = exe.execute();
} }
catch( IOException e ) catch( IOException e )
{ {


+ 7
- 7
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java View File

@@ -200,8 +200,7 @@ public abstract class AbstractMetamataTask extends Task
try try
{ {
setUp(); setUp();
ExecuteStreamHandler handler = createStreamHandler();
execute0( handler );
execute0();
} }
finally finally
{ {
@@ -304,7 +303,7 @@ public abstract class AbstractMetamataTask extends Task
* *
* @return Description of the Returned Value * @return Description of the Returned Value
*/ */
protected abstract ExecuteStreamHandler createStreamHandler();
protected abstract void setupStreamHandler( Execute exe );


/** /**
* execute the process with a specific handler * execute the process with a specific handler
@@ -312,15 +311,16 @@ public abstract class AbstractMetamataTask extends Task
* @param handler Description of Parameter * @param handler Description of Parameter
* @exception TaskException Description of Exception * @exception TaskException Description of Exception
*/ */
protected void execute0( ExecuteStreamHandler handler )
protected void execute0()
throws TaskException throws TaskException
{ {
final Execute process = new Execute( handler );
final Execute exe = new Execute();
setupStreamHandler( exe );
log( cmdl.toString(), Project.MSG_VERBOSE ); log( cmdl.toString(), Project.MSG_VERBOSE );
process.setCommandline( cmdl.getCommandline() );
exe.setCommandline( cmdl.getCommandline() );
try try
{ {
if( process.execute() != 0 )
if( exe.execute() != 0 )
{ {
throw new TaskException( "Metamata task failed." ); throw new TaskException( "Metamata task failed." );
} }


+ 10
- 6
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java View File

@@ -16,6 +16,8 @@ import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
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.Execute;
import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;


/** /**
@@ -186,7 +188,7 @@ public class MAudit extends AbstractMetamataTask
options.add( "-unused" ); options.add( "-unused" );
options.add( searchPath.toString() ); options.add( searchPath.toString() );
} }
addAllArrayList( options, includedFiles.keys() );
addAllArrayList( options, includedFiles.keySet().iterator() );
return options; return options;
} }


@@ -220,14 +222,14 @@ public class MAudit extends AbstractMetamataTask
*/ */
} }


protected ExecuteStreamHandler createStreamHandler()
protected void setupStreamHandler( final Execute exe )
throws TaskException throws TaskException
{ {
ExecuteStreamHandler handler = null;
// 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 )
{ {
handler = new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_INFO );
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );
} }
else else
{ {
@@ -235,14 +237,16 @@ public class MAudit extends AbstractMetamataTask
{ {
//XXX //XXX
OutputStream out = new FileOutputStream( outFile ); OutputStream out = new FileOutputStream( outFile );
handler = new MAuditStreamHandler( this, out );
//handler = new MAuditStreamHandler( this, out );
//FIXME: should behave like in Ant1.x
exe.setOutput( out );
exe.setError( out );
} }
catch( IOException e ) catch( IOException e )
{ {
throw new TaskException( "Error", e ); throw new TaskException( "Error", e );
} }
} }
return handler;
} }


/** /**


+ 6
- 5
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java View File

@@ -16,6 +16,8 @@ import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
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.taskdefs.exec.Execute;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;


/** /**
@@ -161,7 +163,7 @@ public class MMetrics extends AbstractMetamataTask
options.add( dirs[ i ] ); options.add( dirs[ i ] );
} }
// files next. // files next.
addAllArrayList( options, includedFiles.keys() );
addAllArrayList( options, includedFiles.keySet().iterator() );
return options; return options;
} }


@@ -223,11 +225,10 @@ public class MMetrics extends AbstractMetamataTask
* *
* @return Description of the Returned Value * @return Description of the Returned Value
*/ */
protected ExecuteStreamHandler createStreamHandler()
protected void setupStreamHandler( final Execute exe )
{ {
// write the report directtly to an XML stream
// return new MMetricsStreamHandler(this, xmlStream);
return new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_INFO );
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_INFO ) );
} }


protected void execute0( ExecuteStreamHandler handler ) protected void execute0( ExecuteStreamHandler handler )


+ 3
- 3
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java View File

@@ -10,10 +10,10 @@ package org.apache.tools.ant.taskdefs.optional.perforce;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;


public class SimpleP4OutputHandler extends P4HandlerAdapter
public class SimpleP4OutputHandler
extends P4HandlerAdapter
{ {

P4Base parent;
private P4Base parent;


public SimpleP4OutputHandler( P4Base parent ) public SimpleP4OutputHandler( P4Base parent )
{ {


+ 10
- 8
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java View File

@@ -15,6 +15,7 @@ import java.io.FileOutputStream;
import java.io.FileReader; import java.io.FileReader;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
@@ -23,10 +24,7 @@ import java.util.Random;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
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.LogOutputStream; import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
import org.apache.tools.ant.taskdefs.exec.LogStreamHandler;
import org.apache.tools.ant.taskdefs.exec.PumpStreamHandler;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;


/** /**
@@ -367,7 +365,7 @@ 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" );
log( "Executing " + commandLine.toString(), Project.MSG_VERBOSE ); log( "Executing " + commandLine.toString(), Project.MSG_VERBOSE );
result = runCmd( commandLine, new PumpStreamHandler( new FileOutputStream( tmp ), new LogOutputStream( this, Project.MSG_WARN ) ) );
result = runCmd( commandLine, new FileOutputStream( tmp ), new LogOutputStream( this, Project.MSG_WARN ) );
if( result != 0 && !ignorerc ) if( result != 0 && !ignorerc )
{ {
String msg = "Failed executing: " + commandLine.toString(); String msg = "Failed executing: " + commandLine.toString();
@@ -409,7 +407,10 @@ public class Pvcs extends org.apache.tools.ant.Task
commandLine.createArgument().setValue( "@" + tmp2.getAbsolutePath() ); commandLine.createArgument().setValue( "@" + tmp2.getAbsolutePath() );
log( "Getting files", Project.MSG_INFO ); log( "Getting files", Project.MSG_INFO );
log( "Executing " + commandLine.toString(), Project.MSG_VERBOSE ); log( "Executing " + commandLine.toString(), Project.MSG_VERBOSE );
result = runCmd( commandLine, new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN ) );
final LogOutputStream output = new LogOutputStream( this, Project.MSG_INFO );
final LogOutputStream error = new LogOutputStream( this, Project.MSG_WARN );
result = runCmd( commandLine, output, error );

if( result != 0 && !ignorerc ) if( result != 0 && !ignorerc )
{ {
String msg = "Failed executing: " + commandLine.toString() + ". Return code was " + result; String msg = "Failed executing: " + commandLine.toString() + ". Return code was " + result;
@@ -445,13 +446,14 @@ public class Pvcs extends org.apache.tools.ant.Task
} }
} }


protected int runCmd( Commandline cmd, ExecuteStreamHandler out )
protected int runCmd( Commandline cmd, OutputStream output, OutputStream error )
throws TaskException throws TaskException
{ {
try try
{ {
Project aProj = getProject();
Execute exe = new Execute( out );
final Execute exe = new Execute();
exe.setOutput( output );
exe.setError( error );
exe.setWorkingDirectory( getBaseDirectory() ); exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd.getCommandline() ); exe.setCommandline( cmd.getCommandline() );
return exe.execute(); return exe.execute();


+ 6
- 4
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java View File

@@ -19,6 +19,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.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;


@@ -115,14 +116,15 @@ public class CovMerge extends Task
} }
cmdl.createArgument().setValue( "-jp_paramfile=" + paramfile.getAbsolutePath() ); cmdl.createArgument().setValue( "-jp_paramfile=" + paramfile.getAbsolutePath() );


LogStreamHandler handler = new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN );
Execute exec = new Execute( handler );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );
log( cmdl.toString(), Project.MSG_VERBOSE ); log( cmdl.toString(), Project.MSG_VERBOSE );
exec.setCommandline( cmdl.getCommandline() );
exe.setCommandline( cmdl.getCommandline() );


// JProbe process always return 0 so we will not be // JProbe process always return 0 so we will not be
// able to check for failure ! :-( // able to check for failure ! :-(
int exitValue = exec.execute();
int exitValue = exe.execute();
if( exitValue != 0 ) if( exitValue != 0 )
{ {
throw new TaskException( "JProbe Coverage Merging failed (" + exitValue + ")" ); throw new TaskException( "JProbe Coverage Merging failed (" + exitValue + ")" );


+ 6
- 4
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java View File

@@ -22,6 +22,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.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
@@ -242,11 +243,12 @@ public class CovReport extends Task
} }


// use the custom handler for stdin issues // use the custom handler for stdin issues
LogStreamHandler handler = new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN );
Execute exec = new Execute( handler );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );
log( cmdl.toString(), Project.MSG_VERBOSE ); log( cmdl.toString(), Project.MSG_VERBOSE );
exec.setCommandline( cmdl.getCommandline() );
int exitValue = exec.execute();
exe.setCommandline( cmdl.getCommandline() );
int exitValue = exe.execute();
if( exitValue != 0 ) if( exitValue != 0 )
{ {
throw new TaskException( "JProbe Coverage Report failed (" + exitValue + ")" ); throw new TaskException( "JProbe Coverage Report failed (" + exitValue + ")" );


+ 0
- 2
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java View File

@@ -539,8 +539,6 @@ public class Coverage extends Task


/** /**
* specific pumper to avoid those nasty stdin issues * specific pumper to avoid those nasty stdin issues
*
* @author RT
*/ */
static class CoverageStreamHandler extends LogStreamHandler static class CoverageStreamHandler extends LogStreamHandler
{ {


+ 4
- 3
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java View File

@@ -15,6 +15,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.Commandline; import org.apache.tools.ant.types.Commandline;


/** /**
@@ -206,9 +207,9 @@ public abstract class MSVSS extends Task
{ {
try try
{ {
Execute exe = new Execute( new LogStreamHandler( this,
Project.MSG_INFO,
Project.MSG_WARN ) );
final Execute exe = new Execute();
exe.setOutput( new LogOutputStream( this, Project.MSG_INFO ) );
exe.setError( new LogOutputStream( this, Project.MSG_WARN ) );


// 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


+ 6
- 5
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Rpm.java View File

@@ -144,13 +144,13 @@ public class Rpm extends Task


toExecute.createArgument().setValue( "SPECS/" + specFile ); toExecute.createArgument().setValue( "SPECS/" + specFile );


ExecuteStreamHandler streamhandler = null;
OutputStream outputstream = null; OutputStream outputstream = null;
OutputStream errorstream = null; OutputStream errorstream = null;

if( error == null && output == null ) if( error == null && output == null )
{ {
streamhandler = new LogStreamHandler( this, Project.MSG_INFO,
Project.MSG_WARN );
outputstream = new LogOutputStream( this, Project.MSG_INFO );
errorstream = new LogOutputStream( this, Project.MSG_WARN );
} }
else else
{ {
@@ -184,10 +184,11 @@ public class Rpm extends Task
{ {
errorstream = new LogOutputStream( this, Project.MSG_WARN ); errorstream = new LogOutputStream( this, Project.MSG_WARN );
} }
streamhandler = new PumpStreamHandler( outputstream, errorstream );
} }


Execute exe = new Execute( streamhandler );
Execute exe = new Execute();
exe.setOutput( outputstream );
exe.setError( errorstream );


if( topDir == null ) topDir = getBaseDirectory(); if( topDir == null ) topDir = getBaseDirectory();
exe.setWorkingDirectory( topDir ); exe.setWorkingDirectory( topDir );


Loading…
Cancel
Save