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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]