From toraneko@kun.ne.jp Thu Mar 8 03:08:50 2001 Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 50809 invoked from network); 8 Mar 2001 03:08:50 -0000 Received: from ms1.nttdata.co.jp (HELO ms.nttdata.co.jp) (163.135.193.232) by h31.sny.collab.net with SMTP; 8 Mar 2001 03:08:50 -0000 Received: from mail1.nttdata.co.jp ([163.135.10.21]) by ms.nttdata.co.jp (8.9.3/3.7W-NTTDATA-TOP-03/01/01) with ESMTP id MAA02570 for ; Thu, 8 Mar 2001 12:08:54 +0900 (JST) Received: from geb.rd.nttdata.co.jp (localhost [127.0.0.1]) by mail1.nttdata.co.jp (8.9.1/3.7W-NTTDATA-TOP-12/27/00) with ESMTP id MAA28557 for ; Thu, 8 Mar 2001 12:08:39 +0900 (JST) Received: from osiris.rd.nttdata.co.jp (osiris.rd.nttdata.co.jp [10.8.144.16]) by geb.rd.nttdata.co.jp (8.9.3/3.7W/R8V8) with ESMTP id MAA25323 for ; Thu, 8 Mar 2001 12:08:53 +0900 (JST) Received: from piccolo.local (piccolo.rd.nttdata.co.jp [10.8.129.83]) by osiris.rd.nttdata.co.jp (8.10.1/3.7W/R8V8) with ESMTP id f2838qY11781 for ; Thu, 8 Mar 2001 12:08:52 +0900 (JST) Date: Thu, 08 Mar 2001 12:11:08 +0900 Message-ID: <87wva17y5v.wl@piccolo> From: Takashi Okamoto To: ant-dev@jakarta.apache.org Subject: [PATCH] Rmic.java for Kaffe In-Reply-To: In your message of "Wed, 07 Mar 2001 12:21:40 +0900" <87vgpm5kmz.wl@piccolo> References: <87vgpm5kmz.wl@piccolo> User-Agent: Wanderlust/2.2.15 (More Than Words) EMIKO/1.13.9 (Euglena tripteris) FLIM/1.13.2 (Kasanui) APEL/10.2 Emacs/20.7 (i386-debian-linux-gnu) MULE/4.1 (AOI) MIME-Version: 1.0 (generated by EMIKO 1.13.9 - "Euglena tripteris") Content-Type: text/plain; charset=US-ASCII X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Hi, Ant!! At Wed, 07 Mar 2001 12:21:40 +0900, Takashi Okamoto wrote: > I post a patch for Kaffe problem at ZipOutputStream. One more thing for Kaffe. Following line depend on SUN' JDK (tools.jar): src/main/org/apache/tools/ant/taskdefs/ at line 252: sun.rmi.rmic.Main compiler = new sun.rmi.rmic.Main(logstr, "rmic"); We can't compile and use Ant by Jikes and Kaffe. I suggest using reflection API to use both sun and kaffe rmic. Please refer following patch and fix it (but I didn't test it). regards. --------------- Takashi Okamoto ------------------------------------------------------------- --- src/main/org/apache/tools/ant/taskdefs/Rmic.java.orig Thu Mar 8 09:26:48 2001 +++ src/main/org/apache/tools/ant/taskdefs/Rmic.java Thu Mar 8 09:29:05 2001 @@ -63,6 +63,8 @@ import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.util.*; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; import java.io.*; import java.util.StringTokenizer; import java.util.Vector; @@ -249,7 +251,6 @@ // need to provide an input stream that we read in from! OutputStream logstr = new LogOutputStream(this, Project.MSG_WARN); - sun.rmi.rmic.Main compiler = new sun.rmi.rmic.Main(logstr, "rmic"); Commandline cmd = new Commandline(); cmd.createArgument().setValue("-d"); @@ -292,7 +293,33 @@ cmd.createArgument().setValue((String) compileList.elementAt(j)); } log("Compilation args: " + cmd.toString(), Project.MSG_VERBOSE); - compiler.compile(cmd.getArguments()); + + Object compiler = null; + Method compile = null; + Class c = null; + Constructor cons = null; + try { + // SUN's rmic + c = Class.forName("sun.rmi.rmic.Main"); + cons = c.getConstructor(new Class[] + { OutputStream.class, String.class }); + compiler = cons.newInstance(new Object[] { logstr, "rmic" }); + compile = c.getMethod("compile", new Class [] + { String[].class }); + compile.invoke(compiler, (Object[]) cmd.getArguments() ); + } catch (Exception es) { + try { + // Kaffe's rmic + c = Class.forName("kaffe.rmi.rmic.RMIC"); + cons = c.getConstructor(new Class[] { String[].class }); + compiler = cons.newInstance(new Object[] { cmd.getArguments() }); + compile = c.getMethod("run", null); + compile.invoke(compiler, null); + } catch (Exception ek) { + ek.printStackTrace(); + System.exit(1); + } + } } // Move the generated source file to the base directory