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

[WIP] Support both GraalVM 19.2.1 and 19.3.0.2 - 19.2.1 SDK & 19.2.1 GraalVM image #6503

Closed
Closed
Show file tree
Hide file tree
Changes from 4 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
6 changes: 3 additions & 3 deletions bom/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<maven-plugin-annotations.version>3.5.2</maven-plugin-annotations.version>
<plexus-component-annotations.version>1.7.1</plexus-component-annotations.version>
<!-- What we actually depend on for the annotations, as latest Graal is not available in Maven fast enough: -->
<graal-sdk.version>19.3.0.2</graal-sdk.version>
<graal-sdk.version>19.2.1</graal-sdk.version>
<gizmo.version>1.0.0.Final</gizmo.version>
<jackson.version>2.10.2</jackson.version>
<commons-logging-jboss-logging.version>1.0.0.Final</commons-logging-jboss-logging.version>
Expand Down Expand Up @@ -831,7 +831,7 @@
<version>${jboss-logmanager.version}</version>
<exclusions>
<exclusion>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</exclusion>
<exclusion>
Expand Down Expand Up @@ -1643,7 +1643,7 @@
</dependency>

<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
<version>${graal-sdk.version}</version>
<scope>provided</scope>
Expand Down
2 changes: 1 addition & 1 deletion build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<!-- These properties are needed in order for them to be resolvable by the documentation -->
<!-- The Graal version we suggest using in documentation - as that's
what we work with by self downloading it: -->
<graal-sdk.version-for-documentation>19.3.0.2</graal-sdk.version-for-documentation>
<graal-sdk.version-for-documentation>19.2.1</graal-sdk.version-for-documentation>
<rest-assured.version>4.1.1</rest-assured.version>
<axle-client.version>0.0.9</axle-client.version>
<vertx.version>3.8.4</vertx.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public final class FeatureBuildItem extends MultiBuildItem {
public static final String JDBC_MSSQL = "jdbc-mssql";
public static final String JDBC_MYSQL = "jdbc-mysql";
public static final String JGIT = "jgit";
public static final String JSCH = "jsch";
public static final String KAFKA_STREAMS = "kafka-streams";
public static final String KEYCLOAK_AUTHORIZATION = "keycloak-authorization";
public static final String KOGITO = "kogito";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public class NativeConfig {
/**
* The docker image to use to do the image build
*/
@ConfigItem(defaultValue = "quay.io/quarkus/ubi-quarkus-native-image:19.3.0.2-java8")
@ConfigItem(defaultValue = "quay.io/quarkus/ubi-quarkus-native-image:19.2.1")
public String builderImage;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,12 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, NativeImageSourceJa

private void checkGraalVMVersion(String version) {
log.info("Running Quarkus native-image plugin on " + version);
final List<String> obsoleteGraalVmVersions = Arrays.asList("1.0.0", "19.0.", "19.1.", "19.2.");
final List<String> obsoleteGraalVmVersions = Arrays.asList("1.0.0", "19.0.", "19.1.", "19.2.0");
final boolean vmVersionIsObsolete = version.contains(" 19.3.0 ")
|| obsoleteGraalVmVersions.stream().anyMatch(v -> version.contains(" " + v));
if (vmVersionIsObsolete) {
throw new IllegalStateException(
"Out of date build of GraalVM detected: " + version + ". Please upgrade to GraalVM 19.3.0.2");
throw new IllegalStateException("Unsupported version of GraalVM detected: " + version
+ ". Quarkus currently offers a stable support of GraalVM 19.2.1 and an experimental support of GraalVM 19.3.0.2");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public class NativeImageAutoFeatureStep {
static final String BEFORE_ANALYSIS_ACCESS = Feature.BeforeAnalysisAccess.class.getName();
static final String DYNAMIC_PROXY_REGISTRY = "com.oracle.svm.core.jdk.proxy.DynamicProxyRegistry";
static final String LOCALIZATION_FEATURE = "com.oracle.svm.core.jdk.LocalizationFeature";
static final String LOCALIZATION_SUPPORT = "com.oracle.svm.core.jdk.LocalizationSupport";

@BuildStep
List<NativeImageResourceBuildItem> registerPackageResources(
Expand Down Expand Up @@ -205,26 +206,74 @@ public void write(String s, byte[] bytes) {
}

if (!resourceBundles.isEmpty()) {
ResultHandle locClass = overallCatch.loadClass(LOCALIZATION_FEATURE);

ResultHandle params = overallCatch.marshalAsArray(Class.class, overallCatch.loadClass(String.class));
ResultHandle registerMethod = overallCatch.invokeVirtualMethod(
ofMethod(Class.class, "getDeclaredMethod", Method.class, String.class, Class[].class), locClass,
overallCatch.load("addBundleToCache"), params);
overallCatch.invokeVirtualMethod(ofMethod(AccessibleObject.class, "setAccessible", void.class, boolean.class),
registerMethod, overallCatch.load(true));
/*
* Start of a quick and dirty fix to support both GraalVM 19.2.1 and 19.3.0.2 at the same time.
* This is only a first version that will be improved if the double GraalVM support works.
*/

// This try block should be removed with the fix.
TryBlock tempTryBlock = overallCatch.tryBlock();

/*
* Start of GraalVM 19.3.0.2 compatibility code.
*/
ResultHandle locFeatureClass = tempTryBlock.loadClass(LOCALIZATION_FEATURE);

ResultHandle locFeatureParams = tempTryBlock.marshalAsArray(Class.class, tempTryBlock.loadClass(String.class));
ResultHandle locFeatureRegisterMethod = tempTryBlock.invokeVirtualMethod(
ofMethod(Class.class, "getDeclaredMethod", Method.class, String.class, Class[].class), locFeatureClass,
tempTryBlock.load("addBundleToCache"), locFeatureParams);
tempTryBlock.invokeVirtualMethod(ofMethod(AccessibleObject.class, "setAccessible", void.class, boolean.class),
locFeatureRegisterMethod, tempTryBlock.load(true));

ResultHandle locFeature = tempTryBlock.invokeStaticMethod(
IMAGE_SINGLETONS_LOOKUP,
locFeatureClass);
for (NativeImageResourceBundleBuildItem i : resourceBundles) {
TryBlock et = tempTryBlock.tryBlock();

ResultHandle locSupport = overallCatch.invokeStaticMethod(
et.invokeVirtualMethod(ofMethod(Method.class, "invoke", Object.class, Object.class, Object[].class),
locFeatureRegisterMethod, locFeature, et.marshalAsArray(Object.class, et.load(i.getBundleName())));
CatchBlockCreator c = et.addCatch(Throwable.class);
//c.invokeVirtualMethod(ofMethod(Throwable.class, "printStackTrace", void.class), c.getCaughtException());
}
/*
* End of GraalVM 19.3.0.2 compatibility code.
*/

// This catch block should be removed with the fix.
CatchBlockCreator tempCatchBlock = tempTryBlock.addCatch(Throwable.class);

/*
* Start of GraalVM 19.2.1 compatibility code.
*/
ResultHandle locSupportClass = tempCatchBlock.loadClass(LOCALIZATION_SUPPORT);

ResultHandle locSupportParams = tempCatchBlock.marshalAsArray(Class.class, tempCatchBlock.loadClass(String.class));
ResultHandle locSupportRegisterMethod = tempCatchBlock.invokeVirtualMethod(
ofMethod(Class.class, "getDeclaredMethod", Method.class, String.class, Class[].class), locSupportClass,
tempCatchBlock.load("addBundleToCache"), locSupportParams);
tempCatchBlock.invokeVirtualMethod(ofMethod(AccessibleObject.class, "setAccessible", void.class, boolean.class),
locSupportRegisterMethod, tempCatchBlock.load(true));

ResultHandle locSupport = tempCatchBlock.invokeStaticMethod(
IMAGE_SINGLETONS_LOOKUP,
locClass);
locSupportClass);
for (NativeImageResourceBundleBuildItem i : resourceBundles) {
TryBlock et = overallCatch.tryBlock();
TryBlock et = tempCatchBlock.tryBlock();

et.invokeVirtualMethod(ofMethod(Method.class, "invoke", Object.class, Object.class, Object[].class),
registerMethod, locSupport, et.marshalAsArray(Object.class, et.load(i.getBundleName())));
locSupportRegisterMethod, locSupport, et.marshalAsArray(Object.class, et.load(i.getBundleName())));
CatchBlockCreator c = et.addCatch(Throwable.class);
//c.invokeVirtualMethod(ofMethod(Throwable.class, "printStackTrace", void.class), c.getCaughtException());
}
/*
* End of GraalVM 19.2.1 compatibility code.
*/

/*
* End of the quick and dirty fix.
*/
}
int count = 0;

Expand Down
2 changes: 1 addition & 1 deletion core/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<artifactId>graal-sdk</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion core/test-extension/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion extensions/agroal/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<artifactId>quarkus-narayana-jta</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion extensions/amazon-lambda-http/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<artifactId>quarkus-amazon-lambda-http</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion extensions/amazon-lambda-http/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<artifactId>aws-serverless-java-container-core</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion extensions/artemis-core/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
</dependency>

<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion extensions/azure-functions-http/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<artifactId>quarkus-vertx-http-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion extensions/azure-functions-http/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<artifactId>quarkus-core</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion extensions/caffeine/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<artifactId>caffeine</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion extensions/elasticsearch-rest-client/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion extensions/elytron-security-common/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<artifactId>quarkus-core</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<artifactId>quarkus-elytron-security</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion extensions/elytron-security/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<artifactId>quarkus-vertx-http</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion extensions/flyway/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<artifactId>quarkus-narayana-jta</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion extensions/hibernate-orm/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<artifactId>jakarta.transaction-api</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion extensions/hibernate-search-elasticsearch/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<artifactId>hibernate-search-mapper-orm</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion extensions/hibernate-validator/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion extensions/infinispan-client/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<artifactId>protostream-processor</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion extensions/infinispan-embedded/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<artifactId>jakarta.transaction-api</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion extensions/jaeger/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<artifactId>jaeger-thrift</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion extensions/jaxb/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<description>XML serialization support</description>
<dependencies>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion extensions/jdbc/jdbc-derby/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<artifactId>derbyclient</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion extensions/jdbc/jdbc-h2/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
-->
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion extensions/jdbc/jdbc-mariadb/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<artifactId>mariadb-java-client</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion extensions/jdbc/jdbc-mssql/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion extensions/jdbc/jdbc-mysql/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>
Expand Down
Loading