This is an automated email from the ASF dual-hosted git repository.

jaikiran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git


The following commit(s) were added to refs/heads/master by this push:
     new e95251b  Separate out the compilation for classes that need JDK9+, 
from the regular compilation and set the --release to 8 for the regular 
compilation target
e95251b is described below

commit e95251b3b5672fe1d2ad9fe7b8de08f69bc7b1e5
Author: Jaikiran Pai <jaiki...@apache.org>
AuthorDate: Tue Jun 4 09:55:38 2019 +0530

    Separate out the compilation for classes that need JDK9+, from the regular 
compilation and set the --release to 8 for the regular compilation target
    
    Mail discussion reference 
https://mail-archives.apache.org/mod_mbox/ant-dev/201905.mbox/%3c10b1ea11-5ac7-df66-c020-038c8a1a0...@apache.org%3e
---
 build.xml | 121 +++++++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 73 insertions(+), 48 deletions(-)

diff --git a/build.xml b/build.xml
index 358765f..2162963 100644
--- a/build.xml
+++ b/build.xml
@@ -106,6 +106,7 @@
   <property name="optimize" value="true"/>
   <property name="javac.target" value="1.8"/>
   <property name="javac.source" value="1.8"/>
+  <property name="javac.release" value="8"/>
   <property name="junit.filtertrace" value="off"/>
   <property name="junit.summary" value="no"/>
   <property name="test.haltonfailure" value="false"/>
@@ -594,12 +595,67 @@
          Build the code
        ===================================================================
   -->
-  <target name="build" depends="prepare"
+  <target name="build" depends="prepare, compile, compile-jdk9+"
           description="--> compiles the source code">
-    <mkdir dir="${build.dir}"/>
-    <mkdir dir="${build.classes}"/>
-    <mkdir dir="${build.lib}"/>
 
+    <!-- Builds and verifies that the classes belonging in the confined 
package of
+    junitlauncher task do not depend on classes they aren't meant to -->
+    <!-- first wipe out the "confined" package that might have been built 
already
+     due to the javac above -->
+    <delete 
dir="${build.classes}/${optional.package}/junitlauncher/confined/"/>
+    <javac srcdir="${java.dir}"
+           includeantruntime="false"
+           destdir="${build.classes}"
+           debug="${debug}"
+           deprecation="${deprecation}"
+           includes="${optional.package}/junitlauncher/confined/**"
+           target="${javac.target}"
+           source="${javac.source}"
+           release="${javac.release}"
+           optimize="${optimize}">
+      <classpath>
+        <!-- A very limited classpath which only doesn't include optional 
libraries,
+         which the classes in confined package aren't meant to depend on -->
+        <fileset dir="${build.classes}">
+          <!-- exclude the 
org/apache/tools/ant/taskdefs/optional/junitlauncher package
+          from the classpath, since the confined package isn't meant to depend 
on
+          classes in this package -->
+          <exclude 
name="org/apache/tools/ant/taskdefs/optional/junitlauncher/*"/>
+        </fileset>
+      </classpath>
+
+    </javac>
+
+    <copy todir="${build.classes}">
+      <fileset dir="${java.dir}">
+        <include name="**/*.properties"/>
+        <include name="**/*.dtd"/>
+        <include name="**/*.xml"/>
+      </fileset>
+      <fileset dir="${resource.dir}"/>
+    </copy>
+
+    <copy todir="${build.classes}"
+      overwrite="true" encoding="UTF-8">
+      <fileset dir="${java.dir}">
+        <include name="**/version.txt"/>
+        <include name="**/defaultManifest.mf"/>
+      </fileset>
+      <filterchain refid="ant.filters"/>
+    </copy>
+
+    <copy todir="${build.classes}/${optional.package}/junit/xsl">
+      <fileset dir="${etc.dir}">
+        <include name="junit-frames.xsl"/>
+        <include name="junit-noframes.xsl"/>
+        <include name="junit-frames-saxon.xsl"/>
+        <include name="junit-noframes-saxon.xsl"/>
+      </fileset>
+    </copy>
+  </target>
+
+  <target name="compile" depends="prepare">
+    <mkdir dir="${build.classes}"/>
     <javac srcdir="${java.dir}"
            includeantruntime="false"
            destdir="${build.classes}"
@@ -608,13 +664,14 @@
            excludes="${optional.package}/junitlauncher/confined/**"
            target="${javac.target}"
            source="${javac.source}"
+           release="${javac.release}"
            optimize="${optimize}">
       <classpath refid="classpath"/>
 
       <selector id="conditional-patterns">
         <not>
           <or>
-            <selector refid="needs.jdk9+" unless="jdk9+"/>
+            <selector refid="needs.jdk9+"/>
             <selector refid="not.in.kaffe" if="kaffe"/>
             <selector refid="needs.apache-resolver" 
unless="apache.resolver.present"/>
             <selector refid="needs.junit" unless="junit.present"/> <!-- TODO 
should perhaps use -source 1.4? -->
@@ -645,60 +702,27 @@
         </not>
       </selector>
     </javac>
+  </target>
+
+  <target name="compile-jdk9+" depends="prepare" if="jdk9+">
+    <mkdir dir="${build.classes}"/>
 
-    <!-- Builds and verifies that the classes belonging in the confined 
package of
-    junitlauncher task do not depend on classes they aren't meant to -->
-    <!-- first wipe out the "confined" package that might have been built 
already
-     due to the javac above -->
-    <delete 
dir="${build.classes}/${optional.package}/junitlauncher/confined/"/>
     <javac srcdir="${java.dir}"
            includeantruntime="false"
            destdir="${build.classes}"
            debug="${debug}"
            deprecation="${deprecation}"
-           includes="${optional.package}/junitlauncher/confined/**"
            target="${javac.target}"
            source="${javac.source}"
            optimize="${optimize}">
-      <classpath>
-        <!-- A very limited classpath which only doesn't include optional 
libraries,
-         which the classes in confined package aren't meant to depend on -->
-        <fileset dir="${build.classes}">
-          <!-- exclude the 
org/apache/tools/ant/taskdefs/optional/junitlauncher package
-          from the classpath, since the confined package isn't meant to depend 
on
-          classes in this package -->
-          <exclude 
name="org/apache/tools/ant/taskdefs/optional/junitlauncher/*"/>
-        </fileset>
-      </classpath>
+      <classpath refid="classpath"/>
 
+      <selector id="conditional-patterns-jdk9+">
+          <or>
+            <selector refid="needs.jdk9+"/>
+          </or>
+      </selector>
     </javac>
-
-    <copy todir="${build.classes}">
-      <fileset dir="${java.dir}">
-        <include name="**/*.properties"/>
-        <include name="**/*.dtd"/>
-        <include name="**/*.xml"/>
-      </fileset>
-      <fileset dir="${resource.dir}"/>
-    </copy>
-
-    <copy todir="${build.classes}"
-      overwrite="true" encoding="UTF-8">
-      <fileset dir="${java.dir}">
-        <include name="**/version.txt"/>
-        <include name="**/defaultManifest.mf"/>
-      </fileset>
-      <filterchain refid="ant.filters"/>
-    </copy>
-
-    <copy todir="${build.classes}/${optional.package}/junit/xsl">
-      <fileset dir="${etc.dir}">
-        <include name="junit-frames.xsl"/>
-        <include name="junit-noframes.xsl"/>
-        <include name="junit-frames-saxon.xsl"/>
-        <include name="junit-noframes-saxon.xsl"/>
-      </fileset>
-    </copy>
   </target>
 
   <!--
@@ -1574,6 +1598,7 @@
            debug="${debug}"
            target="${javac.target}"
            source="${javac.source}"
+           release="${javac.release}"
            deprecation="${deprecation}">
       <classpath refid="tests-classpath"/>
 

Reply via email to