Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 99478 invoked from network); 26 Jan 2005 12:48:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 26 Jan 2005 12:48:16 -0000 Received: (qmail 56250 invoked by uid 500); 26 Jan 2005 12:48:14 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 56197 invoked by uid 500); 26 Jan 2005 12:48:13 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 56182 invoked by uid 500); 26 Jan 2005 12:48:13 -0000 Received: (qmail 56178 invoked by uid 99); 26 Jan 2005 12:48:13 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 26 Jan 2005 04:48:12 -0800 Received: (qmail 99413 invoked by uid 1146); 26 Jan 2005 12:48:11 -0000 Date: 26 Jan 2005 12:48:11 -0000 Message-ID: <20050126124811.99410.qmail@minotaur.apache.org> From: bodewig@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/compilers DefaultCompilerAdapter.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N bodewig 2005/01/26 04:48:10 Modified: src/main/org/apache/tools/ant/taskdefs/compilers DefaultCompilerAdapter.java Log: Help people to adapt to JDK 1.5 Revision Changes Path 1.54 +29 -0 ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java Index: DefaultCompilerAdapter.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java,v retrieving revision 1.53 retrieving revision 1.54 diff -u -r1.53 -r1.54 --- DefaultCompilerAdapter.java 6 Jan 2005 12:05:10 -0000 1.53 +++ DefaultCompilerAdapter.java 26 Jan 2005 12:48:10 -0000 1.54 @@ -310,6 +310,21 @@ } else { cmd.createArgument().setValue(source); } + } else if (assumeJava15() && attributes.getTarget() != null) { + String t = attributes.getTarget(); + if (t.equals("1.1") || t.equals("1.2") || t.equals("1.3") + || t.equals("1.4")) { + attributes.log("The -source switch defaults to 1.5 in JDK 1.5.", + Project.MSG_WARN); + attributes.log("If you specify -target " + t + + " you now must also specify -source " + t + + ".", Project.MSG_WARN); + attributes.log("Ant will implicitly add -source " + t + + " for you. Please change your build file.", + Project.MSG_WARN); + cmd.createArgument().setValue("-source"); + cmd.createArgument().setValue(t); + } } return cmd; } @@ -528,6 +543,20 @@ } /** + * Shall we assume JDK 1.5 command line switches? + * @since Ant 1.6.3 + */ + protected boolean assumeJava15() { + return "javac1.5".equals(attributes.getCompilerVersion()) + || ("classic".equals(attributes.getCompilerVersion()) + && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5)) + || ("modern".equals(attributes.getCompilerVersion()) + && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5)) + || ("extJavac".equals(attributes.getCompilerVersion()) + && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5)); + } + + /** * Combines a user specified bootclasspath with the system * bootclasspath taking build.sysclasspath into account. * --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org