Skip to content

Commit 36a9296

Browse files
authored
Merge pull request #23935 from gdams/cleanup-ant-conditions
Use condition else attribute and remove is_not_JDK_VERSION_8
2 parents 784b381 + d42645c commit 36a9296

16 files changed

Lines changed: 79 additions & 94 deletions

File tree

test/TestConfig/build.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@
3636
<mkdir dir="${DEST}" />
3737
</target>
3838

39-
<condition property="TEXT_ENCODING" value="IBM-1047">
39+
<condition property="TEXT_ENCODING" value="IBM-1047" else="ISO-8859-1">
4040
<contains string="${SPEC}" substring="zos"/>
4141
</condition>
42-
<property name="TEXT_ENCODING" value="ISO-8859-1"/>
4342

4443
<target name="build" depends="init">
4544
<copy todir="${DEST}">

test/functional/Java17andUp/build.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
3737
<import file="${TEST_ROOT}/TKG/scripts/getDependencies.xml" />
3838
<property name="TestUtilities" location="../TestUtilities/src"/>
3939

40-
<condition property="src_170" value="src_170">
40+
<condition property="src_170" value="src_170" else="">
4141
<equals arg1="${JDK_VERSION}" arg2="17" />
4242
</condition>
43-
<property name="src_170" value=""/>
4443

4544
<target name="init">
4645
<mkdir dir="${DEST}" />

test/functional/Java8andUp/build.xml

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,27 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
4141
<property name="transformerListener" location="${TEST_ROOT}/Utils/src" />
4242
<property name="TestUtilities" location="../TestUtilities/src" />
4343
<property name="TestUtilitiesJ9" location="../TestUtilitiesJ9/src" />
44-
<condition property="src_90_jcl_dir" value="src_90_current">
44+
<condition property="src_90_jcl_dir" value="src_90_current" else="src_90_latest">
4545
<equals arg1="${JCL_VERSION}" arg2="current" />
4646
</condition>
47-
<property name="src_90_jcl_dir" value="src_90_latest"/>
4847
<property name="src_90_jcl" location="${src_90_jcl_dir}"/>
49-
<condition property="addExports_90_jcl" value="--add-exports java.management/sun.management=ALL-UNNAMED">
48+
<condition property="addExports_90_jcl" value="--add-exports java.management/sun.management=ALL-UNNAMED" else="--add-exports jdk.management.agent/jdk.internal.agent=ALL-UNNAMED">
5049
<equals arg1="${JCL_VERSION}" arg2="current" />
5150
</condition>
52-
<property name="addExports_90_jcl" value="--add-exports jdk.management.agent/jdk.internal.agent=ALL-UNNAMED"/>
5351

54-
<condition property="is_JDK_VERSION_8">
52+
<condition property="is_JDK_VERSION_8">
5553
<equals arg1="${JDK_VERSION}" arg2="8" />
5654
</condition>
5755

5856
<property name="src_access" location="${TEST_ROOT}/functional/UnsafeAccess/src" if:set="is_JDK_VERSION_8"/>
59-
<condition property="src_access_dir" value="${TEST_ROOT}/functional/UnsafeAccess/src_110" unless:set="is_JDK_VERSION_8">
57+
<condition property="src_access_dir" value="${TEST_ROOT}/functional/UnsafeAccess/src_110" else="${TEST_ROOT}/functional/UnsafeAccess/src_170" unless:set="is_JDK_VERSION_8">
6058
<matches string="${JDK_VERSION}" pattern="^1[1-6]$$" />
6159
</condition>
62-
<property name="src_access_dir" value="${TEST_ROOT}/functional/UnsafeAccess/src_170" unless:set="is_JDK_VERSION_8"/>
6360
<property name="src_access" location="${src_access_dir}" unless:set="is_JDK_VERSION_8"/>
6461

65-
<condition property="addModules" value="--add-modules java.se.ee">
62+
<condition property="addModules" value="--add-modules java.se.ee" else="">
6663
<matches string="${JDK_VERSION}" pattern="^(9|10)$$" />
6764
</condition>
68-
<property name="addModules" value=""/>
6965
<property name="LIB" value="asm_all,javassist,testng,jcommander,commons_cli,jaxb_api,asmtools" />
7066
<import file="${TEST_ROOT}/TKG/scripts/getDependencies.xml" />
7167

@@ -86,27 +82,24 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
8682
<copy overwrite="true" file="${NoSuchMethod_src}/java/lang/String.java.hide" tofile="${NoSuchMethod_src}/java/lang/String.java" />
8783
<copy overwrite="true" file="${NoSuchMethod_src}/AppLoaderCallee.java.fake" tofile="${NoSuchMethod_src}/AppLoaderCallee.java" />
8884
<!-- Compile the fake string impl and AppLoader caller with it -->
89-
<condition property="is_JDK_VERSION_8">
90-
<equals arg1="${JDK_VERSION}" arg2="8" />
91-
</condition>
9285

9386
<javac srcdir="${NoSuchMethod_src}" destdir="${build}" includes="**/String.java,*AppLoaderCaller2.java" fork="true"
94-
debug="on" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1" if:set="is_JDK_VERSION_8">
87+
debug="on" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1" if:set="is_JDK_VERSION_8">
9588
<src path="${src_access}" />
9689
<classpath>
97-
<pathelement location="${LIB_DIR}/asm-all.jar" />
98-
<pathelement location="${LIB_DIR}/testng.jar" />
99-
<pathelement location="${LIB_DIR}/jcommander.jar" />
90+
<pathelement location="${LIB_DIR}/asm-all.jar" />
91+
<pathelement location="${LIB_DIR}/testng.jar" />
92+
<pathelement location="${LIB_DIR}/jcommander.jar" />
10093
</classpath>
10194
</javac>
10295
<javac srcdir="${NoSuchMethod_src}" destdir="${build}" includes="**/String.java,*AppLoaderCaller2.java" fork="true"
103-
debug="on" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1" unless:set="is_JDK_VERSION_8">
96+
debug="on" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1" unless:set="is_JDK_VERSION_8">
10497
<compilerarg line ="--patch-module java.base=${NoSuchMethod_src}/java/lang" />
10598
<src path="${src_access}" />
10699
<classpath>
107-
<pathelement location="${LIB_DIR}/asm-all.jar" />
108-
<pathelement location="${LIB_DIR}/testng.jar" />
109-
<pathelement location="${LIB_DIR}/jcommander.jar" />
100+
<pathelement location="${LIB_DIR}/asm-all.jar" />
101+
<pathelement location="${LIB_DIR}/testng.jar" />
102+
<pathelement location="${LIB_DIR}/jcommander.jar" />
110103
</classpath>
111104
</javac>
112105
<!-- remove our fake java.lang.string impl -->
@@ -159,9 +152,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
159152
<pathelement location="${LIB_DIR}/testng.jar" />
160153
</classpath>
161154
</javac>
162-
<condition property="is_JDK_VERSION_8">
163-
<equals arg1="${JDK_VERSION}" arg2="8" />
164-
</condition>
165155

166156
<javac srcdir="${src}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1" if:set="is_JDK_VERSION_8">
167157
<src path="${src}" />
@@ -175,23 +165,21 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
175165
<!-- requires special compilation methods -->
176166
<exclude name="**/NoSuchMethod/**" />
177167
<classpath>
178-
<pathelement location="${LIB_DIR}/asm-all.jar" />
179-
<pathelement location="${LIB_DIR}/testng.jar" />
180-
<pathelement location="${LIB_DIR}/jcommander.jar" />
181-
<pathelement location="${TEST_JDK_HOME}/lib/tools.jar" />
182-
<pathelement location="${LIB_DIR}/commons-cli.jar" />
183-
<pathelement location="${LIB_DIR}/javassist.jar" />
168+
<pathelement location="${LIB_DIR}/asm-all.jar" />
169+
<pathelement location="${LIB_DIR}/testng.jar" />
170+
<pathelement location="${LIB_DIR}/jcommander.jar" />
171+
<pathelement location="${TEST_JDK_HOME}/lib/tools.jar" />
172+
<pathelement location="${LIB_DIR}/commons-cli.jar" />
173+
<pathelement location="${LIB_DIR}/javassist.jar" />
184174
</classpath>
185175
</javac>
186-
<condition property="src_version_dir" value="src_110" unless:set="is_JDK_VERSION_8">
176+
<condition property="src_version_dir" value="src_110" else="src_170" unless:set="is_JDK_VERSION_8">
187177
<equals arg1="${JDK_VERSION}" arg2="11" />
188178
</condition>
189-
<property name="src_version_dir" value="src_170" unless:set="is_JDK_VERSION_8"/>
190179
<property name="src_version" location="${src_version_dir}" unless:set="is_JDK_VERSION_8"/>
191-
<condition property="addExports_version" value="" unless:set="is_JDK_VERSION_8">
180+
<condition property="addExports_version" value="" else="--add-exports java.base/jdk.internal.access=ALL-UNNAMED" unless:set="is_JDK_VERSION_8">
192181
<equals arg1="${JDK_VERSION}" arg2="11" />
193182
</condition>
194-
<property name="addExports_version" value="--add-exports java.base/jdk.internal.access=ALL-UNNAMED" unless:set="is_JDK_VERSION_8"/>
195183

196184
<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.attach/com.ibm.tools.attach.attacher=ALL-UNNAMED" unless:set="is_JDK_VERSION_8"/>
197185
<echo unless:set="is_JDK_VERSION_8">===addExports: ${addExports}</echo>
@@ -208,15 +196,37 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
208196
<fileset dir="${LIB_DIR}/" includes="jaxb-api.jar"/>
209197
</path>
210198
<property name="commonArgs" value="${addExports} ${addExports_90_jcl} ${addExports_version} --add-modules openj9.sharedclasses" unless:set="is_JDK_VERSION_8"/>
199+
<condition property="is_JDK_VERSION_11_to_18">
200+
<matches string="${JDK_VERSION}" pattern="^(1[1-8])$$" />
201+
</condition>
202+
<condition property="is_JDK_VERSION_19_to_22">
203+
<matches string="${JDK_VERSION}" pattern="^(19|2[0-2])$$" />
204+
</condition>
211205
<condition property="is_JDK_VERSION_match">
212-
<matches string="${JDK_VERSION}" pattern="^(8|1[1-8])$$" />
206+
<matches string="${JDK_VERSION}" pattern="^(8|1[1-8]|19|2[0-2])$$" />
213207
</condition>
214208

215209
<!-- Java 11-18 -->
216-
<javac srcdir="${srcpath}" excludes="${commonExcludes}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1" classpathref="build.cp" if:set="is_JDK_VERSION_match" unless:set="is_JDK_VERSION_8">
210+
<javac srcdir="${srcpath}" excludes="${commonExcludes}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1" classpathref="build.cp" if:set="is_JDK_VERSION_11_to_18">
217211
<compilerarg line='${commonArgs}' />
218212
</javac>
219-
<!-- Java 23+ (SecurityManage and Thread functions removed) -->
213+
<!-- Java 19-22 (SecurityManager removed) -->
214+
<javac srcdir="${srcpath}" excludes="${commonExcludes}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1" classpathref="build.cp" if:set="is_JDK_VERSION_19_to_22">
215+
<compilerarg line='${commonArgs}' />
216+
<!-- exclude tests that depend on SecurityManager -->
217+
<exclude name="org/openj9/test/java/security/Test_AccessController.java" />
218+
<exclude name="org/openj9/test/java/security/Test_AccessControlContext.java" />
219+
<exclude name="org/openj9/test/java/lang/Test_Class_SM.java" />
220+
<exclude name="org/openj9/test/java/lang/Test_System_SM.java" />
221+
<exclude name="org/openj9/test/java/lang/Test_Thread_SM.java" />
222+
<exclude name="org/openj9/test/java/lang/Test_ThreadGroup_SM.java" />
223+
<exclude name="org/openj9/test/java/lang/invoke/Test_MethodHandleInfo_SM.java" />
224+
<exclude name="org/openj9/test/java/lang/Test_ClassLoader_SM.java" />
225+
<exclude name="org/openj9/test/java/lang/Test_J9VMInternals_SM.java" />
226+
<exclude name="org/openj9/test/java/lang/Test_J9VMInternalsImpl_SM.java" />
227+
<exclude name="org/openj9/test/vm/Test_VM.java" />
228+
</javac>
229+
<!-- Java 23+ (SecurityManager and Thread functions removed) -->
220230
<javac srcdir="${srcpath}" excludes="${commonExcludes}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1" classpathref="build.cp" unless:set="is_JDK_VERSION_match">
221231
<compilerarg line='${commonArgs}' />
222232
<!-- exclude tests that depend on SecurityManager or Thread functions -->

test/functional/Java9andUp/build.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,11 @@
150150
</or>
151151
</condition>
152152

153-
<condition property="is_not_JDK_VERSION_8" if:set="is_JDK_IMPL_ibm">
154-
<not>
155-
<equals arg1="${JDK_VERSION}" arg2="8"/>
156-
</not>
153+
<condition property="is_JDK_VERSION_8">
154+
<equals arg1="${JDK_VERSION}" arg2="8"/>
157155
</condition>
158156

159-
<antcall target="clean" inheritall="true" if:set="is_not_JDK_VERSION_8"/>
157+
<antcall target="clean" inheritall="true" if:set="is_JDK_IMPL_ibm" unless:set="is_JDK_VERSION_8"/>
160158
</target>
161159

162160
<target name="clean" depends="dist" description="clean up" >

test/functional/JavaAgentTest/build.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@
4747
<echo>============COMPILER SETTINGS============</echo>
4848
<echo>===executable: ${compiler.javac}</echo>
4949
<echo>===destdir: ${DEST}</echo>
50-
<condition property="src_version_dir" value="./src_java8">
50+
<condition property="src_version_dir" value="./src_java8" else="./src_java12">
5151
<matches string="${JDK_VERSION}" pattern="^(8|9|10|11)$$" />
5252
</condition>
53-
<property name="src_version_dir" value="./src_java12"/>
5453
<property name="src_version" location="${src_version_dir}"/>
5554
<condition property="is_JDK_VERSION_8">
5655
<equals arg1="${JDK_VERSION}" arg2="8"/>

test/functional/Jsr292/build.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@
121121
<src path="${bootstrapSrc}"/>
122122
<src path="${bootstrapSrc_80}"/>
123123
</javac>
124-
<condition property="addExports" value="--add-exports java.base/jdk.internal.reflect=ALL-UNNAMED" unless:set="is_JDK_VERSION_8">
125-
<equals arg1="${JCL_VERSION}" arg2="latest"/>
126-
</condition>
127124
<property name="addExports" value="--add-exports java.base/jdk.internal.reflect=ALL-UNNAMED" unless:set="is_JDK_VERSION_8"/>
128125
<javac srcdir="${bootstrapSrc}" destdir="${bootstrapBuild}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1" unless:set="is_JDK_VERSION_8">
129126
<src path="${bootstrapSrc}"/>

test/functional/Jsr335/build.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
5656

5757
<property name="src_access" location="${TEST_ROOT}/functional/UnsafeAccess/src" if:set="is_JDK_VERSION_8"/>
5858
<property name="addExports" value="" if:set="is_JDK_VERSION_8"/>
59-
<condition property="src_access_dir" value="${TEST_ROOT}/functional/UnsafeAccess/src_110" unless:set="is_JDK_VERSION_8">
59+
<condition property="src_access_dir" value="${TEST_ROOT}/functional/UnsafeAccess/src_110" else="${TEST_ROOT}/functional/UnsafeAccess/src_170" unless:set="is_JDK_VERSION_8">
6060
<matches string="${JDK_VERSION}" pattern="^1[1-6]$$" />
6161
</condition>
62-
<property name="src_access_dir" value="${TEST_ROOT}/functional/UnsafeAccess/src_170" unless:set="is_JDK_VERSION_8"/>
6362
<property name="src_access" location="${src_access_dir}" unless:set="is_JDK_VERSION_8"/>
6463
<property name="addExports" value="--add-exports java.base/jdk.internal.misc=ALL-UNNAMED" unless:set="is_JDK_VERSION_8"/>
6564

test/functional/UnsafeTest/build.xml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,17 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
6363
<src path="${src_access}" />
6464
<src path="${transformerListener}" />
6565
<classpath>
66-
<pathelement location="${LIB_DIR}/testng.jar" />
67-
<pathelement location="${LIB_DIR}/asm.jar"/>
66+
<pathelement location="${LIB_DIR}/testng.jar" />
67+
<pathelement location="${LIB_DIR}/asm.jar"/>
6868
</classpath>
6969
</javac>
70-
<condition property="src_access_dir" value="${TEST_ROOT}/functional/UnsafeAccess/src_110" unless:set="is_JDK_VERSION_8">
70+
<condition property="src_access_dir" value="${TEST_ROOT}/functional/UnsafeAccess/src_110" else="${TEST_ROOT}/functional/UnsafeAccess/src_170" unless:set="is_JDK_VERSION_8">
7171
<matches string="${JDK_VERSION}" pattern="^1[1-6]$$" />
7272
</condition>
73-
<property name="src_access_dir" value="${TEST_ROOT}/functional/UnsafeAccess/src_170" unless:set="is_JDK_VERSION_8"/>
7473
<property name="src_access" location="${src_access_dir}" unless:set="is_JDK_VERSION_8"/>
75-
<condition property="test_src_dir" value="${src_11}" unless:set="is_JDK_VERSION_8">
74+
<condition property="test_src_dir" value="${src_11}" else="${src_25}" unless:set="is_JDK_VERSION_8">
7675
<matches string="${JDK_VERSION}" pattern="^(1[0-9]|2[0-1])$$" />
7776
</condition>
78-
<property name="test_src_dir" value="${src_25}" unless:set="is_JDK_VERSION_8"/>
7977
<property name="test_src" location="${test_src_dir}" unless:set="is_JDK_VERSION_8"/>
8078
<property name="src_util" location="../TestUtilities/src" unless:set="is_JDK_VERSION_8"/>
8179
<javac srcdir="${src}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1" unless:set="is_JDK_VERSION_8">
@@ -85,8 +83,8 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
8583
<src path="${transformerListener}" />
8684
<src path="${src_util}" />
8785
<classpath>
88-
<pathelement location="${LIB_DIR}/testng.jar" />
89-
<pathelement location="${LIB_DIR}/asm.jar"/>
86+
<pathelement location="${LIB_DIR}/testng.jar" />
87+
<pathelement location="${LIB_DIR}/asm.jar"/>
9088
</classpath>
9189
<compilerarg value="--add-exports" />
9290
<compilerarg value="java.base/jdk.internal.misc=ALL-UNNAMED" />
@@ -120,10 +118,10 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
120118

121119
<condition property="is_JDK_VERSION_9" if:set="is_JDK_IMPL_ibm">
122120
<not>
123-
<and>
124-
<equals arg1="${JDK_VERSION}" arg2="9" />
125-
<equals arg1="${JCL_VERSION}" arg2="current" />
126-
</and>
121+
<and>
122+
<equals arg1="${JDK_VERSION}" arg2="9" />
123+
<equals arg1="${JCL_VERSION}" arg2="current" />
124+
</and>
127125
</not>
128126
</condition>
129127

0 commit comments

Comments
 (0)