Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support building ShardingSphere and its corresponding GraalVM Native Image through JDK 22 #30778

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/nightly-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
java-version: [ 11, 17, 21 ]
java-version: [ 11, 17, 21, 22 ]
steps:
- name: Support Long Paths in Windows
if: matrix.os == 'windows-latest'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ShardingSphere JDBC 要求在如下或更高版本的 `GraalVM CE` 完成构建
适用于 `Oracle GraalVM``Liberica Native Image Kit``Mandrel``GraalVM CE` 的下游发行版。

- GraalVM CE 23.1.2 For JDK 21.0.2,对应于 SDKMAN! 的 `21.0.2-graalce`
- GraalVM CE 24.0.0 For JDK 22,对应于 SDKMAN! 的 `22-graalce`

### Maven 生态

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ JDK through `SDKMAN!`. Same reason applicable to downstream distributions of `Gr
and `Mandrel`.

- GraalVM CE 23.1.2 For JDK 21.0.2, corresponding to `21.0.2-graalce` of SDKMAN!
- GraalVM CE 24.0.0 For JDK 22, corresponding to `22-graalce` of SDKMAN!

### Maven Ecology

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public final class EspressoInlineExpressionParser implements InlineExpressionPar
private String inlineExpression;

static {
URL groovyJarUrl = ClassLoader.getSystemResource("build/libs/groovy.jar");
URL groovyJarUrl = EspressoInlineExpressionParser.class.getClassLoader().getResource("build/libs/groovy.jar");
ShardingSpherePreconditions.checkNotNull(groovyJarUrl, NullPointerException::new);
JAVA_CLASSPATH = groovyJarUrl.getPath();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ public final class ReflectContext implements AutoCloseable {
* This method is a simulation of the following operation.
* // CHECKSTYLE:OFF
* <pre class="code">
* private final Context context = Context.newBuilder()
* private final Context context = Context.newBuilder("java")
* .allowAllAccess(true)
* .allowValueSharing(false)
* .option("java.Classpath", JAVA_CLASSPATH)
* .build();
* </pre>
Expand All @@ -48,10 +49,13 @@ public final class ReflectContext implements AutoCloseable {
public ReflectContext(final String javaClassPath) {
Object builderInstance = Class.forName(CONTEXT_CLASS_NAME)
.getMethod("newBuilder", String[].class)
.invoke(null, (Object) new String[0]);
.invoke(null, (Object) new String[]{"java"});
builderInstance = builderInstance.getClass()
.getMethod("allowAllAccess", boolean.class)
.invoke(builderInstance, true);
builderInstance = builderInstance.getClass()
.getMethod("allowValueSharing", boolean.class)
.invoke(builderInstance, false);
builderInstance = builderInstance.getClass()
.getMethod("option", String.class, String.class)
.invoke(builderInstance, "java.Classpath", javaClassPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledForJreRange;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.JRE;
import org.junit.jupiter.api.condition.OS;
Expand All @@ -35,10 +34,8 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;

@EnabledForJreRange(min = JRE.JAVA_21)
@EnabledForJreRange(min = JRE.JAVA_22)
@EnabledOnOs(value = OS.LINUX, disabledReason = "Refer to https://www.graalvm.org/jdk21/reference-manual/java-on-truffle/faq/#does-java-running-on-truffle-run-on-hotspot-too .")
@EnabledIfSystemProperty(named = "java.vm.vendor", matches = "GraalVM",
disabledReason = "Executing unit tests of this type in batches will result in a timeout, while executing unit tests individually works fine.")
class EspressoInlineExpressionParserTest {

@Test
Expand Down

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<asm.version>9.3</asm.version>
<groovy.version>4.0.19</groovy.version>
<freemarker.version>2.3.31</freemarker.version>
<bytebuddy.version>1.14.8</bytebuddy.version>
<bytebuddy.version>1.14.13</bytebuddy.version>

<jakarta.jakartaee-bom.version>8.0.0</jakarta.jakartaee-bom.version>
<glassfish-jaxb.version>2.3.9</glassfish-jaxb.version>
Expand Down Expand Up @@ -133,14 +133,14 @@
<opentelemetry.version>1.31.0</opentelemetry.version>
<kotlin-stdlib.version>1.9.10</kotlin-stdlib.version>

<junit.version>5.10.0</junit.version>
<junit.version>5.10.2</junit.version>
<hamcrest.version>2.2</hamcrest.version>
<mockito.version>4.11.0</mockito.version>
<awaitility.version>4.2.0</awaitility.version>
<testcontainers.version>1.19.3</testcontainers.version>
<commons-csv.version>1.9.0</commons-csv.version>

<graal-sdk.version>23.1.2</graal-sdk.version>
<graal-sdk.version>24.0.0</graal-sdk.version>

<!-- 3rd party library plugin versions -->
<protobuf-maven-plugin.version>0.6.1</protobuf-maven-plugin.version>
Expand Down
5 changes: 3 additions & 2 deletions test/native/native-image-filter/extra-filter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
{"excludeClasses": "com.sun.crypto.provider.**"},
{"excludeClasses": "com.sun.org.apache.xerces.internal.jaxp.**"},
{"excludeClasses": "java.**"},
{"includeClasses": "java.lang.Boolean"},
{"includeClasses": "java.util.Properties"},
{"excludeClasses": "javax.security.auth.x500.**"},
{"excludeClasses": "javax.smartcardio.**"},
Expand All @@ -17,8 +16,9 @@

{"excludeClasses": "android.app.**"},
{"excludeClasses": "com.arjuna.**"},
{"excludeClasses": "com.atomikos.logging.**"},
{"excludeClasses": "com.atomikos.**"},
{"excludeClasses": "com.alibaba.druid.**"},
{"excludeClasses": "com.ctc.wstx.stax.**"},
{"excludeClasses": "com.fasterxml.jackson.databind.**"},
{"excludeClasses": "com.github.benmanes.caffeine.cache.**"},
{"excludeClasses": "com.github.dockerjava.api.**"},
Expand All @@ -28,6 +28,7 @@
{"excludeClasses": "com.mysql.cj.**"},
{"excludeClasses": "com.zaxxer.hikari.**"},
{"excludeClasses": "ch.qos.logback.classic.**"},
{"excludeClasses": "io.etcd.**"},
{"excludeClasses": "io.grpc.**"},
{"excludeClasses": "io.netty.**"},
{"excludeClasses": "io.seata.**"},
Expand Down