ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1587161 - in /ant/core/trunk/src: main/org/apache/tools/ant/taskdefs/compilers/ tests/antunit/ tests/antunit/taskdefs/ tests/junit/org/apache/tools/ant/taskdefs/ tests/junit/org/apache/tools/ant/taskdefs/compilers/
Date Mon, 14 Apr 2014 08:10:52 GMT
Author: jhm
Date: Mon Apr 14 08:10:51 2014
New Revision: 1587161

URL: http://svn.apache.org/r1587161
Log:
more Java9 stuff
- create the CompilerAdapter for J9
- tests of source and target 
- add detection of J9 to antunit-base.xml

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
    ant/core/trunk/src/tests/antunit/antunit-base.xml
    ant/core/trunk/src/tests/antunit/taskdefs/javac-test.xml
    ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java
    ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java?rev=1587161&r1=1587160&r2=1587161&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
Mon Apr 14 08:10:51 2014
@@ -121,7 +121,8 @@ public final class CompilerAdapterFactor
                 || compilerType.equalsIgnoreCase("javac1.5")
                 || compilerType.equalsIgnoreCase("javac1.6")
                 || compilerType.equalsIgnoreCase("javac1.7")
-                || compilerType.equalsIgnoreCase("javac1.8")) {
+                || compilerType.equalsIgnoreCase("javac1.8")
+                || compilerType.equalsIgnoreCase("javac1.9")) {
                 // does the modern compiler exist?
                 if (doesModernCompilerExist()) {
                     return new Javac13();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java?rev=1587161&r1=1587160&r2=1587161&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
Mon Apr 14 08:10:51 2014
@@ -606,6 +606,15 @@ public abstract class DefaultCompilerAda
     }
 
     /**
+     * Shall we assume JDK 1.9 command line switches?
+     * @return true if JDK 1.9
+     * @since Ant 1.9.4
+     */
+    protected boolean assumeJava19() {
+        return assumeJavaXY("javac1.9", JavaEnvUtils.JAVA_1_8);
+    }
+
+    /**
      * Shall we assume command line switches for the given version of Java?
      * @since Ant 1.8.3
      */

Modified: ant/core/trunk/src/tests/antunit/antunit-base.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/antunit-base.xml?rev=1587161&r1=1587160&r2=1587161&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/antunit-base.xml (original)
+++ ant/core/trunk/src/tests/antunit/antunit-base.xml Mon Apr 14 08:10:51 2014
@@ -27,6 +27,9 @@
   <property name="test3.jar" location="${antunit.tmpdir}/test3.jar"/>
   <property name="test4.jar" location="${antunit.tmpdir}/test4.jar"/>
   <property name="test5.jar" location="${antunit.tmpdir}/test5.jar"/>
+  <condition property="jdk1.9+">
+    <contains string="${java.version}" substring="1.9."/>
+  </condition>
   <available property="jdk1.8+" classname="java.lang.reflect.Executable"/>
   <available property="jdk1.7+" classname="java.nio.file.FileSystem"/>
   <available property="jdk1.6+" classname="java.net.CookieStore"/>

Modified: ant/core/trunk/src/tests/antunit/taskdefs/javac-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/javac-test.xml?rev=1587161&r1=1587160&r2=1587161&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/javac-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/javac-test.xml Mon Apr 14 08:10:51 2014
@@ -197,4 +197,116 @@ public class Adapter implements Compiler
     </javac>
     <au:assertLogContains text="adapter called" />
   </target>
+
+  <target name="testSourceAttributes" xmlns:if="ant:if">
+    <delete dir="${javac-dir}/src" />
+    <mkdir dir="${javac-dir}/src" />
+    <mkdir dir="${javac-dir}/classes" />
+    <echo file="${javac-dir}/src/A.java">
+      public class A { }
+    </echo>
+  	<presetdef name="testJavac">
+      <javac srcdir="${javac-dir}/src" destdir="${javac-dir}/classes" includeantruntime="false"/>
 	    
+  	</presetdef>
+
+    <au:expectfailure>
+      <testJavac source="notValid"/>
+    </au:expectfailure>
+  	
+  	<echo>JDK 1.4+</echo>
+    <testJavac source="1.4"/>
+    <delete dir="${javac-dir}/classes"/>
+    <mkdir dir="${javac-dir}/classes"/>
+  	
+  	<sequential if:set="jdk1.5+">
+      <echo>JDK 1.5+</echo>
+      <testJavac source="1.5"/>
+      <delete dir="${javac-dir}/classes"/>
+      <mkdir dir="${javac-dir}/classes"/>
+  	</sequential>
+    
+  	<sequential if:set="jdk1.6+">
+      <echo>JDK 1.6+</echo>
+      <testJavac source="1.6"/>
+      <delete dir="${javac-dir}/classes"/>
+      <mkdir dir="${javac-dir}/classes"/>
+  	</sequential>
+  		
+  	<sequential if:set="jdk1.7+">
+      <echo>JDK 1.7+</echo>
+      <testJavac source="1.7"/>
+      <delete dir="${javac-dir}/classes"/>
+      <mkdir dir="${javac-dir}/classes"/>
+  	</sequential>
+    
+    <sequential if:set="jdk1.8+">
+      <echo>JDK 1.8+</echo>
+      <testJavac source="1.8"/>
+      <delete dir="${javac-dir}/classes"/>
+      <mkdir dir="${javac-dir}/classes"/>
+    </sequential>
+            
+    <sequential if:set="jdk1.9+">
+      <echo>JDK 1.9+</echo>
+      <testJavac source="1.9"/>
+      <delete dir="${javac-dir}/classes"/>
+      <mkdir dir="${javac-dir}/classes"/>
+    </sequential>
+  </target>	
+	
+  <target name="testTargetAttributes" xmlns:if="ant:if">
+    <delete dir="${javac-dir}/src" />
+    <mkdir dir="${javac-dir}/src" />
+    <mkdir dir="${javac-dir}/classes" />
+    <echo file="${javac-dir}/src/A.java">
+      public class A { }
+    </echo>
+    <presetdef name="testJavac">
+      <javac srcdir="${javac-dir}/src" destdir="${javac-dir}/classes" includeantruntime="false"/>
      
+    </presetdef>
+
+    <au:expectfailure>
+      <testJavac target="notValid"/>
+    </au:expectfailure>
+
+    <echo>JDK 1.4+</echo>
+    <testJavac source="1.4" target="1.4"/>
+    <delete dir="${javac-dir}/classes"/>
+    <mkdir dir="${javac-dir}/classes"/>
+  	
+    <sequential if:set="jdk1.5+">
+      <echo>JDK 1.5+</echo>
+      <testJavac source="1.5" target="1.5"/>
+      <delete dir="${javac-dir}/classes"/>
+      <mkdir dir="${javac-dir}/classes"/>
+    </sequential>
+    
+    <sequential if:set="jdk1.6+">
+      <echo>JDK 1.6+</echo>
+      <testJavac source="1.6" target="1.6"/>
+      <delete dir="${javac-dir}/classes"/>
+      <mkdir dir="${javac-dir}/classes"/>
+    </sequential>
+        
+    <sequential if:set="jdk1.7+">
+      <echo>JDK 1.7+</echo>
+      <testJavac source="1.7" target="1.7"/>
+      <delete dir="${javac-dir}/classes"/>
+      <mkdir dir="${javac-dir}/classes"/>
+    </sequential>
+    
+    <sequential if:set="jdk1.8+">
+      <echo>JDK 1.8+</echo>
+      <testJavac source="1.8" target="1.8"/>
+      <delete dir="${javac-dir}/classes"/>
+      <mkdir dir="${javac-dir}/classes"/>
+    </sequential>
+            
+    <sequential if:set="jdk1.9+">
+      <echo>JDK 1.9+</echo>
+      <testJavac source="1.9" target="1.9"/>
+      <delete dir="${javac-dir}/classes"/>
+      <mkdir dir="${javac-dir}/classes"/>
+    </sequential>
+  </target> 
 </project>

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java?rev=1587161&r1=1587160&r2=1587161&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java Mon Apr 14
08:10:51 2014
@@ -18,13 +18,21 @@
 
 package org.apache.tools.ant.taskdefs;
 
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import junit.framework.TestCase;
+
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter;
 import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory;
 import org.apache.tools.ant.taskdefs.compilers.Javac13;
 import org.apache.tools.ant.taskdefs.compilers.JavacExternal;
-
-import junit.framework.TestCase;
+import org.apache.tools.ant.types.Path;
 
 /**
  * Testcase for <javac>.

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java?rev=1587161&r1=1587160&r2=1587161&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
(original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
Mon Apr 14 08:10:51 2014
@@ -133,6 +133,36 @@ public class DefaultCompilerAdapterTest 
         testSource(null, "javac1.8", "", "8");
     }
 
+    public void testImplicitSourceForJava19() {
+        commonSourceDowngrades("javac1.9");
+        testSource("1.5", "javac1.9",
+                   "If you specify -target 1.5 you now must also specify"
+                   + " -source 1.5", "1.5");
+        testSource("1.6", "javac1.9",
+                   "If you specify -target 1.6 you now must also specify"
+                   + " -source 1.6", "1.6");
+        testSource("1.7", "javac1.9",
+                   "If you specify -target 1.7 you now must also specify"
+                   + " -source 1.7", "1.7");
+        testSource("1.8", "javac1.9",
+                "If you specify -target 1.8 you now must also specify"
+                + " -source 1.8", "1.8");
+        testSource("5", "javac1.9",
+                   "If you specify -target 5 you now must also specify"
+                   + " -source 5", "5");
+        testSource("6", "javac1.9",
+                   "If you specify -target 6 you now must also specify"
+                   + " -source 6", "6");
+        testSource("7", "javac1.9",
+                   "If you specify -target 7 you now must also specify"
+                   + " -source 7", "7");
+        testSource("8", "javac1.9",
+                "If you specify -target 8 you now must also specify"
+                + " -source 8", "8");
+        testSource(null, "javac1.9", "", "1.8");
+        testSource(null, "javac1.9", "", "8");
+    }
+
     private void commonSourceDowngrades(String javaVersion) {
         testSource("1.3", javaVersion,
                    "If you specify -target 1.1 you now must also specify"



Mime
View raw message