git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@382927 13f79535-47bb-0310-9956-ffa450edef68master
@@ -398,6 +398,7 @@ | |||||
<available property="jdk1.3+" classname="java.lang.StrictMath"/> | <available property="jdk1.3+" classname="java.lang.StrictMath"/> | ||||
<available property="jdk1.4+" classname="java.lang.CharSequence"/> | <available property="jdk1.4+" classname="java.lang.CharSequence"/> | ||||
<available property="jdk1.5+" classname="java.lang.Readable"/> | <available property="jdk1.5+" classname="java.lang.Readable"/> | ||||
<available property="jdk1.6+" classname="java.util.Service"/> | |||||
<available property="kaffe" classname="kaffe.util.NotImplemented"/> | <available property="kaffe" classname="kaffe.util.NotImplemented"/> | ||||
<available property="bsf.present" | <available property="bsf.present" | ||||
classname="org.apache.bsf.BSFManager" | classname="org.apache.bsf.BSFManager" | ||||
@@ -53,10 +53,11 @@ attribute are:</a></p> | |||||
<li><code>classic</code> (the standard compiler of JDK 1.1/1.2) – | <li><code>classic</code> (the standard compiler of JDK 1.1/1.2) – | ||||
<code>javac1.1</code> and | <code>javac1.1</code> and | ||||
<code>javac1.2</code> can be used as aliases.</li> | <code>javac1.2</code> can be used as aliases.</li> | ||||
<li><code>modern</code> (the standard compiler of JDK 1.3/1.4/1.5) – | |||||
<li><code>modern</code> (the standard compiler of JDK 1.3/1.4/1.5/1.6) – | |||||
<code>javac1.3</code> and | <code>javac1.3</code> and | ||||
<code>javac1.4</code> and | <code>javac1.4</code> and | ||||
<code>javac1.5</code> can be used as aliases.</li> | |||||
<code>javac1.5</code> and | |||||
<code>javac1.6</code> can be used as aliases.</li> | |||||
<li><code>jikes</code> (the <a | <li><code>jikes</code> (the <a | ||||
href="http://jikes.sourceforge.net/" target="_top">Jikes</a> | href="http://jikes.sourceforge.net/" target="_top">Jikes</a> | ||||
compiler).</li> | compiler).</li> | ||||
@@ -613,7 +614,7 @@ while all others are <code>false</code>.</p> | |||||
<code><javac></code>.</p> | <code><javac></code>.</p> | ||||
<hr> | <hr> | ||||
<p align="center">Copyright © 2000-2005 The Apache Software Foundation. | |||||
<p align="center">Copyright © 2000-2006 The Apache Software Foundation. | |||||
All rights Reserved.</p> | All rights Reserved.</p> | ||||
</body> | </body> | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
* Copyright 2000-2005 The Apache Software Foundation | |||||
* Copyright 2000-2006 The Apache Software Foundation | |||||
* | * | ||||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
@@ -69,6 +69,7 @@ public class Javac extends MatchingTask { | |||||
private static final String FAIL_MSG | private static final String FAIL_MSG | ||||
= "Compile failed; see the compiler error output for details."; | = "Compile failed; see the compiler error output for details."; | ||||
private static final String JAVAC16 = "javac1.6"; | |||||
private static final String JAVAC15 = "javac1.5"; | private static final String JAVAC15 = "javac1.5"; | ||||
private static final String JAVAC14 = "javac1.4"; | private static final String JAVAC14 = "javac1.4"; | ||||
private static final String JAVAC13 = "javac1.3"; | private static final String JAVAC13 = "javac1.3"; | ||||
@@ -126,6 +127,8 @@ public class Javac extends MatchingTask { | |||||
return JAVAC14; | return JAVAC14; | ||||
} else if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5)) { | } else if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5)) { | ||||
return JAVAC15; | return JAVAC15; | ||||
} else if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_6)) { | |||||
return JAVAC16; | |||||
} else { | } else { | ||||
return CLASSIC; | return CLASSIC; | ||||
} | } | ||||
@@ -167,10 +170,10 @@ public class Javac extends MatchingTask { | |||||
* Value of the -source command-line switch; will be ignored | * Value of the -source command-line switch; will be ignored | ||||
* by all implementations except modern and jikes. | * by all implementations except modern and jikes. | ||||
* | * | ||||
* 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 and 1.5 - by default, no -source argument | |||||
* will be used at all. | |||||
* 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. | |||||
* | * | ||||
* @param v Value to assign to source. | * @param v Value to assign to source. | ||||
*/ | */ | ||||
@@ -573,7 +576,7 @@ public class Javac extends MatchingTask { | |||||
/** | /** | ||||
* Sets the target VM that the classes will be compiled for. Valid | * Sets the target VM that the classes will be compiled for. Valid | ||||
* values depend on the compiler, for jdk 1.4 the valid values are | * values depend on the compiler, for jdk 1.4 the valid values are | ||||
* "1.1", "1.2", "1.3", "1.4" and "1.5". | |||||
* "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "5" and "6". | |||||
* @param target the target VM | * @param target the target VM | ||||
*/ | */ | ||||
public void setTarget(String target) { | public void setTarget(String target) { | ||||
@@ -735,7 +738,8 @@ public class Javac extends MatchingTask { | |||||
} | } | ||||
private String getAltCompilerName(String anImplementation) { | private String getAltCompilerName(String anImplementation) { | ||||
if (JAVAC15.equalsIgnoreCase(anImplementation) | |||||
if (JAVAC16.equalsIgnoreCase(anImplementation) | |||||
|| JAVAC15.equalsIgnoreCase(anImplementation) | |||||
|| JAVAC14.equalsIgnoreCase(anImplementation) | || JAVAC14.equalsIgnoreCase(anImplementation) | ||||
|| JAVAC13.equalsIgnoreCase(anImplementation)) { | || JAVAC13.equalsIgnoreCase(anImplementation)) { | ||||
return MODERN; | return MODERN; | ||||
@@ -746,7 +750,8 @@ public class Javac extends MatchingTask { | |||||
} | } | ||||
if (MODERN.equalsIgnoreCase(anImplementation)) { | if (MODERN.equalsIgnoreCase(anImplementation)) { | ||||
String nextSelected = assumedJavaVersion(); | String nextSelected = assumedJavaVersion(); | ||||
if (JAVAC15.equalsIgnoreCase(nextSelected) | |||||
if (JAVAC16.equalsIgnoreCase(nextSelected) | |||||
|| JAVAC15.equalsIgnoreCase(nextSelected) | |||||
|| JAVAC14.equalsIgnoreCase(nextSelected) | || JAVAC14.equalsIgnoreCase(nextSelected) | ||||
|| JAVAC13.equalsIgnoreCase(nextSelected)) { | || JAVAC13.equalsIgnoreCase(nextSelected)) { | ||||
return nextSelected; | return nextSelected; | ||||
@@ -854,12 +859,14 @@ public class Javac extends MatchingTask { | |||||
* Is the compiler implementation a jdk compiler | * Is the compiler implementation a jdk compiler | ||||
* | * | ||||
* @param compilerImpl the name of the compiler implementation | * @param compilerImpl the name of the compiler implementation | ||||
* @return true if compilerImpl is "modern", "classic", "javac1.1", | |||||
* "javac1.2", "javac1.3", "javac1.4" or "javac1.5". | |||||
* @return true if compilerImpl is "modern", "classic", | |||||
* "javac1.1", "javac1.2", "javac1.3", "javac1.4", "javac1.5" or | |||||
* "javac1.6". | |||||
*/ | */ | ||||
protected boolean isJdkCompiler(String compilerImpl) { | protected boolean isJdkCompiler(String compilerImpl) { | ||||
return MODERN.equals(compilerImpl) | return MODERN.equals(compilerImpl) | ||||
|| CLASSIC.equals(compilerImpl) | || CLASSIC.equals(compilerImpl) | ||||
|| JAVAC16.equals(compilerImpl) | |||||
|| JAVAC15.equals(compilerImpl) | || JAVAC15.equals(compilerImpl) | ||||
|| JAVAC14.equals(compilerImpl) | || JAVAC14.equals(compilerImpl) | ||||
|| JAVAC13.equals(compilerImpl) | || JAVAC13.equals(compilerImpl) | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
* Copyright 2001-2005 The Apache Software Foundation | |||||
* Copyright 2001-2006 The Apache Software Foundation | |||||
* | * | ||||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
@@ -322,7 +322,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
} else { | } else { | ||||
cmd.createArgument().setValue(source); | cmd.createArgument().setValue(source); | ||||
} | } | ||||
} else if (assumeJava15() && attributes.getTarget() != null) { | |||||
} else if ((assumeJava15() || assumeJava16()) | |||||
&& attributes.getTarget() != null) { | |||||
String t = attributes.getTarget(); | String t = attributes.getTarget(); | ||||
if (t.equals("1.1") || t.equals("1.2") || t.equals("1.3") | if (t.equals("1.1") || t.equals("1.2") || t.equals("1.3") | ||||
|| t.equals("1.4")) { | || t.equals("1.4")) { | ||||
@@ -334,7 +335,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
attributes.log("", Project.MSG_WARN); | attributes.log("", Project.MSG_WARN); | ||||
attributes.log(" WARNING", Project.MSG_WARN); | attributes.log(" WARNING", Project.MSG_WARN); | ||||
attributes.log("", Project.MSG_WARN); | attributes.log("", Project.MSG_WARN); | ||||
attributes.log("The -source switch defaults to 1.5 in JDK 1.5.", | |||||
attributes.log("The -source switch defaults to 1.5 in JDK 1.5 and 1.6.", | |||||
Project.MSG_WARN); | Project.MSG_WARN); | ||||
attributes.log("If you specify -target " + t | attributes.log("If you specify -target " + t | ||||
+ " you now must also specify -source " + s | + " you now must also specify -source " + s | ||||
@@ -590,6 +591,21 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
&& JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5)); | && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5)); | ||||
} | } | ||||
/** | |||||
* Shall we assume JDK 1.6 command line switches? | |||||
* @return true if JDK 1.6 | |||||
* @since Ant 1.7 | |||||
*/ | |||||
protected boolean assumeJava16() { | |||||
return "javac1.6".equals(attributes.getCompilerVersion()) | |||||
|| ("classic".equals(attributes.getCompilerVersion()) | |||||
&& JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_6)) | |||||
|| ("modern".equals(attributes.getCompilerVersion()) | |||||
&& JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_6)) | |||||
|| ("extJavac".equals(attributes.getCompilerVersion()) | |||||
&& JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_6)); | |||||
} | |||||
/** | /** | ||||
* Combines a user specified bootclasspath with the system | * Combines a user specified bootclasspath with the system | ||||
* bootclasspath taking build.sysclasspath into account. | * bootclasspath taking build.sysclasspath into account. | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
* Copyright 2002-2005 The Apache Software Foundation | |||||
* Copyright 2002-2006 The Apache Software Foundation | |||||
* | * | ||||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
@@ -66,6 +66,8 @@ public final class JavaEnvUtils { | |||||
public static final String JAVA_1_4 = "1.4"; | public static final String JAVA_1_4 = "1.4"; | ||||
/** Version constant for Java 1.5 */ | /** Version constant for Java 1.5 */ | ||||
public static final String JAVA_1_5 = "1.5"; | public static final String JAVA_1_5 = "1.5"; | ||||
/** Version constant for Java 1.6 */ | |||||
public static final String JAVA_1_6 = "1.6"; | |||||
/** Whether this is the Kaffe VM */ | /** Whether this is the Kaffe VM */ | ||||
private static boolean kaffeDetected; | private static boolean kaffeDetected; | ||||
@@ -102,6 +104,9 @@ public final class JavaEnvUtils { | |||||
Class.forName("java.lang.Readable"); | Class.forName("java.lang.Readable"); | ||||
javaVersion = JAVA_1_5; | javaVersion = JAVA_1_5; | ||||
javaVersionNumber++; | javaVersionNumber++; | ||||
Class.forName("java.util.Service"); | |||||
javaVersion = JAVA_1_6; | |||||
javaVersionNumber++; | |||||
} catch (Throwable t) { | } catch (Throwable t) { | ||||
// swallow as we've hit the max class version that | // swallow as we've hit the max class version that | ||||
// we have | // we have | ||||
@@ -284,6 +289,7 @@ public final class JavaEnvUtils { | |||||
private static void buildJrePackages() { | private static void buildJrePackages() { | ||||
jrePackages = new Vector(); | jrePackages = new Vector(); | ||||
switch(javaVersionNumber) { | switch(javaVersionNumber) { | ||||
case 16: | |||||
case 15: | case 15: | ||||
//In Java1.5, the apache stuff moved. | //In Java1.5, the apache stuff moved. | ||||
jrePackages.addElement("com.sun.org.apache"); | jrePackages.addElement("com.sun.org.apache"); | ||||
@@ -333,6 +339,7 @@ public final class JavaEnvUtils { | |||||
Vector tests = new Vector(); | Vector tests = new Vector(); | ||||
tests.addElement("java.lang.Object"); | tests.addElement("java.lang.Object"); | ||||
switch(javaVersionNumber) { | switch(javaVersionNumber) { | ||||
case 16: | |||||
case 15: | case 15: | ||||
tests.addElement("com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl "); | tests.addElement("com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl "); | ||||
case 14: | case 14: | ||||