Return-Path:
Delivered-To: apmail-jakarta-tomcat-dev-archive@apache.org
Received: (qmail 24953 invoked from network); 10 Nov 2001 16:47:35 -0000
Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131)
by daedalus.apache.org with SMTP; 10 Nov 2001 16:47:35 -0000
Received: (qmail 9440 invoked by uid 97); 10 Nov 2001 16:47:26 -0000
Delivered-To: qmlist-jakarta-archive-tomcat-dev@jakarta.apache.org
Received: (qmail 9416 invoked by uid 97); 10 Nov 2001 16:47:25 -0000
Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm
Precedence: bulk
List-Unsubscribe:
List-Subscribe:
List-Help:
List-Post:
List-Id: "Tomcat Developers List"
Reply-To: "Tomcat Developers List"
Delivered-To: mailing list tomcat-dev@jakarta.apache.org
Received: (qmail 9405 invoked by uid 97); 10 Nov 2001 16:47:24 -0000
Date: 10 Nov 2001 16:35:01 -0000
Message-ID: <20011110163501.49186.qmail@icarus.apache.org>
From: costin@apache.org
To: jakarta-tomcat-connectors-cvs@apache.org
Subject: cvs commit:
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers
CompilerAdapter.java BaseCompiler.java
X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N
X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N
costin 01/11/10 08:35:01
Modified: jk/jkant/java/org/apache/jk/ant/compilers
CompilerAdapter.java
Removed: jk/jkant/java/org/apache/jk/ant/compilers BaseCompiler.java
Log:
Turn CompilerAdapter into an abstract class ( from interface ), remove BaseCompiler.
The main reason for that - the interface was not defining all the expected
behaviors.
I'm not sure what method to make abstract - compile( Vector sources ) or
compileSingleFile( Source src ). While the second is used and the most convenient,
most compilers will be faster if we pass multiple sources.
Revision Changes Path
1.4 +124 -13 jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/CompilerAdapter.java
Index: CompilerAdapter.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/CompilerAdapter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CompilerAdapter.java 2001/11/09 16:44:20 1.3
+++ CompilerAdapter.java 2001/11/10 16:35:01 1.4
@@ -58,8 +58,11 @@
import org.apache.tools.ant.util.*;
import org.apache.tools.ant.BuildException;
import org.apache.jk.ant.*;
+import org.apache.tools.ant.taskdefs.*;
+import org.apache.tools.ant.*;
import java.util.*;
+import java.io.*;
/* Modeled after javac
*/
@@ -77,23 +80,131 @@
* reflection).
*
* @author Jay Dickon Glanville jayglanville@home.com
+ * @author Costin Manolache
*/
-public interface CompilerAdapter {
+public abstract class CompilerAdapter extends SoTask {
+ SoTask so;
- /**
- * Sets the compiler attributes, which are stored in the Javac task.
+ public CompilerAdapter() {
+ so=this;
+ };
+
+ public void setSoTask(SoTask so ) {
+ this.so=so;
+ so.duplicateTo( this );
+ }
+
+ public GlobPatternMapper getOMapper() {
+ GlobPatternMapper co_mapper=new GlobPatternMapper();
+ co_mapper.setFrom("*.c");
+ co_mapper.setTo("*.o");
+
+ return co_mapper;
+ }
+
+ public void execute() throws BuildException {
+ super.findCompileList();
+ compile( compileList );
+ }
+
+ public void compile(Vector compileList ) throws BuildException {
+ so.duplicateTo(this);
+ Enumeration en=compileList.elements();
+ while( en.hasMoreElements() ) {
+ Source source=(Source)en.nextElement();
+ compileSingleFile(source);
+ }
+ }
+
+ /** Compile single file
*/
- void setSoTask( SoTask attributes );
+ public void compileSingleFile(Source sourceObj) throws BuildException {
+ }
- /**
- * Compile a set of files. The caller is supposed to
- * detect dependencies.
- *
- * @return has the compilation been successful
- */
- public void compile(Vector files ) throws BuildException;
+
+ protected void displayError( int result, String source, Commandline cmd )
+ throws BuildException
+ {
+ log("Compile failed " + result + " " + source );
+ log("Command:" + cmd.toString());
+ log("Output:" );
+ if( outputstream!=null )
+ log( outputstream.toString());
+ log("StdErr:" );
+ if( errorstream!=null )
+ log( errorstream.toString());
+
+ throw new BuildException("Compile failed " + source);
+ }
+
+ protected void addIncludes(Commandline cmd) {
+ String [] includeList = ( includes==null ) ?
+ new String[] {} : includes.getIncludePatterns(project);
+ for( int i=0; i 0 ) {
+ Enumeration defs=defines.elements();
+ while( defs.hasMoreElements() ) {
+ Def d=(Def)defs.nextElement();
+ String name=d.getName();
+ String val=d.getValue();
+ if( name==null ) continue;
+ String arg="-D" + name;
+ if( val!=null )
+ arg+= "=" + val;
+ cmd.createArgument().setValue( arg );
+ if( debug > 0 ) project.log(arg);
+ }
+ }
+ }
+
+ protected void addDebug(Commandline cmd) {
+ if( optG ) {
+ cmd.createArgument().setValue("-g" );
+ cmd.createArgument().setValue("-W");
+ cmd.createArgument().setValue("-Wall");
+
+ cmd.createArgument().setValue("-Wtraditional");
+ cmd.createArgument().setValue("-Wredundant-decls");
+ cmd.createArgument().setValue("-Wmissing-declarations");
+ cmd.createArgument().setValue("-Wmissing-prototypes");
+ cmd.createArgument().setValue("-Wconversions");
+ cmd.createArgument().setValue("-Wcast-align");
+
+ cmd.createArgument().setValue("-pedantic" );
+ }
+ }
+
+ protected void addOptimize( Commandline cmd ) {
+ if( optimize )
+ cmd.createArgument().setValue("-O3" );
+ }
+
+ protected void addProfile( Commandline cmd ) {
+ if( profile ) {
+ cmd.createArgument().setValue("-pg" );
+ // bb.in
+ // cmd.createArgument().setValue("-ax" );
+ }
+ }
}
--
To unsubscribe, e-mail:
For additional commands, e-mail: