bodewig 2004/04/13 04:40:18 Modified: . Tag: ANT_16_BRANCH CONTRIBUTORS WHATSNEW src/main/org/apache/tools/ant/taskdefs/compilers Tag: ANT_16_BRANCH Gcj.java Log: merge Revision Changes Path No revision No revision 1.1.2.6 +1 -0 ant/CONTRIBUTORS Index: CONTRIBUTORS =================================================================== RCS file: /home/cvs/ant/CONTRIBUTORS,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -r1.1.2.5 -r1.1.2.6 --- CONTRIBUTORS 13 Apr 2004 11:26:13 -0000 1.1.2.5 +++ CONTRIBUTORS 13 Apr 2004 11:40:18 -0000 1.1.2.6 @@ -6,6 +6,7 @@ Anil K. Vijendran Anli Shundi Antoine Levy-Lambert +Arnaud Vandyck Arnout J. Kuiper Aslak Hellesøy Avik Sengupta 1.503.2.66 +5 -0 ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/ant/WHATSNEW,v retrieving revision 1.503.2.65 retrieving revision 1.503.2.66 diff -u -r1.503.2.65 -r1.503.2.66 --- WHATSNEW 13 Apr 2004 11:30:32 -0000 1.503.2.65 +++ WHATSNEW 13 Apr 2004 11:40:18 -0000 1.503.2.66 @@ -38,6 +38,11 @@ * <java> swallowed the stack trace of exceptions thrown by the executed program if run in the same VM. +* If <javac> uses gcj and any of the nested <compilerarg>s implies + compilation to native code (like -o or --main), Ant will not pass + the -C switch to gcj. This means you can now compile to native code + with gcj which has been impossible in Ant < 1.6.2. + Other changes: -------------- No revision No revision 1.14.2.6 +32 -1 ant/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java Index: Gcj.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java,v retrieving revision 1.14.2.5 retrieving revision 1.14.2.6 diff -u -r1.14.2.5 -r1.14.2.6 --- Gcj.java 9 Mar 2004 17:01:38 -0000 1.14.2.5 +++ Gcj.java 13 Apr 2004 11:40:18 -0000 1.14.2.6 @@ -102,11 +102,42 @@ /** * gcj should be set for generate class. + * ... if no 'compile to native' argument is passed */ - cmd.createArgument().setValue("-C"); + if (!isNativeBuild()) { + cmd.createArgument().setValue("-C"); + } addCurrentCompilerArgs(cmd); return cmd; } + + /** + * Whether any of the arguments given via <compilerarg> + * implies that compilation to native code is requested. + * + * @since Ant 1.6.2 + */ + public boolean isNativeBuild() { + boolean nativeBuild = false; + String[] additionalArguments = getJavac().getCurrentCompilerArgs(); + int argsLength=0; + while (!nativeBuild && argsLength < additionalArguments.length) { + int conflictLength = 0; + while (!nativeBuild + && conflictLength < CONFLICT_WITH_DASH_C.length) { + nativeBuild = (additionalArguments[argsLength].startsWith + (CONFLICT_WITH_DASH_C[conflictLength])); + conflictLength++; + } + argsLength++; + } + return nativeBuild; + } + + private static final String [] CONFLICT_WITH_DASH_C = { + "-o" , "--main=", "-D", "-fjni", "-L" + }; + }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]