Browse Source

preliminary Mustang support

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@382927 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 19 years ago
parent
commit
b1c63b2dee
5 changed files with 49 additions and 17 deletions
  1. +1
    -0
      build.xml
  2. +4
    -3
      docs/manual/CoreTasks/javac.html
  3. +17
    -10
      src/main/org/apache/tools/ant/taskdefs/Javac.java
  4. +19
    -3
      src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  5. +8
    -1
      src/main/org/apache/tools/ant/util/JavaEnvUtils.java

+ 1
- 0
build.xml View File

@@ -398,6 +398,7 @@
<available property="jdk1.3+" classname="java.lang.StrictMath"/>
<available property="jdk1.4+" classname="java.lang.CharSequence"/>
<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="bsf.present"
classname="org.apache.bsf.BSFManager"


+ 4
- 3
docs/manual/CoreTasks/javac.html View File

@@ -53,10 +53,11 @@ attribute are:</a></p>
<li><code>classic</code> (the standard compiler of JDK 1.1/1.2) &ndash;
<code>javac1.1</code> and
<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) &ndash;
<li><code>modern</code> (the standard compiler of JDK 1.3/1.4/1.5/1.6) &ndash;
<code>javac1.3</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
href="http://jikes.sourceforge.net/" target="_top">Jikes</a>
compiler).</li>
@@ -613,7 +614,7 @@ while all others are <code>false</code>.</p>
<code>&lt;javac&gt;</code>.</p>

<hr>
<p align="center">Copyright &copy; 2000-2005 The Apache Software Foundation.
<p align="center">Copyright &copy; 2000-2006 The Apache Software Foundation.
All rights Reserved.</p>

</body>


+ 17
- 10
src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -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");
* 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
= "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 JAVAC14 = "javac1.4";
private static final String JAVAC13 = "javac1.3";
@@ -126,6 +127,8 @@ public class Javac extends MatchingTask {
return JAVAC14;
} else if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5)) {
return JAVAC15;
} else if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_6)) {
return JAVAC16;
} else {
return CLASSIC;
}
@@ -167,10 +170,10 @@ public class Javac extends MatchingTask {
* Value of the -source command-line switch; will be ignored
* 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.
*/
@@ -573,7 +576,7 @@ public class Javac extends MatchingTask {
/**
* 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
* "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
*/
public void setTarget(String target) {
@@ -735,7 +738,8 @@ public class Javac extends MatchingTask {
}

private String getAltCompilerName(String anImplementation) {
if (JAVAC15.equalsIgnoreCase(anImplementation)
if (JAVAC16.equalsIgnoreCase(anImplementation)
|| JAVAC15.equalsIgnoreCase(anImplementation)
|| JAVAC14.equalsIgnoreCase(anImplementation)
|| JAVAC13.equalsIgnoreCase(anImplementation)) {
return MODERN;
@@ -746,7 +750,8 @@ public class Javac extends MatchingTask {
}
if (MODERN.equalsIgnoreCase(anImplementation)) {
String nextSelected = assumedJavaVersion();
if (JAVAC15.equalsIgnoreCase(nextSelected)
if (JAVAC16.equalsIgnoreCase(nextSelected)
|| JAVAC15.equalsIgnoreCase(nextSelected)
|| JAVAC14.equalsIgnoreCase(nextSelected)
|| JAVAC13.equalsIgnoreCase(nextSelected)) {
return nextSelected;
@@ -854,12 +859,14 @@ public class Javac extends MatchingTask {
* Is the compiler implementation a jdk compiler
*
* @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) {
return MODERN.equals(compilerImpl)
|| CLASSIC.equals(compilerImpl)
|| JAVAC16.equals(compilerImpl)
|| JAVAC15.equals(compilerImpl)
|| JAVAC14.equals(compilerImpl)
|| JAVAC13.equals(compilerImpl)


+ 19
- 3
src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -322,7 +322,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter {
} else {
cmd.createArgument().setValue(source);
}
} else if (assumeJava15() && attributes.getTarget() != null) {
} else if ((assumeJava15() || assumeJava16())
&& attributes.getTarget() != null) {
String t = attributes.getTarget();
if (t.equals("1.1") || t.equals("1.2") || t.equals("1.3")
|| t.equals("1.4")) {
@@ -334,7 +335,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter {
attributes.log("", Project.MSG_WARN);
attributes.log(" WARNING", 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);
attributes.log("If you specify -target " + t
+ " you now must also specify -source " + s
@@ -590,6 +591,21 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter {
&& 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
* bootclasspath taking build.sysclasspath into account.


+ 8
- 1
src/main/org/apache/tools/ant/util/JavaEnvUtils.java View File

@@ -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");
* 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";
/** Version constant for Java 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 */
private static boolean kaffeDetected;
@@ -102,6 +104,9 @@ public final class JavaEnvUtils {
Class.forName("java.lang.Readable");
javaVersion = JAVA_1_5;
javaVersionNumber++;
Class.forName("java.util.Service");
javaVersion = JAVA_1_6;
javaVersionNumber++;
} catch (Throwable t) {
// swallow as we've hit the max class version that
// we have
@@ -284,6 +289,7 @@ public final class JavaEnvUtils {
private static void buildJrePackages() {
jrePackages = new Vector();
switch(javaVersionNumber) {
case 16:
case 15:
//In Java1.5, the apache stuff moved.
jrePackages.addElement("com.sun.org.apache");
@@ -333,6 +339,7 @@ public final class JavaEnvUtils {
Vector tests = new Vector();
tests.addElement("java.lang.Object");
switch(javaVersionNumber) {
case 16:
case 15:
tests.addElement("com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl ");
case 14:


Loading…
Cancel
Save