From 695cd6e77b0c8a80ef4dde918a25068aa1c14ec8 Mon Sep 17 00:00:00 2001 From: Romain Grecourt Date: Fri, 17 Mar 2023 10:59:26 -0700 Subject: [PATCH] Fix native-image build-time initialization (#6426) * Fix native-image build-time initialization - Isolate the use of --static with to Linx only. - Add a native-image.properties file in archetypes for all generated project Fixes #6284 * specify build-args for the build-native-image execution, and ensure it's merged --- applications/parent/pom.xml | 28 +++++++++++++-- .../__dir__/native-image.properties.mustache | 1 + .../main/archetype/common/native-image.xml | 35 +++++++++++++++++++ .../src/main/archetype/common/packaging.xml | 3 +- .../helidon-quickstart-se/Dockerfile.native | 2 +- 5 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 archetypes/helidon/src/main/archetype/common/files/src/main/resources/META-INF/native-image/__dir__/native-image.properties.mustache create mode 100644 archetypes/helidon/src/main/archetype/common/native-image.xml diff --git a/applications/parent/pom.xml b/applications/parent/pom.xml index e75a03f330b..fd80f4b88a9 100644 --- a/applications/parent/pom.xml +++ b/applications/parent/pom.xml @@ -26,7 +26,6 @@ 3.1.3-SNAPSHOT ../pom.xml - io.helidon.applications helidon-applications pom Helidon Applications Parent @@ -201,7 +200,6 @@ --add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.configure=ALL-UNNAMED - --static @@ -211,6 +209,32 @@ + + linux-native + + + Linux + + + + + + org.graalvm.buildtools + native-maven-plugin + + + build-native-image + + + --static + + + + + + + + helidon-cli diff --git a/archetypes/helidon/src/main/archetype/common/files/src/main/resources/META-INF/native-image/__dir__/native-image.properties.mustache b/archetypes/helidon/src/main/archetype/common/files/src/main/resources/META-INF/native-image/__dir__/native-image.properties.mustache new file mode 100644 index 00000000000..189dbcdaea4 --- /dev/null +++ b/archetypes/helidon/src/main/archetype/common/files/src/main/resources/META-INF/native-image/__dir__/native-image.properties.mustache @@ -0,0 +1 @@ +Args=--initialize-at-build-time={{package}} diff --git a/archetypes/helidon/src/main/archetype/common/native-image.xml b/archetypes/helidon/src/main/archetype/common/native-image.xml new file mode 100644 index 00000000000..725c30bb1db --- /dev/null +++ b/archetypes/helidon/src/main/archetype/common/native-image.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + files + + **/native-image/** + + + + diff --git a/archetypes/helidon/src/main/archetype/common/packaging.xml b/archetypes/helidon/src/main/archetype/common/packaging.xml index 30e9e33ef73..b4ff556e122 100644 --- a/archetypes/helidon/src/main/archetype/common/packaging.xml +++ b/archetypes/helidon/src/main/archetype/common/packaging.xml @@ -1,7 +1,7 @@