Path: blob/master/test/functional/Java8andUp/build.xml
6000 views
<?xml version="1.0"?>1<!--2Copyright (c) 2016, 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="J9 VM Java8andUp General Bucket" default="build" basedir=".">23<taskdef resource="net/sf/antcontrib/antlib.xml" />24<description>25Build J9 VM Java8andUp General Bucket26</description>2728<!-- set global properties for this build -->29<property name="DEST" value="${BUILD_ROOT}/functional/Java8andUp" />3031<!--Properties for this particular build -->32<property name="src" location="src" />33<property name="src_80" location="src_80" />34<property name="src_90" location="src_90" />35<property name="src_110_up" location="src_110_up" />36<property name="scr_DupClassNameTest" location="scr_DupClassNameTest" />37<property name="build" location="bin" />38<property name="build_resource" location="resource" />39<property name="transformerListener" location="${TEST_ROOT}/Utils/src" />40<property name="TestUtilities" location="../TestUtilities/src" />41<property name="TestUtilitiesJ9" location="../TestUtilitiesJ9/src" />42<if>43<equals arg1="${JCL_VERSION}" arg2="current" />44<then>45<property name="src_90_jcl" location="src_90_current" />46<property name="addExports_90_jcl" value="--add-exports java.management/sun.management=ALL-UNNAMED" />47</then>48<else>49<property name="src_90_jcl" location="src_90_latest" />50<property name="addExports_90_jcl" value="--add-exports jdk.management.agent/jdk.internal.agent=ALL-UNNAMED" />51</else>52</if>5354<if>55<equals arg1="${JDK_VERSION}" arg2="8" />56<then>57<property name="src_access" location="${TEST_ROOT}/functional/UnsafeAccess/src" />58</then>59<else>60<if>61<matches string="${JDK_VERSION}" pattern="^1[1-6]$$" />62<then>63<!-- Java 11-16 -->64<property name="src_access" location="${TEST_ROOT}/functional/UnsafeAccess/src_110" />65</then>66<else>67<!-- Java 17+ -->68<property name="src_access" location="${TEST_ROOT}/functional/UnsafeAccess/src_170" />69</else>70</if>71</else>72</if>7374<if>75<matches string="${JDK_VERSION}" pattern="^(9|10)$$" />76<then>77<property name="addModules" value="--add-modules java.se.ee" />78</then>79<else>80<property name="addModules" value="" />81</else>82</if>83<property name="LIB" value="asm_all,javassist,testng,jcommander,commons_cli,jaxb_api,asmtools" />84<import file="${TEST_ROOT}/TKG/scripts/getDependencies.xml" />8586<target name="init">87<mkdir dir="${DEST}" />88<mkdir dir="${build}" />89<mkdir dir="${build_resource}" />90<mkdir dir="${build}/DupClassNameTest" />91<mkdir dir="${build}/DupClassNameTest/version1" />92<mkdir dir="${build}/DupClassNameTest/version2" />93</target>9495<!--compiles the NoSuchMethod test classes. Multiple steps are needed to create classes that call non-existent methods -->96<target name="compileNoSuchMethod" depends="compile" description="compile NoSuchMethod tests in multiple steps">97<property name="NoSuchMethod_src" location="${src}/org/openj9/test/NoSuchMethod" />98<property name="NoSuchMethod_build" location="${build}/org/openj9/test/NoSuchMethod" />99<!-- copy a fake java.lang.string impl and AppLoaderCallee into source folder -->100<copy overwrite="true" file="${NoSuchMethod_src}/java/lang/String.java.hide" tofile="${NoSuchMethod_src}/java/lang/String.java" />101<copy overwrite="true" file="${NoSuchMethod_src}/AppLoaderCallee.java.fake" tofile="${NoSuchMethod_src}/AppLoaderCallee.java" />102<!-- Compile the fake string impl and AppLoader caller with it -->103<if>104<equals arg1="${JDK_VERSION}" arg2="8" />105<then>106<javac srcdir="${NoSuchMethod_src}" destdir="${build}" includes="**/String.java,*AppLoaderCaller2.java" fork="true"107debug="on" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">108<src path="${src_access}" />109<classpath>110<pathelement location="${LIB_DIR}/asm-all.jar" />111<pathelement location="${LIB_DIR}/testng.jar" />112<pathelement location="${LIB_DIR}/jcommander.jar" />113</classpath>114</javac>115</then>116<else>117<javac srcdir="${NoSuchMethod_src}" destdir="${build}" includes="**/String.java,*AppLoaderCaller2.java" fork="true"118debug="on" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">119<compilerarg line ="--patch-module java.base=${NoSuchMethod_src}/java/lang" />120<src path="${src_access}" />121<classpath>122<pathelement location="${LIB_DIR}/asm-all.jar" />123<pathelement location="${LIB_DIR}/testng.jar" />124<pathelement location="${LIB_DIR}/jcommander.jar" />125</classpath>126</javac>127</else>128</if>129<!-- remove our fake java.lang.string impl -->130<delete file="${NoSuchMethod_src}/java/lang/String.java" />131<!-- compile the rest of test code -->132<javac srcdir="${NoSuchMethod_src}" destdir="${build}" excludes="*/java/*,*AppLoaderCaller2.java" fork="true"133debug="on" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">134<src path="${src_access}" />135<classpath>136<pathelement location="${LIB_DIR}/asm-all.jar" />137<pathelement location="${LIB_DIR}/testng.jar" />138<pathelement location="${LIB_DIR}/jcommander.jar" />139</classpath>140</javac>141<!-- un-hide our fake string impl -->142<copy overwrite="true" file="${NoSuchMethod_src}/java/lang/String.java.hide" tofile="${NoSuchMethod_src}/java/lang/String.java" />143<!-- Replace fake AppLoaderCallee impl with real impl -->144<copy overwrite="true" file="${NoSuchMethod_src}/AppLoaderCallee.java.real" tofile="${NoSuchMethod_src}/AppLoaderCallee.java" />145<delete file="${NoSuchMethod_build}/AppLoaderCallee.class" />146<javac srcdir="${NoSuchMethod_src}" destdir="${build}" includes="*AppLoaderCallee.java" fork="true"147debug="on" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">148<src path="${src_access}" />149<classpath>150<pathelement location="${LIB_DIR}/asm-all.jar" />151<pathelement location="${LIB_DIR}/testng.jar" />152<pathelement location="${LIB_DIR}/jcommander.jar" />153</classpath>154</javac>155<delete file="${NoSuchMethod_src}/AppLoaderCallee.java" />156<!-- Restore the source for our fake AppLoaderCallee -->157<copy overwrite="true" file="${NoSuchMethod_src}/AppLoaderCallee.java.fake" tofile="${NoSuchMethod_src}/AppLoaderCallee.java" />158<!-- hide our fake java.lang.string impl -->159<delete file="${NoSuchMethod_src}/java/lang/String.java" />160</target>161162<target name="compile" depends="jasm_generator" description="using java ${JDK_VERSION} to compile the source">163<echo>Ant version is ${ant.version}</echo>164<echo>============COMPILER SETTINGS============</echo>165<echo>===fork: yes</echo>166<echo>===executable: ${compiler.javac}</echo>167<echo>===debug: on</echo>168<echo>===destdir: ${DEST}</echo>169<javac srcdir="${scr_DupClassNameTest}/version1" destdir="${build}/DupClassNameTest/version1" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">170<classpath>171<pathelement location="${LIB_DIR}/testng.jar" />172</classpath>173</javac>174<javac srcdir="${scr_DupClassNameTest}/version2" destdir="${build}/DupClassNameTest/version2" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">175<classpath>176<pathelement location="${LIB_DIR}/testng.jar" />177</classpath>178</javac>179<if>180<equals arg1="${JDK_VERSION}" arg2="8" />181<then>182<javac srcdir="${src}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">183<src path="${src}" />184<src path="${src_80}" />185<src path="${src_access}" />186<src path="${TestUtilities}" />187<src path="${TestUtilitiesJ9}" />188<src path="${transformerListener}" />189<exclude name="**/Cmvc194280.java" />190<exclude name="**/resources/**" />191<!-- requires special compilation methods -->192<exclude name="**/NoSuchMethod/**" />193<classpath>194<pathelement location="${LIB_DIR}/asm-all.jar" />195<pathelement location="${LIB_DIR}/testng.jar" />196<pathelement location="${LIB_DIR}/jcommander.jar" />197<pathelement location="${TEST_JDK_HOME}/lib/tools.jar" />198<pathelement location="${LIB_DIR}/commons-cli.jar" />199<pathelement location="${LIB_DIR}/javassist.jar" />200</classpath>201</javac>202</then>203<elseif>204<matches string="${JDK_VERSION}" pattern="^(9|10)$$" />205<then>206<property name="addExports" value="--add-exports java.base/com.ibm.oti.vm=ALL-UNNAMED --add-exports java.base/com.ibm.oti.util=ALL-UNNAMED --add-exports java.base/jdk.internal.vm.annotation=ALL-UNNAMED --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-exports java.base/com.ibm.jit.crypto=ALL-UNNAMED --add-exports java.base/com.ibm.jit=ALL-UNNAMED --add-exports java.base/com.ibm.oti.reflect=ALL-UNNAMED --add-exports java.xml.bind/javax.xml.bind.annotation=ALL-UNNAMED --add-exports java.xml.bind/javax.xml.bind=ALL-UNNAMED" />207<echo>===addExports: ${addExports}</echo>208<javac srcdir="${src}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">209<src path="${src}" />210<src path="${src_90}" />211<src path="${src_90_jcl}" />212<src path="${src_access}" />213<src path="${TestUtilities}" />214<src path="${TestUtilitiesJ9}" />215<src path="${transformerListener}" />216<compilerarg line='${addExports}' />217<compilerarg line='${addExports_90_jcl}' />218<compilerarg line='${addModules}' />219<compilerarg line='--add-modules openj9.sharedclasses' />220<!-- PR117298 -->221<exclude name="**/Cmvc194280.java" />222<exclude name="**/resources/**" />223<!-- requires special compilation methods -->224<exclude name="**/NoSuchMethod/**" />225<classpath>226<pathelement location="${LIB_DIR}/asm-all.jar" />227<pathelement location="${LIB_DIR}/testng.jar" />228<pathelement location="${LIB_DIR}/jcommander.jar" />229<pathelement location="${LIB_DIR}/commons-cli.jar" />230<pathelement location="${LIB_DIR}/javassist.jar" />231</classpath>232</javac>233<javac srcdir="${src_80}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">234<include name="org/openj9/test/java/lang/Test_Thread_Extra.java" />235<src path="${src_access}" />236<classpath>237<pathelement location="${LIB_DIR}/testng.jar" />238</classpath>239</javac>240</then>241</elseif>242<else>243<if>244<equals arg1="${JDK_VERSION}" arg2="11" />245<then>246<!-- Java 11 -->247<property name="src_version" location="src_110" />248<property name="addExports_version" value="" />249</then>250<elseif>251<matches string="${JDK_VERSION}" pattern="^1[2-6]$$" />252<then>253<!-- Java 12-16 -->254<property name="src_version" location="src_120" />255<property name="addExports_version" value="--add-exports java.base/jdk.internal.access=ALL-UNNAMED" />256</then>257</elseif>258<else>259<!-- Java 17+ -->260<property name="src_version" location="src_170" />261<property name="addExports_version" value="--add-exports java.base/jdk.internal.access=ALL-UNNAMED" />262</else>263</if>264265<property name="addExports" value="--add-exports java.base/com.ibm.oti.vm=ALL-UNNAMED --add-exports java.base/com.ibm.oti.util=ALL-UNNAMED --add-exports java.base/jdk.internal.vm.annotation=ALL-UNNAMED --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-exports java.base/jdk.internal.reflect=ALL-UNNAMED --add-exports java.base/com.ibm.jit.crypto=ALL-UNNAMED --add-exports java.base/com.ibm.jit=ALL-UNNAMED --add-exports java.base/com.ibm.oti.reflect=ALL-UNNAMED --add-exports java.base/openj9.internal.tools.attach.target=ALL-UNNAMED --add-exports jdk.jcmd/openj9.tools.attach.diagnostics.info=ALL-UNNAMED --add-exports jdk.attach/com.ibm.tools.attach.attacher=ALL-UNNAMED" />266<echo>===addExports: ${addExports}</echo>267268<property name="srcpath" location="${src}:${src_110_up}:${src_version}:${src_90_jcl}:${src_access}:${TestUtilities}:${TestUtilitiesJ9}:${transformerListener}" />269<!-- first two excludes are from PR117298, third exclude requires special compilation methods -->270<property name="commonExcludes" value="**/Cmvc194280.java,**/resources/**,**/NoSuchMethod/**" />271<path id="build.cp">272<fileset dir="${LIB_DIR}/" includes="asm-all.jar"/>273<fileset dir="${LIB_DIR}/" includes="testng.jar"/>274<fileset dir="${LIB_DIR}/" includes="jcommander.jar"/>275<fileset dir="${LIB_DIR}/" includes="commons-cli.jar"/>276<fileset dir="${LIB_DIR}/" includes="javassist.jar"/>277<fileset dir="${LIB_DIR}/" includes="jaxb-api.jar"/>278</path>279<property name="commonArgs" value="${addExports} ${addExports_90_jcl} ${addExports_version} --add-modules openj9.sharedclasses" />280<if>281<matches string="${JDK_VERSION}" pattern="^(1[1-8])$$" />282<then>283<!-- Java 11-18 -->284<javac srcdir="${srcpath}" excludes="${commonExcludes}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1" classpathref="build.cp">285<compilerarg line='${commonArgs}' />286</javac>287</then>288<else>289<!-- Java 19+ (SecurityManager removed) -->290<javac srcdir="${srcpath}" excludes="${commonExcludes}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1" classpathref="build.cp">291<compilerarg line='${commonArgs}' />292<!-- exclude tests that depend on SecurityManager -->293<exclude name="org/openj9/test/java/security/Test_AccessController.java" />294<exclude name="org/openj9/test/java/security/Test_AccessControlContext.java" />295<exclude name="org/openj9/test/java/lang/Test_Class_SM.java" />296<exclude name="org/openj9/test/java/lang/Test_System_SM.java" />297<exclude name="org/openj9/test/java/lang/Test_Thread_SM.java" />298<exclude name="org/openj9/test/java/lang/Test_ThreadGroup_SM.java" />299<exclude name="org/openj9/test/java/lang/invoke/Test_MethodHandleInfo_SM.java" />300<exclude name="org/openj9/test/java/lang/Test_ClassLoader_SM.java" />301<exclude name="org/openj9/test/java/lang/Test_J9VMInternals_SM.java" />302<exclude name="org/openj9/test/java/lang/Test_J9VMInternalsImpl_SM.java" />303<exclude name="org/openj9/test/vm/Test_VM.java" />304</javac>305</else>306</if>307</else>308</if>309</target>310311<target name="jasm_generator" depends="init,getDependentLibs" description="prepare jasm files">312<property name="jasm_class_destination" location="${build}/j9vm/test/invoker" />313<mkdir dir="${jasm_class_destination}" />314<exec executable="${TEST_JDK_HOME}/bin/java" dir="${jasm_class_destination}">315<arg line="-jar ${LIB_DIR}/asmtools.jar jasm ${src}/j9vm/test/invoker/NodeClass.jasm" />316</exec>317<exec executable="${TEST_JDK_HOME}/bin/java" dir="${jasm_class_destination}">318<arg line="-jar ${LIB_DIR}/asmtools.jar jasm ${src}/j9vm/test/invoker/NodeInterface.jasm" />319</exec>320</target>321322<!-- This target is used to prepare test resource which is located in org/openj9/resources -->323<target name="pack_resources" depends="compileNoSuchMethod" description="prepare JCL test resources">324<!-- compile java files within resources dir without '-parameter' flag in javac command line, README in '${src}/org/openj9/resources/methodparameters/README' -->325<javac srcdir="${src}" destdir="${build_resource}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">326<include name ="org/openj9/resources/**" />327<exclude name ="org/openj9/resources/methodparameters/WithParams.java" />328<compilerarg line='${addModules}' />329<src path="${src_access}" />330<classpath>331<pathelement location="${LIB_DIR}/jaxb-api.jar" />332</classpath>333</javac>334335<!-- compile java files within resources dir with '-parameter' flag in javac command line, README in '${src}/org/openj9/resources/methodparameters/README' -->336<javac srcdir="${src}" destdir="${build_resource}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">337<compilerarg value='-parameters' />338<src path="${src_access}" />339<include name ="org/openj9/resources/methodparameters/WithParams.java" />340</javac>341342<jar jarfile="${build_resource}/org/openj9/resources/openj9tr_general.jar">343<fileset dir="${build_resource}" includes="org/openj9/resources/classinheritance/**" />344<fileset dir="${build_resource}" includes="org/openj9/resources/methodparameters/**" />345<fileset dir="${build_resource}" includes="org/openj9/resources/security/**" />346</jar>347348<!-- generate child.jar -->349<jar jarfile="${build_resource}/org/openj9/resources/openj9tr_child.jar">350<fileset dir="${src}/org/openj9/resources/classloader/child/" />351</jar>352353<!-- generate parent.jar -->354<jar jarfile="${build_resource}/org/openj9/resources/openj9tr_parent.jar">355<fileset dir="${src}/org/openj9/resources/classloader/parent/" />356</jar>357358<!-- generate A.jar and B.jar for org.openj9.test.annotationPackage tests -->359<jar jarfile="${build_resource}/org/openj9/resources/openj9tr_annotationPackage_A.jar">360<fileset dir="${build_resource}" includes="org/openj9/resources/annotationPackage/A.class" />361<fileset dir="${build_resource}" includes="org/openj9/resources/annotationPackage/package-info.class" />362</jar>363<jar jarfile="${build_resource}/org/openj9/resources/openj9tr_annotationPackage_B.jar">364<fileset dir="${build_resource}" includes="org/openj9/resources/annotationPackage/B.class" />365</jar>366367<!-- copy extra test related files into build_resource dir -->368<copy todir="${build_resource}/org/openj9/resources">369<fileset dir="${src}/org/openj9/resources/misc" />370</copy>371372<!-- copy Test_JITHelper dependencies to ${build_resource}, and add them into -Xbootclasspath/a -->373<copy file="${build}/org/openj9/test/com/ibm/jit/Test_JITHelpersImpl.class" todir="${build_resource}/org/openj9/test/com/ibm/jit" />374375<!-- move classfiles in a restricted package to ${build_resource} so they can be added to a module -->376<move file="${build}/sun" todir="${build_resource}" />377</target>378379<target name="dist" depends="pack_resources" description="generate the distribution">380<jar jarfile="${DEST}/GeneralTest.jar" filesonly="true">381<fileset dir="${build}" />382<fileset dir="${src}/../" includes="*.properties,*.xml" />383</jar>384<jar jarfile="${DEST}/TestResources.jar" filesonly="true">385<fileset dir="${build_resource}" />386</jar>387<jar jarfile="${RESOURCES_DIR}/vmargs.jar" filesonly="true" manifest="META-INF/MANIFEST.MF">388<fileset dir="${build}" includes="org/openj9/test/vmArguments/*.class" />389</jar>390<copy todir="${DEST}">391<fileset dir="${src}/../" includes="*.xml,*.policy" />392<fileset dir="${src}/../" includes="*.mk" />393</copy>394<mkdir dir="${DEST}/DupClassNameTest" />395<mkdir dir="${DEST}/DupClassNameTest/version1" />396<mkdir dir="${DEST}/DupClassNameTest/version2" />397<copy todir="${DEST}/DupClassNameTest/version1/">398<fileset dir="${build}/DupClassNameTest/version1" includes="*.class" />399</copy>400<copy todir="${DEST}/DupClassNameTest/version2/">401<fileset dir="${build}/DupClassNameTest/version2" includes="*.class" />402</copy>403</target>404405<target name="clean" depends="dist" description="clean up">406<!-- Delete the ${build} and ${build_resource} directory trees -->407<delete dir="${build}" />408<delete dir="${build_resource}" />409</target>410411<target name="build" >412<if>413<or>414<equals arg1="${JDK_IMPL}" arg2="ibm" />415<equals arg1="${JDK_IMPL}" arg2="openj9" />416</or>417<then>418<subant target="build">419<fileset dir="${TEST_ROOT}/functional/InstrumentationAgent" includes="build.xml" />420</subant>421<antcall target="clean" inheritall="true" />422</then>423</if>424</target>425</project>426427428