Skip to content

Commit

Permalink
[2.7] JDK 21 build and test support (#1881)
Browse files Browse the repository at this point in the history
* JDK 21 build and test support

There are following changes due JDK21:
-Tycho upgrade into 3.0.4 in core modules like jpa.jpql, core, jpa, sdo ...
    but 1.3.0 is activated instead default 3.0.4 by Maven profile with JDK 11
-maven.compiler.release remains at 8
-<comp.xlint>-Xlint:all,-this-escape</comp.xlint> in pom.xml in core.test.framework as compiler hangs there without any additional message
-Antbuild script change to accept JDK range from 1.8 to 21
-Antbuild script sharedlib.xml change to use external JavaScript engine as this one was removed from higher versions of the JDKs
-GitHub Action JDK 17 and 21-EA (Eclipse PR verification job remains with JDK 11)
-JPA.JSE test fix on JDK 21 by Weld dependencies upgrade
-MOXy test fix on JDK 21 by adding access to java.math module

Signed-off-by: Radek Felcman <[email protected]>
  • Loading branch information
rfelcman committed Jun 26, 2023
1 parent c5c8da6 commit f4e653c
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 21 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ on:
branches: [ '2.7' ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

env:
maven_version: 3.8.8
jobs:
Expand All @@ -28,14 +33,9 @@ jobs:

strategy:
matrix:
java_version: [ 11 ]
java_version: [ 17, 21-ea ]

steps:
- name: Cancel previous runs of this workflow
uses: styfle/[email protected]
with:
all_but_latest: true
access_token: ${{ github.token }}
- name: Start MySQL Database
run: |
sudo systemctl start mysql.service
Expand Down
2 changes: 1 addition & 1 deletion antbuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@

<!-- Detect compatible version of JDK (>= 1.8). -->
<condition property="compat.jdk" value="true">
<matches string="${java.version}" pattern="1.(?:[8-9]|[1-9]\d)(?:.\d+)*.*|9.*|1(?:[0-7]).*"/>
<matches string="${java.version}" pattern="1.(?:[8-9]|[1-9]\d)(?:.\d+)*.*|9.*|1(?:[0-7]).*|2(?:[1]).*"/>
</condition>
<echo message="JDK version detected: '${java.version}'"/>
<fail message="A non-compatible version of JDK was detected! Build won't run properly unless running on at least JDK 1.8!." unless="compat.jdk"/>
Expand Down
Binary file added buildsystem/bsf-2.4.0.jar
Binary file not shown.
Binary file added buildsystem/commons-logging-1.2.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions buildsystem/compdeps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@
<!-- CQ #22995 -->
<jboss.logging.version>3.4.1.Final</jboss.logging.version>
<!-- CQ #22996 API, #22997 SPI-->
<jboss.weld.api.version>3.1.SP3</jboss.weld.api.version>
<jboss.weld.api.version>3.1.SP4</jboss.weld.api.version>
<!-- CQ #22998 weld-environment-common, #22999 weld-se-core, #23000 weld-core-impl -->
<jboss.weld.version>3.1.6.Final</jboss.weld.version>
<jboss.weld.version>3.1.9.Final</jboss.weld.version>
</properties>

<build>
Expand Down
14 changes: 12 additions & 2 deletions buildsystem/org.eclipse.persistence.parent/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 2023 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -36,7 +36,8 @@
<properties>
<!-- TOOL Properties -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tycho.version>1.3.0</tycho.version>
<maven.compiler.release>8</maven.compiler.release>
<tycho.version>3.0.4</tycho.version>
<junit4-version>4.12</junit4-version>
<!-- maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format> Seems it must be in settings.xml -->
<!-- PROJECT Properties -->
Expand Down Expand Up @@ -132,6 +133,15 @@
<module>../../foundation/org.eclipse.persistence.oracle.nosql</module>
</modules>
</profile>
<profile>
<id>jdk11</id>
<activation>
<jdk>11</jdk>
</activation>
<properties>
<tycho.version>1.3.0</tycho.version>
</properties>
</profile>
</profiles>

<build>
Expand Down
Binary file added buildsystem/rhino-1.7.14.jar
Binary file not shown.
17 changes: 14 additions & 3 deletions foundation/eclipselink.core.test/antbuild.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 2023 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -61,6 +61,9 @@
<echo message="CORETEST_BEGINS..."/>
<available file="../${ant.project.name}" type="dir" property="core_test.is.local"/>
<fail message="Not running from '${ant.project.name}' directory" unless="core_test.is.local"/>
<condition property="is.less.21.jdk" value="true" else="false">
<matches string="${java.version}" pattern="1.(?:[8-9]|[1-9]\d)(?:.\d+)*.*|9.*|1(?:[0-7]).*"/>
</condition>

<!-- Default ant target, compiles and translates resources, does not run tests. -->
<target name="build" depends="clean, compile, package" description="build EclipseLink core tests"/>
Expand Down Expand Up @@ -561,13 +564,21 @@
</target>

<!-- Default test target, runs test.class from test.properties (default is LRG). -->
<target name="test" depends="init-testing">
<target name="test" depends="init-testing, test-all-jdks, test-less-jdk21">
<echo message="is.less.21.jdk: ${is.less.21.jdk}"/>
<generate-report/>
</target>

<target name="test-all-jdks">
<test include="**/junit/**/*Test.java"/>
<test include="${test.class}"/>
<test include="org.eclipse.persistence.testing.tests.security.SecurityTestModel"/>
<generate-report/>
</target>

<target name="test-less-jdk21" if="${is.less.21.jdk}">
<test include="org.eclipse.persistence.testing.tests.security.SecurityTestModel"/>
</target>

<!-- Test target to run/debug single ${test.class}. -->
<target name="test-single" depends="init-testing">
<test include="${test.class}"/>
Expand Down
2 changes: 1 addition & 1 deletion foundation/eclipselink.extension.test/antbuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<local name="compat.jdk"/>
<local name="compat.jdk.msg"/>
<condition property="compat.jdk" value="true">
<matches string="${java.version}" pattern="1.(?:[8-9]|[1-9]\d)(?:.\d+)*.*|9.*|1(?:[0-7]).*"/>
<matches string="${java.version}" pattern="1.(?:[8-9]|[1-9]\d)(?:.\d+)*.*|9.*|1(?:[0-7]).*|2(?:[1]).*"/>
</condition>
<condition property="compat.jdk.msg" value=" + JDK: ${java.version}"
else=" - JDK: ${java.version}${line.separator} Build won't run properly unless running at least JDK 1.8.">
Expand Down
4 changes: 2 additions & 2 deletions moxy/eclipselink.moxy.test/antbuild.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2018, 2022 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 2023 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -541,7 +541,7 @@
<mkdir dir="${report.dir}/jaxb"/>
<mkdir dir="${build.dir}/${test.dir}/${tmp.dir}"/>
<!-- Can be set e.g. in test.properties to add VM options for a particular platform/driver -->
<property name="additional.jvmargs" value="-Ddummy2=dummy"/>
<property name="additional.jvmargs" value="-Ddummy2=dummy --add-opens java.base/java.math=ALL-UNNAMED"/>
<junit jvm="${test.junit.jvm.exec}" failureproperty="junit.failed.jaxb" logfailedtests="true"
printsummary="yes" fork="true" dir="${build.dir}/${test.dir}" tempdir="${build.dir}/${test.dir}" showoutput="yes" maxmemory="1024m">
<!--<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"/>-->
Expand Down
13 changes: 9 additions & 4 deletions sharedlib.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 1998, 2023 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -47,7 +47,12 @@
* - Ant properties are lower case.
-->
<project name="wls-shared-lib" default="create-shared-lib-install" basedir=".">
<scriptdef name="genImpVersion" language="javascript" manager="javax">

<property name="bsf.lib" value="buildsystem/bsf-2.4.0.jar"/>
<property name="commons_logging.lib" value="buildsystem/commons-logging-1.2.jar"/>
<property name="mozilla_rhino.lib" value="buildsystem/rhino-1.7.14.jar"/>

<scriptdef name="genImpVersion" language="javascript" manager="bsf" classpath="${bsf.lib};${commons_logging.lib};${mozilla_rhino.lib}">
<attribute name="input"/>
<attribute name="property"/>
<attribute name="newline"/>
Expand Down Expand Up @@ -79,7 +84,7 @@
]]>
</scriptdef>

<scriptdef name="genSpecVersion" language="javascript" manager="javax">
<scriptdef name="genSpecVersion" language="javascript" manager="bsf" classpath="${bsf.lib};${commons_logging.lib};${mozilla_rhino.lib}">
<attribute name="input"/>
<attribute name="property"/>
<![CDATA[
Expand All @@ -104,7 +109,7 @@
]]>
</scriptdef>

<scriptdef name="genEarnameVersion" language="javascript" manager="javax">
<scriptdef name="genEarnameVersion" language="javascript" manager="bsf" classpath="${bsf.lib};${commons_logging.lib};${mozilla_rhino.lib}">
<attribute name="input"/>
<attribute name="property"/>
<![CDATA[
Expand Down

0 comments on commit f4e653c

Please sign in to comment.