summaryrefslogtreecommitdiff
path: root/build.xml
diff options
context:
space:
mode:
authorJaikiran Pai <jaikiran@apache.org>2019-06-04 09:55:38 +0530
committerJaikiran Pai <jaikiran@apache.org>2019-08-03 17:36:47 +0530
commite95251b3b5672fe1d2ad9fe7b8de08f69bc7b1e5 (patch)
treea2723b0218fd4192b79763766e967ed7811e2d19 /build.xml
parente3eb039ab638735390b3eff361ae06654f95b03c (diff)
downloadant-e95251b3b5672fe1d2ad9fe7b8de08f69bc7b1e5.tar.gz
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-038c8a1a0045@apache.org%3e
Diffstat (limited to 'build.xml')
-rw-r--r--build.xml121
1 files changed, 73 insertions, 48 deletions
diff --git a/build.xml b/build.xml
index 358765f52..216296328 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"/>