You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by do...@apache.org on 2002/03/06 11:37:41 UTC
cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers CompilerAdapter.java CompilerAdapterFactory.java DefaultCompilerAdapter.java Javac.java
donaldp 02/03/06 02:37:41
Modified: proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers
CompilerAdapter.java CompilerAdapterFactory.java
DefaultCompilerAdapter.java Javac.java
Log:
Convert Javac to using TaskContext to log
Revision Changes Path
1.5 +2 -0 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapter.java
Index: CompilerAdapter.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CompilerAdapter.java 3 Mar 2002 06:40:11 -0000 1.4
+++ CompilerAdapter.java 6 Mar 2002 10:37:41 -0000 1.5
@@ -8,6 +8,7 @@
package org.apache.tools.ant.taskdefs.compilers;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.TaskContext;
/**
* The interface that all compiler adapters must adher to. <p>
@@ -24,6 +25,7 @@
public interface CompilerAdapter
{
+ void setTaskContext( TaskContext context );
/**
* Sets the compiler attributes, which are stored in the Javac task.
1.5 +11 -5 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
Index: CompilerAdapterFactory.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CompilerAdapterFactory.java 23 Dec 2001 14:22:44 -0000 1.4
+++ CompilerAdapterFactory.java 6 Mar 2002 10:37:41 -0000 1.5
@@ -7,7 +7,7 @@
*/
package org.apache.tools.ant.taskdefs.compilers;
-import org.apache.avalon.framework.logger.Logger;
+import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.api.TaskException;
/**
@@ -45,14 +45,21 @@
*
* @param compilerType either the name of the desired compiler, or the full
* classname of the compiler's adapter.
- * @param task a task to log through.
* @return The Compiler value
* @throws TaskException if the compiler type could not be resolved into a
* compiler adapter.
*/
- public static CompilerAdapter getCompiler( String compilerType, Logger logger )
+ public static CompilerAdapter getCompiler( String compilerType,
+ TaskContext context )
throws TaskException
{
+ final CompilerAdapter adaptor = createAdaptor( compilerType, context );
+ adaptor.setTaskContext( context );
+ return adaptor;
+ }
+
+ private static CompilerAdapter createAdaptor( String compilerType, TaskContext context ) throws TaskException
+ {
/*
* If I've done things right, this should be the extent of the
* conditional statements required.
@@ -84,7 +91,7 @@
{
final String message = "Modern compiler is not available - using "
+ "classic compiler";
- logger.warn( message );
+ context.warn( message );
return new Javac12();
}
return new Javac13();
@@ -144,5 +151,4 @@
+ "exception.", t );
}
}
-
}
1.35 +0 -3 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
Index: DefaultCompilerAdapter.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- DefaultCompilerAdapter.java 6 Mar 2002 10:13:28 -0000 1.34
+++ DefaultCompilerAdapter.java 6 Mar 2002 10:37:41 -0000 1.35
@@ -14,8 +14,6 @@
import org.apache.aut.nativelib.ExecManager;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.avalon.excalibur.util.StringUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
import org.apache.myrmidon.api.TaskContext;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.Execute;
@@ -35,7 +33,6 @@
* @author <a href="mailto:jayglanville@home.com">J D Glanville</a>
*/
public abstract class DefaultCompilerAdapter
-// extends AbstractLogEnabled
implements CompilerAdapter
{
protected boolean m_debug;
1.3 +4 -7 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac.java
Index: Javac.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Javac.java 4 Mar 2002 02:44:14 -0000 1.2
+++ Javac.java 6 Mar 2002 10:37:41 -0000 1.3
@@ -575,13 +575,10 @@
/**
* Adds an implementation specific command line argument.
- *
- * @return Description of the Returned Value
*/
- public org.apache.tools.ant.taskdefs.compilers.ImplementationSpecificArgument createCompilerArg()
+ public ImplementationSpecificArgument createCompilerArg()
{
- org.apache.tools.ant.taskdefs.compilers.ImplementationSpecificArgument arg =
- new org.apache.tools.ant.taskdefs.compilers.ImplementationSpecificArgument( this );
+ final ImplementationSpecificArgument arg = new ImplementationSpecificArgument( this );
m_implementationSpecificArgs.add( arg );
return arg;
}
@@ -637,8 +634,8 @@
if( m_compileList.length > 0 )
{
- CompilerAdapter adapter = CompilerAdapterFactory.getCompiler(
- compiler, getLogger() );
+ CompilerAdapter adapter =
+ CompilerAdapterFactory.getCompiler( compiler, getContext() );
final String message = "Compiling " + m_compileList.length + " source file" +
( m_compileList.length == 1 ? "" : "s" ) +
( m_destDir != null ? " to " + m_destDir : "" );
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>