bodewig 2004/04/13 04:40:08
Modified: . CONTRIBUTORS WHATSNEW
src/main/org/apache/tools/ant/taskdefs/compilers Gcj.java
Log:
enable gcj's java -> native compilation.
Submitted by: Arnaud Vandyck <arnaud dot vandyck at ulg dot ac dot be>
Revision Changes Path
1.11 +1 -0 ant/CONTRIBUTORS
Index: CONTRIBUTORS
===================================================================
RCS file: /home/cvs/ant/CONTRIBUTORS,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- CONTRIBUTORS 7 Apr 2004 22:46:51 -0000 1.10
+++ CONTRIBUTORS 13 Apr 2004 11:40:08 -0000 1.11
@@ -6,6 +6,7 @@
Anil K. Vijendran
Anli Shundi
Antoine Levy-Lambert
+Arnaud Vandyck
Arnout J. Kuiper
Aslak Helles�y
Avik Sengupta
1.582 +5 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.581
retrieving revision 1.582
diff -u -r1.581 -r1.582
--- WHATSNEW 13 Apr 2004 11:30:47 -0000 1.581
+++ WHATSNEW 13 Apr 2004 11:40:08 -0000 1.582
@@ -105,6 +105,11 @@
* failOnAny attribute for <parallel> was broken. Bugzilla Report 28122.
+* 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:
--------------
1.20 +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.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- Gcj.java 9 Mar 2004 16:48:13 -0000 1.19
+++ Gcj.java 13 Apr 2004 11:40:08 -0000 1.20
@@ -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]