diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 6c43e8fa1..ff36a02d3 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -226,6 +226,7 @@ Paul Christmann Paul Galbraith Paul King Paulo Gaspar +Pawel Zuzelski Peter B. West Peter Donald Peter Doornbosch diff --git a/WHATSNEW b/WHATSNEW index 3da2eaaba..8077debb4 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -655,6 +655,10 @@ Other changes: these were eliminated in the interest of behaving in the manner of a "path." + * 's source and target attributes are no longer ignored when + using gcj. + Bugzilla Issue 46617. + Changes from Ant 1.7.0 TO Ant 1.7.1 ============================================= diff --git a/contributors.xml b/contributors.xml index 7e35ff66e..859fb521e 100644 --- a/contributors.xml +++ b/contributors.xml @@ -923,6 +923,10 @@ Paulo Gaspar + + Paweł + Zuzelski + Peter B. diff --git a/docs/manual/CoreTasks/javac.html b/docs/manual/CoreTasks/javac.html index 29a5f5963..35b2f27c8 100644 --- a/docs/manual/CoreTasks/javac.html +++ b/docs/manual/CoreTasks/javac.html @@ -358,9 +358,11 @@ invoking the compiler.

Value of the -source command-line switch; will be ignored by all implementations prior to javac1.4 (or modern when Ant is not - running in a 1.3 VM) and jikes.
If you use this - attribute together with jikes, you must make sure - that your version of jikes supports the -source + running in a 1.3 VM), gcj and jikes.
+ If you use this attribute together with gcj + or jikes, you must make sure that your version + supports the -source (or -fsource for + gcj) switch. By default, no -source argument will be used at all.
Note that the default value depends on the JVM that is running diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java index 0d8471f9e..8df04ccd2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -186,13 +186,16 @@ public class Javac extends MatchingTask { } /** - * Value of the -source command-line switch; will be ignored - * by all implementations except modern and jikes. + * Value of the -source command-line switch; will be ignored by + * all implementations except modern, jikes and gcj (gcj uses + * -fsource). * - * If you use this attribute together with jikes, you must make - * sure that your version of jikes supports the -source switch. - * Legal values are 1.3, 1.4, 1.5, and 5 - by default, no - * -source argument will be used at all. + *

If you use this attribute together with jikes or gcj, you + * must make sure that your version of jikes supports the -source + * switch.

+ * + *

Legal values are 1.3, 1.4, 1.5, and 5 - by default, no + * -source argument will be used at all.

* * @param v Value to assign to source. */ diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java b/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java index cae497fbd..889d66712 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java @@ -114,6 +114,16 @@ public class Gcj extends DefaultCompilerAdapter { cmd.createArgument().setValue("-C"); } + if (attributes.getSource() != null) { + String source = attributes.getSource(); + cmd.createArgument().setValue("-fsource=" + source); + } + + if (attributes.getTarget() != null) { + String target = attributes.getTarget(); + cmd.createArgument().setValue("-ftarget=" + target); + } + addCurrentCompilerArgs(cmd); return cmd;