tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers BaseCompiler.java GcjCompiler.java CcCompiler.java CompilerAdapter.java LibtoolCompiler.java MwccCompiler.java
Date Fri, 09 Nov 2001 16:44:20 GMT
costin      01/11/09 08:44:20

  Modified:    jk/jkant/java/org/apache/jk/ant SoTask.java
               jk/jkant/java/org/apache/jk/ant/compilers CcCompiler.java
                        CompilerAdapter.java LibtoolCompiler.java
                        MwccCompiler.java
  Added:       jk/jkant/java/org/apache/jk/ant/compilers BaseCompiler.java
                        GcjCompiler.java
  Log:
  A bit of refactoring - created BaseCompiler, split addCcArgs into individual
  components.
  
  The compiler adapter can now return the obj extension ( via OMapper ) ( XXX TODO:
  return the .so/.dll/.nlm extension as well using the platform name )
  
  Added (very experimental) Gcj ( a variant of gcc that creates .o native out of java )
  
  Revision  Changes    Path
  1.15      +17 -18    jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java
  
  Index: SoTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SoTask.java	2001/11/08 19:30:31	1.14
  +++ SoTask.java	2001/11/09 16:44:20	1.15
  @@ -122,6 +122,8 @@
       // Computed fields 
       protected Vector compileList;
       protected String srcList[];
  +    protected CompilerAdapter compiler;
  +    protected GlobPatternMapper co_mapper;
       
       public SoTask() {};
   
  @@ -155,6 +157,7 @@
   	so.modules=modules;
   	so.srcList=srcList;
   	so.compileList=compileList;
  +	so.compiler=compiler;
       }
   
       /**  @deprecated use setTarget
  @@ -320,7 +323,8 @@
       // XXX Add specific code for Linux and platforms where things are
       // clean, libtool should be just a fallback.
       public void execute() throws BuildException {
  -	CompilerAdapter compiler=findCompilerAdapter();
  +	compiler=findCompilerAdapter();
  +	co_mapper=compiler.getOMapper();
   	LinkerAdapter linker=findLinkerAdapter();
   
   	if( soFile==null )
  @@ -345,13 +349,19 @@
   
       public CompilerAdapter findCompilerAdapter() {
   	CompilerAdapter compilerAdapter;
  -	String cc=project.getProperty("build.compiler.cc");
  +	String cc;
  +	cc=project.getProperty("build.compiler.cc");
   	if( cc!=null ) {
   	    if( "cc".equals( cc ) ) {
   		compilerAdapter=new CcCompiler();
   		compilerAdapter.setSoTask( this );
   		return compilerAdapter;
   	    }
  +	    if( "gcj".equals( cc ) ) {
  +		compilerAdapter=new GcjCompiler();
  +		compilerAdapter.setSoTask( this );
  +		return compilerAdapter;
  +	    }
   	    if( cc.indexOf("mwccnlm") != -1 ) {
   	        compilerAdapter=new MwccCompiler();
   	        compilerAdapter.setSoTask( this );
  @@ -368,16 +378,16 @@
   	LinkerAdapter linkerAdapter;
   	String ld=project.getProperty("build.compiler.ld");
   	if( ld!=null ) {
  -	    // 	    if( "ld".equals( cc ) ) {
  -	    // 		linkerAdapter=new LdLinker();
  -	    // 		linkerAdapter.setSoTask( this );
  -	    // 		return cc;
  -	    // 	    }
   	    if( ld.indexOf("mwldnlm") != -1 ) {
   	        linkerAdapter=new MwldLinker();
   	        linkerAdapter.setSoTask( this );
   	        return linkerAdapter;
   	    }
  +	    // 	    if( "ld".equals( cc ) ) {
  +	    // 		linkerAdapter=new LdLinker();
  +	    // 		linkerAdapter.setSoTask( this );
  +	    // 		return cc;
  +	    // 	    }
   	}
   	
   	linkerAdapter=new LibtoolLinker(); 
  @@ -422,17 +432,6 @@
   	}
       }
       
  -    protected static GlobPatternMapper co_mapper=new GlobPatternMapper();
  -    protected static GlobPatternMapper lo_mapper=new GlobPatternMapper();
  -    static {
  -	co_mapper.setFrom("*.c");
  -	co_mapper.setTo("*.o");
  -    }
  -    static {
  -	lo_mapper.setFrom("*.c");
  -	lo_mapper.setTo("*.lo");
  -    }
  -
       long oldestO=System.currentTimeMillis();
       File oldestOFile=null;
       
  
  
  
  1.3       +16 -32    jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/CcCompiler.java
  
  Index: CcCompiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/CcCompiler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CcCompiler.java	2001/11/08 22:52:48	1.2
  +++ CcCompiler.java	2001/11/09 16:44:20	1.3
  @@ -69,56 +69,40 @@
    *
    * @author Costin Manolache
    */
  -public class CcCompiler extends LibtoolCompiler implements CompilerAdapter {
  -    SoTask so;
  +public class CcCompiler extends BaseCompiler {
       
       public CcCompiler() {
  -	so=this;
  +	super();
       };
   
  -    public void setSoTask(SoTask so ) {
  -	super.setSoTask( so );
  -    }
  -
  -    public void execute() throws BuildException {
  -    }
  -
  -    public void compile(Vector compileList ) throws BuildException {
  -	Enumeration en=compileList.elements();
  -	while( en.hasMoreElements() ) {
  -	    File f=(File)en.nextElement();
  -	    executeCc(f.toString() );
  -	}
  -    }
  -
       /** Compile  using 'standard' gcc flags. This assume a 'current' gcc on
        *  a 'normal' platform - no need for libtool
        */
  -    public void executeCc(String source) throws BuildException {
  -	String [] includeList = ( includes==null ) ?
  -	    new String[] {} : includes.getIncludePatterns(project); 
   
  +    public void compileSingleFile(String source) throws BuildException {
   	Commandline cmd = new Commandline();
   
   	String cc=project.getProperty("build.native.cc");
   	if(cc==null) cc="gcc";
   	
   	cmd.setExecutable( cc );
  +
  +	cmd.createArgument().setValue( "-c" );
  +
  +	addIncludes(cmd);
  +	addExtraFlags( cmd );
  +	addDefines(cmd);
  +	addDefines( cmd );
  +	addOptimize( cmd );
  +	addProfile( cmd );
  +
  +	cmd.createArgument().setValue( source );
   
  -	// Common cc arguments
  -	addCCArgs( cmd, source, includeList );
  +	project.log( "Compiling " + source);
   
   	int result=execute( cmd );
   	if( result!=0 ) {
  -	    log("Compile failed " + result + " " +  source );
  -	    log("Output:" );
  -	    if( outputstream!=null ) 
  -		log( outputstream.toString());
  -	    log("StdErr:" );
  -	    if( errorstream!=null ) 
  -		log( errorstream.toString());
  -	    
  -	    throw new BuildException("Compile failed " + source);
  +	    displayError( result, source, cmd );
   	}
   	closeStreamHandler();
       }
  
  
  
  1.3       +5 -0      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CompilerAdapter.java	2001/11/02 20:25:09	1.2
  +++ CompilerAdapter.java	2001/11/09 16:44:20	1.3
  @@ -54,6 +54,8 @@
   
   package org.apache.jk.ant.compilers;
   
  +import org.apache.tools.ant.types.*;
  +import org.apache.tools.ant.util.*;
   import org.apache.tools.ant.BuildException;
   import org.apache.jk.ant.*;
   
  @@ -91,4 +93,7 @@
        */
       public void compile(Vector files ) throws BuildException;
   
  +    /** Return the extension ( including . ) for object files
  +     */
  +    public GlobPatternMapper getOMapper();
   }
  
  
  
  1.4       +16 -105   jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/LibtoolCompiler.java
  
  Index: LibtoolCompiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/LibtoolCompiler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LibtoolCompiler.java	2001/11/08 19:30:31	1.3
  +++ LibtoolCompiler.java	2001/11/09 16:44:20	1.4
  @@ -73,37 +73,15 @@
    *
    * @author Costin Manolache
    */
  -public class LibtoolCompiler extends SoTask implements CompilerAdapter {
  -    SoTask so;
  -    
  +public class LibtoolCompiler extends BaseCompiler {
  +
       public LibtoolCompiler() {
  -	so=this;
  +	super();
       };
   
  -    public void setSoTask(SoTask so ) {
  -	this.so=so;
  -	so.duplicateTo( this );
  -    }
  -
  -    public void execute() throws BuildException {
  -	super.findCompileList();
  -	compile( compileList );
  -    }
  -
  -    public void compile(Vector compileList ) throws BuildException {
  -	Enumeration en=compileList.elements();
  -	while( en.hasMoreElements() ) {
  -	    File f=(File)en.nextElement();
  -	    executeLibtoolCompile(f.toString() );
  -	}
  -    }
  -    
       /** Compile using libtool.
        */
  -    public void executeLibtoolCompile(String source) throws BuildException {
  -	String [] includeList = ( includes==null ) ?
  -	    new String[] {} : includes.getIncludePatterns(project); 
  -
  +    public void compileSingleFile(String source) throws BuildException {
   	Commandline cmd = new Commandline();
   
   	String libtool=project.getProperty("build.native.libtool");
  @@ -118,90 +96,23 @@
   
   	cmd.createArgument().setValue( cc );
   
  -	addCCArgs(cmd, source, includeList);
  -
  -	int result=execute( cmd );
  -	if( result!=0 ) {
  -	    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);
  -	}
  -	closeStreamHandler();
  -    }
  -
  -    /** Common cc parameters
  -     */
  -    protected void addCCArgs(Commandline cmd, String source, String includeList[]) {
  -	String extra_cflags=project.getProperty("build.native.extra_cflags");
  -	String localCflags=cflags;
  -	if( localCflags==null ) {
  -	    localCflags=extra_cflags;
  -	} else {
  -	    if( extra_cflags!=null ) {
  -		localCflags+=" " + extra_cflags;
  -	    }
  - 	}
  -
  -	for( int i=0; i<includeList.length; i++ ) {
  -	    cmd.createArgument().setValue("-I");
  -	    cmd.createArgument().setValue(includeList[i] );
  -	}
  -
  -	if( defines.size() > 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);
  -            }
  -        }
  -
   	cmd.createArgument().setValue( "-c" );
  -
  -	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" );
  -	}
  -	
  -	
  -	if( optimize )
  -	    cmd.createArgument().setValue("-O3" );
  -	
  -	if( profile ) {
  -	    cmd.createArgument().setValue("-pg" );
  -	    // bb.in 
  -	    // cmd.createArgument().setValue("-ax" );
  -	}
   
  -	if( localCflags != null )
  -	    cmd.createArgument().setLine( localCflags );
  +	addIncludes(cmd);
  +	addExtraFlags( cmd );
  +	addDefines(cmd);
  +	addDefines( cmd );
  +	addOptimize( cmd );
  +	addProfile( cmd );
   
   	project.log( "Compiling " + source);
   	cmd.createArgument().setValue( source );
  -    }
   
  +	int result=execute( cmd );
  +	if( result!=0 ) {
  +	    displayError( result, source, cmd );
  +	}
  +	closeStreamHandler();
  +    }
   }
   
  
  
  
  1.4       +3 -17     jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MwccCompiler.java
  
  Index: MwccCompiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MwccCompiler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MwccCompiler.java	2001/11/08 19:30:31	1.3
  +++ MwccCompiler.java	2001/11/09 16:44:20	1.4
  @@ -73,11 +73,10 @@
    *
    * @author Mike Anderson
    */
  -public class MwccCompiler extends SoTask implements CompilerAdapter {
  -    SoTask so;
  +public class MwccCompiler extends BaseCompiler {
       
       public MwccCompiler() {
  -        so=this;
  +        super();
       };
   
       public void setSoTask(SoTask so ) {
  @@ -87,22 +86,9 @@
           project.setProperty("netware", "true");
       }
   
  -    public void execute() throws BuildException {
  -        super.findCompileList();
  -        compile( compileList );
  -    }
  -
  -    public void compile(Vector compileList ) throws BuildException {
  -        Enumeration en=compileList.elements();
  -        while( en.hasMoreElements() ) {
  -            File f=(File)en.nextElement();
  -            executeMwccCompile(f.toString() );
  -        }
  -    }
  -    
       /** Compile  using mwccnlm.
        */
  -    public void executeMwccCompile(String source) throws BuildException {
  +    public void compileSingleFile(String source) throws BuildException {
           String [] includeList = ( includes==null ) ?
               new String[] {} : includes.getIncludePatterns(project);
   
  
  
  
  1.1                  jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/BaseCompiler.java
  
  Index: BaseCompiler.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Ant", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jk.ant.compilers;
  
  import org.apache.tools.ant.types.*;
  import org.apache.tools.ant.util.*;
  import org.apache.tools.ant.taskdefs.*;
  import org.apache.tools.ant.*;
  import org.apache.jk.ant.*;
  
  import java.io.*;
  import java.util.*;
  
  /**
   *  Compile using libtool.
   * 
   *  It extends SoTask so we can debug it or use it independently of <so>.
   *  For normal use you should use the generic task, and system-specific
   *  properties to choose the right compiler plugin ( like we select
   *  jikes ).
   *
   * @author Costin Manolache
   */
  public class BaseCompiler extends SoTask implements CompilerAdapter {
      SoTask so;
  
      public BaseCompiler() {
  	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 {
  	Enumeration en=compileList.elements();
  	while( en.hasMoreElements() ) {
  	    File f=(File)en.nextElement();
  	    compileSingleFile(f.toString() );
  	}
      }
      
      /** Compile single file
       */
      public void compileSingleFile(String source) 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<includeList.length; i++ ) {
  	    cmd.createArgument().setValue("-I");
  	    cmd.createArgument().setValue(includeList[i] );
  	}
      }
  
      /** Common cc parameters
       */
      protected void addExtraFlags(Commandline cmd )  {
  	String extra_cflags=project.getProperty("build.native.extra_cflags");
  	String localCflags=cflags;
  	if( localCflags==null ) {
  	    localCflags=extra_cflags;
  	} else {
  	    if( extra_cflags!=null ) {
  		localCflags+=" " + extra_cflags;
  	    }
   	}
  	if( localCflags != null )
  	    cmd.createArgument().setLine( localCflags );
      }
  
      protected void addDefines( Commandline cmd ) {
  	if( defines.size() > 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" );
  	}
      }
  }
  
  
  
  
  1.1                  jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/GcjCompiler.java
  
  Index: GcjCompiler.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Ant", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jk.ant.compilers;
  
  import org.apache.tools.ant.types.*;
  import org.apache.tools.ant.util.*;
  import org.apache.tools.ant.taskdefs.*;
  import org.apache.tools.ant.*;
  import org.apache.jk.ant.*;
  
  import java.io.*;
  import java.util.*;
  
  /**
   *  Compile using Gcj. This is ( even more ) experimental.
   * 
   * @author Costin Manolache
   */
  public class GcjCompiler extends BaseCompiler {
      
      public GcjCompiler() {
  	super();
      }
  
      public GlobPatternMapper getOMapper() {
  	GlobPatternMapper co_mapper=new GlobPatternMapper();
  	co_mapper.setFrom("*.java");
  	co_mapper.setTo("*.o");
  
  	return co_mapper;
      }
  
      /** Compile using libtool.
       */
      public void compileSingleFile(String source) throws BuildException {
  	Commandline cmd = new Commandline();
  
  	cmd.setExecutable( "gcj" );
  	cmd.createArgument().setValue("-c");
  	cmd.createArgument().setValue("-O2");
  
  	cmd.createArgument().setValue( source );
  	project.log( "Compiling " + source);
  	
  	int result=execute( cmd );
  	if( result!=0 ) {
  	    displayError( result, source, cmd );
  	}
  	closeStreamHandler();
      }
  }
  
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message