Cleaned up its code a little. ALso reworked it so that the user can specify an expectedReturnCode and if the value is not the one expected a TaskException is thrown. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271265 13f79535-47bb-0310-9956-ffa450edef68master
@@ -12,7 +12,7 @@ import java.io.IOException; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -101,7 +101,7 @@ public class Patch | |||
validate(); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
buildCommand( exe.getCommandline() ); | |||
@@ -13,7 +13,7 @@ import java.util.Properties; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.util.FileUtils; | |||
@@ -149,7 +149,7 @@ public class Cvs | |||
final Properties env = buildEnvironment(); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
if( m_dest == null ) | |||
{ | |||
m_dest = getBaseDirectory(); | |||
@@ -16,7 +16,7 @@ import org.apache.avalon.excalibur.i18n.ResourceManager; | |||
import org.apache.avalon.excalibur.i18n.Resources; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.EnvironmentData; | |||
@@ -111,12 +111,12 @@ public class Exec | |||
validate(); | |||
if( null == m_os || Os.isFamily( m_os ) ) | |||
{ | |||
final Execute2 exe = createExecute(); | |||
final Execute exe = createExecute(); | |||
doExecute( exe ); | |||
} | |||
} | |||
private void doExecute( final Execute2 exe ) | |||
private void doExecute( final Execute exe ) | |||
throws TaskException | |||
{ | |||
try | |||
@@ -165,7 +165,7 @@ public class Exec | |||
} | |||
} | |||
private Execute2 createExecute() | |||
private Execute createExecute() | |||
throws TaskException | |||
{ | |||
final Properties environment = m_env.getVariables(); | |||
@@ -173,7 +173,7 @@ public class Exec | |||
logExecDetails( environment ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setTimeout( m_timeout ); | |||
exe.setWorkingDirectory( m_dir ); | |||
exe.setNewenvironment( m_newEnvironment ); | |||
@@ -11,7 +11,7 @@ import java.io.IOException; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -122,7 +122,7 @@ public class GenerateKey | |||
final Commandline cmd = createCommand(); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setWorkingDirectory( getBaseDirectory() ); | |||
exe.setCommandline( cmd ); | |||
try | |||
@@ -16,7 +16,7 @@ import java.util.zip.ZipFile; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.types.FileSet; | |||
@@ -296,7 +296,7 @@ public class SignJar | |||
final Commandline cmd = buildCommand( jarTarget, jarSource ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setCommandline( cmd ); | |||
try | |||
{ | |||
@@ -5,7 +5,7 @@ | |||
* version 1.1, a copy of which has been included with this distribution in | |||
* the LICENSE.txt file. | |||
*/ | |||
package org.apache.tools.ant.taskdefs.exec; | |||
package org.apache.myrmidon.framework; | |||
import java.io.File; | |||
import java.io.IOException; | |||
@@ -18,11 +18,14 @@ import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
* Runs an external program. | |||
* This is a utility class designed to make executing native | |||
* processes easier in the context of ant. | |||
* | |||
* @author thomas.haas@softwired-inc.com | |||
* @author <a href="mailto:peter@apache.org">Peter Donald</a> | |||
* @author <a href="mailto:thomas.haas@softwired-inc.com">Thomas Haas</a> | |||
* @version $Revision$ $Date$ | |||
*/ | |||
public class Execute2 | |||
public class Execute | |||
{ | |||
private Commandline m_command; | |||
private Properties m_environment = new Properties(); | |||
@@ -31,8 +34,9 @@ public class Execute2 | |||
private ExecOutputHandler m_handler; | |||
private long m_timeout; | |||
private ExecManager m_execManager; | |||
private Integer m_returnCode; | |||
public Execute2( final ExecManager execManager ) | |||
public Execute( final ExecManager execManager ) | |||
{ | |||
m_execManager = execManager; | |||
} | |||
@@ -95,6 +99,11 @@ public class Execute2 | |||
m_workingDirectory = workingDirectory; | |||
} | |||
public void setReturnCode( final int returnCode ) | |||
{ | |||
m_returnCode = new Integer( returnCode ); | |||
} | |||
/** | |||
* Runs a process defined by the command line and returns its exit status. | |||
* | |||
@@ -103,10 +112,23 @@ public class Execute2 | |||
public int execute() | |||
throws IOException, TaskException | |||
{ | |||
try | |||
final int returnCode = executenativeProcess(); | |||
if( null != m_returnCode && | |||
returnCode != m_returnCode.intValue() ) | |||
{ | |||
final ExecMetaData metaData = buildExecMetaData(); | |||
throw new TaskException( "Unexpected return code " + returnCode ); | |||
} | |||
return returnCode; | |||
} | |||
private int executenativeProcess() | |||
throws TaskException | |||
{ | |||
final ExecMetaData metaData = buildExecMetaData(); | |||
try | |||
{ | |||
if( null != m_handler ) | |||
{ | |||
return m_execManager.execute( metaData, m_handler, m_timeout ); | |||
@@ -124,15 +146,23 @@ public class Execute2 | |||
{ | |||
throw new TaskException( ee.getMessage(), ee ); | |||
} | |||
catch( final IOException ioe ) | |||
{ | |||
throw new TaskException( ioe.getMessage(), ioe ); | |||
} | |||
} | |||
/** | |||
* Utility method to create an ExecMetaData object | |||
* to pass to the ExecManager service. | |||
*/ | |||
private ExecMetaData buildExecMetaData() | |||
{ | |||
final String[] command = m_command.getCommandline(); | |||
final ExecMetaData metaData = | |||
new ExecMetaData( command, m_environment, | |||
m_workingDirectory, m_newEnvironment ); | |||
return metaData; | |||
return new ExecMetaData( command, | |||
m_environment, | |||
m_workingDirectory, | |||
m_newEnvironment ); | |||
} | |||
} |
@@ -14,7 +14,7 @@ import java.util.ArrayList; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
@@ -219,7 +219,7 @@ public class Java | |||
throws TaskException | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
if( m_dir == null ) | |||
{ | |||
@@ -17,7 +17,7 @@ import org.apache.avalon.excalibur.util.StringUtil; | |||
import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.Javac; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.types.PathUtil; | |||
@@ -362,7 +362,7 @@ public abstract class DefaultCompilerAdapter | |||
try | |||
{ | |||
final ExecManager execManager = (ExecManager)m_attributes.getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setWorkingDirectory( m_baseDir ); | |||
final String[] commandline = commandArray; | |||
exe.setCommandline( new Commandline( commandline ) ); | |||
@@ -21,7 +21,7 @@ import org.apache.aut.nativelib.Os; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.framework.Pattern; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.types.FileSet; | |||
@@ -815,7 +815,7 @@ public class Javadoc | |||
getLogger().info( "Javadoc execution" ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setExecOutputHandler( this ); | |||
/* | |||
@@ -16,7 +16,7 @@ import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.ExecuteJava; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
@@ -228,7 +228,7 @@ public class ANTLR extends Task | |||
throws TaskException | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
if( workingdir != null ) | |||
{ | |||
exe.setWorkingDirectory( workingdir ); | |||
@@ -18,7 +18,7 @@ import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.aut.nativelib.Os; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.MatchingTask; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.types.FileSet; | |||
@@ -136,7 +136,7 @@ public class Cab | |||
{ | |||
File listFile = createListFile( files ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
Execute2 exe = new Execute2( execManager ); | |||
Execute exe = new Execute( execManager ); | |||
exe.setWorkingDirectory( m_baseDir ); | |||
final Commandline cmd = createCommand( listFile ); | |||
exe.setCommandline( cmd ); | |||
@@ -13,7 +13,7 @@ import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.aut.nativelib.ExecOutputHandler; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -113,7 +113,7 @@ public abstract class Continuus | |||
try | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
if( null != handler ) | |||
{ | |||
exe.setExecOutputHandler( handler ); | |||
@@ -12,7 +12,7 @@ import java.io.IOException; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -109,7 +109,7 @@ public abstract class ClearCase extends Task | |||
try | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setWorkingDirectory( getBaseDirectory() ); | |||
exe.setCommandline( cmd ); | |||
return exe.execute(); | |||
@@ -13,7 +13,7 @@ import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -44,7 +44,7 @@ public class NetCommand | |||
/** | |||
* executabe | |||
*/ | |||
protected Execute2 _exe; | |||
protected Execute _exe; | |||
/** | |||
* flag to control action on execution trouble | |||
@@ -201,7 +201,7 @@ public class NetCommand | |||
// default directory to the project's base directory | |||
File dir = _owner.getBaseDirectory(); | |||
final ExecManager execManager = (ExecManager)_owner.getService( ExecManager.class ); | |||
_exe = new Execute2( execManager ); | |||
_exe = new Execute( execManager ); | |||
_exe.setWorkingDirectory( dir ); | |||
} | |||
} |
@@ -19,7 +19,7 @@ import java.util.Iterator; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.Java; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
@@ -363,7 +363,7 @@ public class BorlandDeploymentTool | |||
private void buildBorlandStubs( Iterator ithomes, Hashtable files ) | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setWorkingDirectory( getTask().getBaseDirectory() ); | |||
final Commandline cmd = buildCommandline( ithomes ); | |||
@@ -11,7 +11,7 @@ import java.io.File; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
@@ -162,7 +162,7 @@ public class BorlandGenerateClient extends Task | |||
getLogger().debug( "Calling java2iiop" ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setWorkingDirectory( new File( "." ) ); | |||
exe.setCommandline( cmd ); | |||
exe.execute(); | |||
@@ -14,7 +14,7 @@ import java.util.Hashtable; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
import org.apache.tools.ant.types.Path; | |||
@@ -182,7 +182,7 @@ public class JJTree extends Task | |||
cmdl.addVmArgument( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
getLogger().debug( cmdl.toString() ); | |||
exe.setCommandline( new Commandline( cmdl.getCommandline() ) ); | |||
@@ -14,7 +14,7 @@ import java.util.Hashtable; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
import org.apache.tools.ant.types.Path; | |||
@@ -243,7 +243,7 @@ public class JavaCC extends Task | |||
{ | |||
getLogger().debug( cmdline.toString() ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
final String[] commandline = cmdline.getCommandline(); | |||
exe.setCommandline( new Commandline( commandline ) ); | |||
int retval = exe.execute(); | |||
@@ -14,7 +14,7 @@ import java.io.PrintWriter; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
import org.apache.tools.ant.types.Path; | |||
@@ -241,7 +241,7 @@ public class JDependTask | |||
} | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
final String[] commandline1 = commandline.getCommandline(); | |||
exe.setCommandline( new Commandline( commandline1 ) ); | |||
@@ -22,7 +22,7 @@ import java.util.Random; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
@@ -650,7 +650,7 @@ public class JUnitTask extends Task | |||
} | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setCommandline( new Commandline( cmd.getCommandline() ) ); | |||
if( dir != null ) | |||
{ | |||
@@ -18,7 +18,7 @@ import java.util.Random; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
@@ -280,7 +280,7 @@ public abstract class AbstractMetamataTask | |||
throws TaskException | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
getLogger().debug( m_cmdl.toString() ); | |||
final String[] commandline = m_cmdl.getCommandline(); | |||
exe.setCommandline( new Commandline( commandline ) ); | |||
@@ -17,7 +17,7 @@ import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.avalon.excalibur.io.IOUtil; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
@@ -288,7 +288,7 @@ public class MParse | |||
} | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
getLogger().debug( m_cmdl.toString() ); | |||
final String[] commandline = m_cmdl.getCommandline(); | |||
exe.setCommandline( new Commandline( commandline ) ); | |||
@@ -12,7 +12,7 @@ import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.aut.nativelib.ExecOutputHandler; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.oro.text.perl.Perl5Util; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -167,7 +167,7 @@ public abstract class P4Base | |||
} | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setExecOutputHandler( handler ); | |||
exe.setCommandline( cmd ); | |||
@@ -24,7 +24,7 @@ import org.apache.aut.nativelib.ExecOutputHandler; | |||
import org.apache.avalon.excalibur.io.IOUtil; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -192,7 +192,7 @@ public class Pvcs | |||
try | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setWorkingDirectory( getBaseDirectory() ); | |||
exe.setCommandline( cmd ); | |||
result = exe.execute(); | |||
@@ -273,7 +273,7 @@ public class Pvcs | |||
final File fileList = File.createTempFile( "pvcs_ant_", ".log" ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setExecOutputHandler( this ); | |||
m_output = new FileOutputStream( tmp ); | |||
exe.setWorkingDirectory( getBaseDirectory() ); | |||
@@ -16,7 +16,7 @@ import java.util.Random; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.types.FileSet; | |||
@@ -116,7 +116,7 @@ public class CovMerge extends Task | |||
cmdl.addArgument( "-jp_paramfile=" + paramfile.getAbsolutePath() ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
getLogger().debug( cmdl.toString() ); | |||
exe.setCommandline( cmdl ); | |||
@@ -20,7 +20,7 @@ import javax.xml.transform.stream.StreamResult; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.EnumeratedAttribute; | |||
import org.apache.tools.ant.types.Path; | |||
@@ -248,7 +248,7 @@ public class CovReport extends Task | |||
// use the custom handler for stdin issues | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
getLogger().debug( cmdl.toString() ); | |||
exe.setCommandline( cmdl ); | |||
int exitValue = exe.execute(); | |||
@@ -16,7 +16,7 @@ import java.util.ArrayList; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
@@ -250,7 +250,7 @@ public class Coverage | |||
// use the custom handler for stdin issues | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
getLogger().debug( cmdl.toString() ); | |||
exe.setCommandline( cmdl ); | |||
int exitValue = exe.execute(); | |||
@@ -13,7 +13,7 @@ import java.util.Properties; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -206,7 +206,7 @@ public abstract class MSVSS extends Task | |||
try | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
// If location of ss.ini is specified we need to set the | |||
// environment-variable SSDIR to this value | |||
@@ -12,7 +12,7 @@ import java.io.IOException; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -91,7 +91,7 @@ public class Rpm | |||
{ | |||
final Commandline cmd = createCommand(); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
if( m_topDir == null ) | |||
{ | |||
@@ -14,7 +14,7 @@ import java.util.ArrayList; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
@@ -219,7 +219,7 @@ public class Java | |||
throws TaskException | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
if( m_dir == null ) | |||
{ | |||
@@ -17,7 +17,7 @@ import org.apache.avalon.excalibur.util.StringUtil; | |||
import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.Javac; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
import org.apache.tools.ant.types.PathUtil; | |||
@@ -362,7 +362,7 @@ public abstract class DefaultCompilerAdapter | |||
try | |||
{ | |||
final ExecManager execManager = (ExecManager)m_attributes.getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setWorkingDirectory( m_baseDir ); | |||
final String[] commandline = commandArray; | |||
exe.setCommandline( new Commandline( commandline ) ); | |||
@@ -1,138 +0,0 @@ | |||
/* | |||
* Copyright (C) The Apache Software Foundation. All rights reserved. | |||
* | |||
* This software is published under the terms of the Apache Software License | |||
* version 1.1, a copy of which has been included with this distribution in | |||
* the LICENSE.txt file. | |||
*/ | |||
package org.apache.tools.ant.taskdefs.exec; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import java.util.Properties; | |||
import org.apache.aut.nativelib.ExecException; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.aut.nativelib.ExecMetaData; | |||
import org.apache.aut.nativelib.ExecOutputHandler; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
* Runs an external program. | |||
* | |||
* @author thomas.haas@softwired-inc.com | |||
*/ | |||
public class Execute2 | |||
{ | |||
private Commandline m_command; | |||
private Properties m_environment = new Properties(); | |||
private File m_workingDirectory = new File( "." ); | |||
private boolean m_newEnvironment; | |||
private ExecOutputHandler m_handler; | |||
private long m_timeout; | |||
private ExecManager m_execManager; | |||
public Execute2( final ExecManager execManager ) | |||
{ | |||
m_execManager = execManager; | |||
} | |||
public void setTimeout( final long timeout ) | |||
{ | |||
m_timeout = timeout; | |||
} | |||
public void setExecOutputHandler( final ExecOutputHandler handler ) | |||
{ | |||
m_handler = handler; | |||
} | |||
/** | |||
* Sets the commandline of the subprocess to launch. | |||
* | |||
* @param command the commandline of the subprocess to launch | |||
*/ | |||
public void setCommandline( final Commandline command ) | |||
{ | |||
m_command = command; | |||
} | |||
public Commandline getCommandline() | |||
{ | |||
if( null == m_command ) | |||
{ | |||
m_command = new Commandline(); | |||
} | |||
return m_command; | |||
} | |||
public void setEnvironment( final Properties environment ) | |||
{ | |||
if( null == environment ) | |||
{ | |||
throw new NullPointerException( "environment" ); | |||
} | |||
m_environment = environment; | |||
} | |||
/** | |||
* Set whether to propagate the default environment or not. | |||
* | |||
* @param newEnvironment whether to propagate the process environment. | |||
*/ | |||
public void setNewenvironment( boolean newEnvironment ) | |||
{ | |||
m_newEnvironment = newEnvironment; | |||
} | |||
/** | |||
* Sets the working directory of the process to execute. <p> | |||
* | |||
* @param workingDirectory the working directory of the process. | |||
*/ | |||
public void setWorkingDirectory( final File workingDirectory ) | |||
{ | |||
m_workingDirectory = workingDirectory; | |||
} | |||
/** | |||
* Runs a process defined by the command line and returns its exit status. | |||
* | |||
* @return the exit status of the subprocess or <code>INVALID</code> | |||
*/ | |||
public int execute() | |||
throws IOException, TaskException | |||
{ | |||
try | |||
{ | |||
final ExecMetaData metaData = buildExecMetaData(); | |||
if( null != m_handler ) | |||
{ | |||
return m_execManager.execute( metaData, m_handler, m_timeout ); | |||
} | |||
else | |||
{ | |||
return m_execManager.execute( metaData, | |||
null, | |||
System.out, | |||
System.err, | |||
m_timeout ); | |||
} | |||
} | |||
catch( final ExecException ee ) | |||
{ | |||
throw new TaskException( ee.getMessage(), ee ); | |||
} | |||
} | |||
private ExecMetaData buildExecMetaData() | |||
{ | |||
final String[] command = m_command.getCommandline(); | |||
final ExecMetaData metaData = | |||
new ExecMetaData( command, m_environment, | |||
m_workingDirectory, m_newEnvironment ); | |||
return metaData; | |||
} | |||
} |
@@ -21,7 +21,7 @@ import org.apache.aut.nativelib.Os; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.framework.Pattern; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.types.FileSet; | |||
@@ -815,7 +815,7 @@ public class Javadoc | |||
getLogger().info( "Javadoc execution" ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setExecOutputHandler( this ); | |||
/* | |||
@@ -16,7 +16,7 @@ import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.ExecuteJava; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
@@ -228,7 +228,7 @@ public class ANTLR extends Task | |||
throws TaskException | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
if( workingdir != null ) | |||
{ | |||
exe.setWorkingDirectory( workingdir ); | |||
@@ -18,7 +18,7 @@ import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.aut.nativelib.Os; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.MatchingTask; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.types.FileSet; | |||
@@ -136,7 +136,7 @@ public class Cab | |||
{ | |||
File listFile = createListFile( files ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
Execute2 exe = new Execute2( execManager ); | |||
Execute exe = new Execute( execManager ); | |||
exe.setWorkingDirectory( m_baseDir ); | |||
final Commandline cmd = createCommand( listFile ); | |||
exe.setCommandline( cmd ); | |||
@@ -13,7 +13,7 @@ import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.aut.nativelib.ExecOutputHandler; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -113,7 +113,7 @@ public abstract class Continuus | |||
try | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
if( null != handler ) | |||
{ | |||
exe.setExecOutputHandler( handler ); | |||
@@ -12,7 +12,7 @@ import java.io.IOException; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -109,7 +109,7 @@ public abstract class ClearCase extends Task | |||
try | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setWorkingDirectory( getBaseDirectory() ); | |||
exe.setCommandline( cmd ); | |||
return exe.execute(); | |||
@@ -13,7 +13,7 @@ import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -44,7 +44,7 @@ public class NetCommand | |||
/** | |||
* executabe | |||
*/ | |||
protected Execute2 _exe; | |||
protected Execute _exe; | |||
/** | |||
* flag to control action on execution trouble | |||
@@ -201,7 +201,7 @@ public class NetCommand | |||
// default directory to the project's base directory | |||
File dir = _owner.getBaseDirectory(); | |||
final ExecManager execManager = (ExecManager)_owner.getService( ExecManager.class ); | |||
_exe = new Execute2( execManager ); | |||
_exe = new Execute( execManager ); | |||
_exe.setWorkingDirectory( dir ); | |||
} | |||
} |
@@ -19,7 +19,7 @@ import java.util.Iterator; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.Java; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
@@ -363,7 +363,7 @@ public class BorlandDeploymentTool | |||
private void buildBorlandStubs( Iterator ithomes, Hashtable files ) | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setWorkingDirectory( getTask().getBaseDirectory() ); | |||
final Commandline cmd = buildCommandline( ithomes ); | |||
@@ -11,7 +11,7 @@ import java.io.File; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.Path; | |||
@@ -162,7 +162,7 @@ public class BorlandGenerateClient extends Task | |||
getLogger().debug( "Calling java2iiop" ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setWorkingDirectory( new File( "." ) ); | |||
exe.setCommandline( cmd ); | |||
exe.execute(); | |||
@@ -14,7 +14,7 @@ import java.util.Hashtable; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
import org.apache.tools.ant.types.Path; | |||
@@ -182,7 +182,7 @@ public class JJTree extends Task | |||
cmdl.addVmArgument( "-Dinstall.root=" + javaccHome.getAbsolutePath() ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
getLogger().debug( cmdl.toString() ); | |||
exe.setCommandline( new Commandline( cmdl.getCommandline() ) ); | |||
@@ -14,7 +14,7 @@ import java.util.Hashtable; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
import org.apache.tools.ant.types.Path; | |||
@@ -243,7 +243,7 @@ public class JavaCC extends Task | |||
{ | |||
getLogger().debug( cmdline.toString() ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
final String[] commandline = cmdline.getCommandline(); | |||
exe.setCommandline( new Commandline( commandline ) ); | |||
int retval = exe.execute(); | |||
@@ -14,7 +14,7 @@ import java.io.PrintWriter; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
import org.apache.tools.ant.types.Path; | |||
@@ -241,7 +241,7 @@ public class JDependTask | |||
} | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
final String[] commandline1 = commandline.getCommandline(); | |||
exe.setCommandline( new Commandline( commandline1 ) ); | |||
@@ -22,7 +22,7 @@ import java.util.Random; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
@@ -650,7 +650,7 @@ public class JUnitTask extends Task | |||
} | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setCommandline( new Commandline( cmd.getCommandline() ) ); | |||
if( dir != null ) | |||
{ | |||
@@ -18,7 +18,7 @@ import java.util.Random; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
@@ -280,7 +280,7 @@ public abstract class AbstractMetamataTask | |||
throws TaskException | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
getLogger().debug( m_cmdl.toString() ); | |||
final String[] commandline = m_cmdl.getCommandline(); | |||
exe.setCommandline( new Commandline( commandline ) ); | |||
@@ -17,7 +17,7 @@ import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.avalon.excalibur.io.IOUtil; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
@@ -288,7 +288,7 @@ public class MParse | |||
} | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
getLogger().debug( m_cmdl.toString() ); | |||
final String[] commandline = m_cmdl.getCommandline(); | |||
exe.setCommandline( new Commandline( commandline ) ); | |||
@@ -12,7 +12,7 @@ import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.aut.nativelib.ExecOutputHandler; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.oro.text.perl.Perl5Util; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -167,7 +167,7 @@ public abstract class P4Base | |||
} | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setExecOutputHandler( handler ); | |||
exe.setCommandline( cmd ); | |||
@@ -24,7 +24,7 @@ import org.apache.aut.nativelib.ExecOutputHandler; | |||
import org.apache.avalon.excalibur.io.IOUtil; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -192,7 +192,7 @@ public class Pvcs | |||
try | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setWorkingDirectory( getBaseDirectory() ); | |||
exe.setCommandline( cmd ); | |||
result = exe.execute(); | |||
@@ -273,7 +273,7 @@ public class Pvcs | |||
final File fileList = File.createTempFile( "pvcs_ant_", ".log" ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
exe.setExecOutputHandler( this ); | |||
m_output = new FileOutputStream( tmp ); | |||
exe.setWorkingDirectory( getBaseDirectory() ); | |||
@@ -16,7 +16,7 @@ import java.util.Random; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.types.FileSet; | |||
@@ -116,7 +116,7 @@ public class CovMerge extends Task | |||
cmdl.addArgument( "-jp_paramfile=" + paramfile.getAbsolutePath() ); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
getLogger().debug( cmdl.toString() ); | |||
exe.setCommandline( cmdl ); | |||
@@ -20,7 +20,7 @@ import javax.xml.transform.stream.StreamResult; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.EnumeratedAttribute; | |||
import org.apache.tools.ant.types.Path; | |||
@@ -248,7 +248,7 @@ public class CovReport extends Task | |||
// use the custom handler for stdin issues | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
getLogger().debug( cmdl.toString() ); | |||
exe.setCommandline( cmdl ); | |||
int exitValue = exe.execute(); | |||
@@ -16,7 +16,7 @@ import java.util.ArrayList; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Argument; | |||
import org.apache.tools.ant.types.Commandline; | |||
import org.apache.tools.ant.types.CommandlineJava; | |||
@@ -250,7 +250,7 @@ public class Coverage | |||
// use the custom handler for stdin issues | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
getLogger().debug( cmdl.toString() ); | |||
exe.setCommandline( cmdl ); | |||
int exitValue = exe.execute(); | |||
@@ -13,7 +13,7 @@ import java.util.Properties; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -206,7 +206,7 @@ public abstract class MSVSS extends Task | |||
try | |||
{ | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
// If location of ss.ini is specified we need to set the | |||
// environment-variable SSDIR to this value | |||
@@ -12,7 +12,7 @@ import java.io.IOException; | |||
import org.apache.aut.nativelib.ExecManager; | |||
import org.apache.myrmidon.api.AbstractTask; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.taskdefs.exec.Execute2; | |||
import org.apache.myrmidon.framework.Execute; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -91,7 +91,7 @@ public class Rpm | |||
{ | |||
final Commandline cmd = createCommand(); | |||
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); | |||
final Execute2 exe = new Execute2( execManager ); | |||
final Execute exe = new Execute( execManager ); | |||
if( m_topDir == null ) | |||
{ | |||