From df0a7e735816230fab66918a29b8cff5c541bb9c Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Sun, 6 Jan 2002 01:56:09 +0000 Subject: [PATCH] Use Execute2 abstraction git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270561 13f79535-47bb-0310-9956-ffa450edef68 --- .../compilers/DefaultCompilerAdapter.java | 15 ++++++--------- .../compilers/DefaultCompilerAdapter.java | 15 ++++++--------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index c2d541b5c..ef2bc8908 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -14,10 +14,8 @@ import java.io.PrintWriter; 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.Project; import org.apache.tools.ant.taskdefs.Javac; -import org.apache.tools.ant.taskdefs.exec.Execute; -import org.apache.tools.ant.taskdefs.exec.LogOutputStream; +import org.apache.tools.ant.taskdefs.exec.Execute2; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -53,7 +51,7 @@ public abstract class DefaultCompilerAdapter protected boolean m_includeJavaRuntime; protected String m_memoryInitialSize; protected String m_memoryMaximumSize; - protected Project m_project; + protected File m_baseDir; /* * jdg - TODO - all these attributes are currently protected, but they @@ -78,7 +76,7 @@ public abstract class DefaultCompilerAdapter m_extdirs = attributes.getExtdirs(); m_compileList = attributes.getFileList(); m_compileClasspath = attributes.getClasspath(); - m_project = attributes.getProject(); + m_baseDir = attributes.getBaseDirectory(); m_includeAntRuntime = attributes.getIncludeantruntime(); m_includeJavaRuntime = attributes.getIncludejavaruntime(); m_memoryInitialSize = attributes.getMemoryInitialSize(); @@ -391,10 +389,9 @@ public abstract class DefaultCompilerAdapter try { - final Execute exe = new Execute(); - exe.setOutput( new LogOutputStream( m_attributes.hackGetLogger(), false ) ); - exe.setError( new LogOutputStream( m_attributes.hackGetLogger(), true ) ); - exe.setWorkingDirectory( m_project.getBaseDir() ); + final Execute2 exe = new Execute2(); + setupLogger( exe ); + exe.setWorkingDirectory( m_baseDir ); exe.setCommandline( commandArray ); return exe.execute(); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index c2d541b5c..ef2bc8908 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -14,10 +14,8 @@ import java.io.PrintWriter; 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.Project; import org.apache.tools.ant.taskdefs.Javac; -import org.apache.tools.ant.taskdefs.exec.Execute; -import org.apache.tools.ant.taskdefs.exec.LogOutputStream; +import org.apache.tools.ant.taskdefs.exec.Execute2; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -53,7 +51,7 @@ public abstract class DefaultCompilerAdapter protected boolean m_includeJavaRuntime; protected String m_memoryInitialSize; protected String m_memoryMaximumSize; - protected Project m_project; + protected File m_baseDir; /* * jdg - TODO - all these attributes are currently protected, but they @@ -78,7 +76,7 @@ public abstract class DefaultCompilerAdapter m_extdirs = attributes.getExtdirs(); m_compileList = attributes.getFileList(); m_compileClasspath = attributes.getClasspath(); - m_project = attributes.getProject(); + m_baseDir = attributes.getBaseDirectory(); m_includeAntRuntime = attributes.getIncludeantruntime(); m_includeJavaRuntime = attributes.getIncludejavaruntime(); m_memoryInitialSize = attributes.getMemoryInitialSize(); @@ -391,10 +389,9 @@ public abstract class DefaultCompilerAdapter try { - final Execute exe = new Execute(); - exe.setOutput( new LogOutputStream( m_attributes.hackGetLogger(), false ) ); - exe.setError( new LogOutputStream( m_attributes.hackGetLogger(), true ) ); - exe.setWorkingDirectory( m_project.getBaseDir() ); + final Execute2 exe = new Execute2(); + setupLogger( exe ); + exe.setWorkingDirectory( m_baseDir ); exe.setCommandline( commandArray ); return exe.execute(); }