Skip to content

Commit 92f8978

Browse files
authored
4836 graalvm 22 4.x (helidon-io#5378)
* Upgrade GraalVM native image to 22.3.0 (helidon-io#5308) * Introducing native image plugin from GraalVM * Support GraalVM 22.3 build * Update graalvm version in all relevant files. Signed-off-by: Tomas Langer <tomas.langer@oracle.com> * Upgrade GraalVM native image to 22.3.0 Signed-off-by: Tomas Langer <tomas.langer@oracle.com>
1 parent e859f78 commit 92f8978

80 files changed

Lines changed: 195 additions & 433 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

applications/mp/pom.xml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,22 @@
8383
<build>
8484
<plugins>
8585
<plugin>
86-
<groupId>io.helidon.build-tools</groupId>
87-
<artifactId>helidon-maven-plugin</artifactId>
86+
<groupId>org.graalvm.buildtools</groupId>
87+
<artifactId>native-maven-plugin</artifactId>
8888
<executions>
8989
<execution>
90-
<id>native-image</id>
90+
<id>resource-config</id>
91+
<goals>
92+
<goal>generateResourceConfig</goal>
93+
</goals>
94+
<phase>package</phase>
95+
</execution>
96+
<execution>
97+
<id>build-native-image</id>
9198
<goals>
92-
<goal>native-image</goal>
99+
<goal>compile</goal>
93100
</goals>
101+
<phase>package</phase>
94102
</execution>
95103
</executions>
96104
</plugin>

applications/pom.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<version.plugin.helidon>3.0.0</version.plugin.helidon>
5151
<version.plugin.helidon-cli>3.0.0</version.plugin.helidon-cli>
5252
<version.plugin.jar>3.0.2</version.plugin.jar>
53+
<version.plugin.nativeimage>0.9.16</version.plugin.nativeimage>
5354
<version.plugin.os>1.5.0.Final</version.plugin.os>
5455
<version.plugin.protobuf>0.6.1</version.plugin.protobuf>
5556
<version.plugin.resources>2.7</version.plugin.resources>
@@ -179,6 +180,40 @@
179180
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${version.lib.grpc}:exe:${os.detected.classifier}</pluginArtifact>
180181
</configuration>
181182
</plugin>
183+
<plugin>
184+
<groupId>org.graalvm.buildtools</groupId>
185+
<artifactId>native-maven-plugin</artifactId>
186+
<version>${version.plugin.nativeimage}</version>
187+
<executions>
188+
<execution>
189+
<id>resource-config</id>
190+
<configuration>
191+
<!-- generate records for all module's resources -->
192+
<isDetectionEnabled>true</isDetectionEnabled>
193+
</configuration>
194+
</execution>
195+
<execution>
196+
<id>build-native-image</id>
197+
<configuration>
198+
<!-- generate an argument file for native image - great for troubleshooting -->
199+
<useArgFile>true</useArgFile>
200+
<!-- this needs to be defined to have a single set of jars on classpath,
201+
default approach would add classpath of module (from maven) and from jar (manifest) -->
202+
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
203+
<imageName>${project.build.finalName}</imageName>
204+
<fallback>false</fallback>
205+
<metadataRepository>
206+
<enabled>false</enabled>
207+
</metadataRepository>
208+
<buildArgs>
209+
<!-- Some native image features use the svm dependencies which require additional exports -->
210+
<arg>--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.configure=ALL-UNNAMED</arg>
211+
<arg>--enable-preview</arg>
212+
</buildArgs>
213+
</configuration>
214+
</execution>
215+
</executions>
216+
</plugin>
182217
</plugins>
183218
</pluginManagement>
184219
</build>

applications/se/pom.xml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,22 @@
3636
<build>
3737
<plugins>
3838
<plugin>
39-
<groupId>io.helidon.build-tools</groupId>
40-
<artifactId>helidon-maven-plugin</artifactId>
41-
<configuration>
42-
<additionalArgs>
43-
<additionalArg>-J--enable-preview</additionalArg>
44-
<additionalArg>-J--add-modules</additionalArg>
45-
<additionalArg>-JALL-SYSTEM</additionalArg>
46-
</additionalArgs>
47-
</configuration>
39+
<groupId>org.graalvm.buildtools</groupId>
40+
<artifactId>native-maven-plugin</artifactId>
4841
<executions>
4942
<execution>
50-
<id>native-image</id>
43+
<id>resource-config</id>
44+
<goals>
45+
<goal>generateResourceConfig</goal>
46+
</goals>
47+
<phase>package</phase>
48+
</execution>
49+
<execution>
50+
<id>build-native-image</id>
5151
<goals>
52-
<goal>native-image</goal>
52+
<goal>compile</goal>
5353
</goals>
54+
<phase>package</phase>
5455
</execution>
5556
</executions>
5657
</plugin>

archetypes/helidon/src/main/archetype/common/files/Dockerfile.native.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
# 1st stage, build the app
3-
FROM ghcr.io/graalvm/graalvm-ce:java17-21.3.0 as build
3+
FROM ghcr.io/graalvm/graalvm-ce:ol9-java19-22.3.0 as build
44

55
# Install native-image
66
RUN gu install native-image

common/common/src/main/resources/META-INF/native-image/io.helidon/helidon-common/native-image.properties renamed to common/common/src/main/resources/META-INF/native-image/io.helidon.common/helidon-common/native-image.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@
1414
# limitations under the License.
1515
#
1616

17-
# All Helidon modules are designed to be initialized at build time
18-
# (specific classes may be delayed to runtime)
17+
# all Helidon classes should be designed for native image, exceptions configured in specific modules
1918
Args=--initialize-at-build-time=io.helidon

common/common/src/main/resources/META-INF/native-image/io.helidon/helidon-common/resource-config.json renamed to common/common/src/main/resources/META-INF/native-image/io.helidon.common/helidon-common/resource-config.json

File renamed without changes.

config/encryption/src/main/resources/META-INF/native-image/native-image.properties

Lines changed: 0 additions & 16 deletions
This file was deleted.

config/yaml/src/main/resources/META-INF/native-image/io.helidon.config/helidon-config-yaml/native-image.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2019, 2021 Oracle and/or its affiliates.
2+
# Copyright (c) 2019, 2022 Oracle and/or its affiliates.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -14,4 +14,5 @@
1414
# limitations under the License.
1515
#
1616

17-
Args=--initialize-at-build-time=io.helidon.config.yaml
17+
Args=--initialize-at-build-time=io.helidon.config.yaml \
18+
--initialize-at-build-time=org.yaml.snakeyaml

dependencies/pom.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<version.lib.google-oauth-client>1.33.3</version.lib.google-oauth-client>
5353
<version.lib.google-error-prone>2.3.3</version.lib.google-error-prone>
5454
<version.lib.google-protobuf>3.21.7</version.lib.google-protobuf>
55-
<version.lib.graalvm>21.3.0</version.lib.graalvm>
55+
<version.lib.graalvm>22.3.0</version.lib.graalvm>
5656
<version.lib.graphql-java>17.4</version.lib.graphql-java>
5757
<version.lib.graphql-java.extended.scalars>17.1</version.lib.graphql-java.extended.scalars>
5858
<version.lib.gson>2.9.0</version.lib.gson>
@@ -978,11 +978,6 @@
978978
</exclusion>
979979
</exclusions>
980980
</dependency>
981-
<dependency>
982-
<groupId>org.graalvm.nativeimage</groupId>
983-
<artifactId>svm</artifactId>
984-
<version>${version.lib.graalvm}</version>
985-
</dependency>
986981
<!-- Kafka support -->
987982
<dependency>
988983
<groupId>org.apache.kafka</groupId>

docs/includes/guides/graalnative.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ set the `GRAALVM_HOME` environment variable to point at your GraalVM installatio
4242
[source,bash]
4343
----
4444
# Your path might be different
45-
export GRAALVM_HOME=/usr/local/graalvm-ce-21.3.0/Contents/Home/
45+
export GRAALVM_HOME=/usr/local/graalvm-ce-22.3.0/Contents/Home/
4646
----
4747
4848
Then install the optional `native-image` command:

0 commit comments

Comments
 (0)