From 130b9317efa86bc6509e592b52df18c89743d95a Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 29 Jan 2009 05:23:52 +0000 Subject: [PATCH] =?UTF-8?q?support=20source/target=20on=20gcj.=20=20PR=204?= =?UTF-8?q?6617.=20=20Based=20on=20patch=20by=20Pawe=C5=82=20Zuzelski?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@738761 13f79535-47bb-0310-9956-ffa450edef68 --- CONTRIBUTORS | 1 + WHATSNEW | 4 ++++ contributors.xml | 4 ++++ docs/manual/CoreTasks/javac.html | 8 +++++--- src/main/org/apache/tools/ant/taskdefs/Javac.java | 15 +++++++++------ .../apache/tools/ant/taskdefs/compilers/Gcj.java | 10 ++++++++++ 6 files changed, 33 insertions(+), 9 deletions(-) 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;