Path: blob/master/test/functional/Java16andUp/build.xml
6000 views
<?xml version="1.0"?>1<!--2Copyright (c) 2021, 2022 IBM Corp. and others34This program and the accompanying materials are made available under5the terms of the Eclipse Public License 2.0 which accompanies this6distribution and is available at https://www.eclipse.org/legal/epl-2.0/7or the Apache License, Version 2.0 which accompanies this distribution and8is available at https://www.apache.org/licenses/LICENSE-2.0.910This Source Code may also be made available under the following11Secondary Licenses when the conditions for such availability set12forth in the Eclipse Public License, v. 2.0 are satisfied: GNU13General Public License, version 2 with the GNU Classpath14Exception [1] and GNU General Public License, version 2 with the15OpenJDK Assembly Exception [2].1617[1] https://www.gnu.org/software/classpath/license.html18[2] http://openjdk.java.net/legal/assembly-exception.html1920SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception21-->22<project name="Java16AndUp" default="build" basedir=".">23<taskdef resource='net/sf/antcontrib/antlib.xml' />24<description>25Tests for Java 16 and up26</description>2728<!-- set global properties for this build -->29<property name="DEST" value="${BUILD_ROOT}/functional/Java16andUp" />3031<!--Properties for this particular build-->32<property name="src" location="src" />33<property name="build" location="bin" />34<property name="module_src_root" location="modules" />35<property name="module_bin_root" location="module_bin" />36<property name="dest_module_bin" location="${DEST}/module_bin" />37<property name="TestUtilities" location="../TestUtilities/src"/>38<property name="LIB" value="asm,testng,jcommander" />39<import file="${TEST_ROOT}/TKG/scripts/getDependencies.xml" />4041<if>42<equals arg1="${JDK_VERSION}" arg2="16" />43<then>44<!-- Java APIs of JEP389 and related features in Java 16 is incompatible with the APIs in Java17 and beyond -->45<property name="src_160" value="src_160" />46</then>47<else>48<property name="src_160" value="" />49</else>50</if>5152<target name="init">53<mkdir dir="${DEST}" />54<mkdir dir="${build}" />55</target>5657<property name="MODULE_NAME_ROOT" value="org.openj9test.modularity" />58<property name="MODULE_PATH_ROOT" value="org/openj9/test/modularity" />5960<target name="compile_modules" depends="init" description="Create the base modules for the sealed classes">61<mkdir dir="${module_bin_root}" />62<copy file="${LIB_DIR}/testng.jar" todir="${module_bin_root}" />63<copy file="${LIB_DIR}/jcommander.jar" todir="${module_bin_root}" />64<copy file="${LIB_DIR}/asm.jar" todir="${module_bin_root}" />65<for list="moduleX,moduleY" param="mod">66<sequential>67<var name="module_src_dir" value="${module_src_root}/${MODULE_NAME_ROOT}.@{mod}" />68<var name="module_bin_dir" value="${module_bin_root}/${MODULE_NAME_ROOT}.@{mod}" />69<mkdir dir="${module_bin_dir}" />70<var name="modpath" value="--module-path ${module_bin_root} -d ${module_bin_dir}" />71<javac srcdir="${module_src_dir}"72destdir="${module_bin_dir}"73includes="org/openj9/test/modularity/**,org/openj9/test/util/VersionCheck.java"74debug="true" fork="true"75executable="${compiler.javac}"76includeAntRuntime="false"77encoding="ISO-8859-1">78<compilerarg line='--add-reads org.openj9test.modularity.@{mod}=ALL-UNNAMED' />79<compilerarg line='--add-exports java.base/jdk.internal.misc=ALL-UNNAMED' />80<compilerarg line='--enable-preview --source ${JDK_VERSION}' />81<compilerarg line="${modpath}" />82<classpath>83<pathelement location="${LIB_DIR}/testng.jar" />84<pathelement location="${LIB_DIR}/jcommander.jar" />85<pathelement location="${LIB_DIR}/asm.jar" />86<pathelement location="${build}" />87</classpath>88</javac>89</sequential>90</for>91</target>9293<target name="compile" depends="init,getDependentLibs" description="Using java ${JDK_VERSION} to compile the source">94<echo>Ant version is ${ant.version}</echo>95<echo>============COMPILER SETTINGS============</echo>96<echo>===fork: yes</echo>97<echo>===executable: ${compiler.javac}</echo>98<echo>===debug: on</echo>99<echo>===destdir: ${DEST}</echo>100101<javac srcdir="${src}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">102<src path="${src}" />103<src path="${src_160}" />104<src path="${TestUtilities}" />105<exclude name="**/modules/**" />106<compilerarg line='--enable-preview --source ${JDK_VERSION}' />107<compilerarg line='--add-modules jdk.incubator.foreign' />108<compilerarg line='--add-opens jdk.incubator.foreign/jdk.internal.foreign=ALL-UNNAMED' />109<compilerarg line='--add-exports java.base/jdk.internal.misc=ALL-UNNAMED' />110<compilerarg line='--add-opens java.base/jdk.internal.misc=ALL-UNNAMED' />111<compilerarg line='--add-opens java.base/java.lang=ALL-UNNAMED' />112<classpath>113<pathelement location="${LIB_DIR}/testng.jar" />114<pathelement location="${LIB_DIR}/jcommander.jar" />115<pathelement location="${LIB_DIR}/asm.jar" />116<pathelement location="${build}" />117</classpath>118</javac>119</target>120121<target name="dist" depends="compile,compile_modules" description="generate the distribution">122<echo>copy ${module_bin_root} to ${dest_module_bin}</echo>123<mkdir dir="${dest_module_bin}" />124<copy todir="${dest_module_bin}">125<fileset dir="${module_bin_root}" />126</copy>127<mkdir dir="${DEST}" />128<jar jarfile="${DEST}/GeneralTest.jar" filesonly="true">129<fileset dir="${build}" />130<fileset dir="${dest_module_bin}" />131<fileset dir="${src}/../" includes="*.properties,*.xml" />132</jar>133<copy file="${DEST}/GeneralTest.jar" todir="${dest_module_bin}" />134<copy todir="${DEST}">135<fileset dir="${src}/../" includes="*.xml" />136<fileset dir="${src}/../" includes="*.mk" />137</copy>138</target>139140<target name="build">141<if>142<and>143<or>144<!-- Exclude the tests for other impls, issue: https://github.com/eclipse-openj9/openj9/issues/14028#issuecomment-988225623 -->145<equals arg1="${JDK_IMPL}" arg2="ibm" />146<equals arg1="${JDK_IMPL}" arg2="openj9" />147</or>148<not>149<matches string="${JDK_VERSION}" pattern="^(8|9|10|11|12|13|14|15)$$" />150</not>151</and>152<then>153<antcall target="clean" inheritall="true" />154</then>155</if>156</target>157158<target name="clean" depends="dist" description="clean up">159<delete dir="${build}" />160<delete dir="${module_bin_root}" />161</target>162</project>163164165