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

Fix native-image build-time initialization #6426

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
28 changes: 26 additions & 2 deletions applications/parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
<version>3.1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>io.helidon.applications</groupId>
<artifactId>helidon-applications</artifactId>
<packaging>pom</packaging>
<name>Helidon Applications Parent</name>
Expand Down Expand Up @@ -201,7 +200,6 @@
<buildArgs>
<!-- Some native image features use the svm dependencies which require additional exports -->
<arg>--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.configure=ALL-UNNAMED</arg>
<arg>--static</arg>
</buildArgs>
</configuration>
</execution>
Expand All @@ -211,6 +209,32 @@
</pluginManagement>
</build>
<profiles>
<profile>
<id>linux-native</id>
<activation>
<os>
<family>Linux</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<executions>
<execution>
<id>build-native-image</id>
<configuration>
<buildArgs combine.children="append">
<arg>--static</arg>
</buildArgs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>helidon-cli</id>
<activation>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Args=--initialize-at-build-time={{package}}
35 changes: 35 additions & 0 deletions archetypes/helidon/src/main/archetype/common/native-image.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2023 Oracle and/or its affiliates.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->
<archetype-script xmlns="https://helidon.io/archetype/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://helidon.io/archetype/2.0 https://helidon.io/xsd/archetype-2.0.xsd">

<output>
<transformation id="native-image">
<replace regex="__dir__" replacement="${groupId}/${artifactId}"/>
</transformation>

<templates engine="mustache" transformations="native-image,mustache">
<directory>files</directory>
<includes>
<include>**/native-image/**</include>
</includes>
</templates>
</output>
</archetype-script>
3 changes: 2 additions & 1 deletion archetypes/helidon/src/main/archetype/common/packaging.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2022 Oracle and/or its affiliates.
Copyright (c) 2022, 2023 Oracle and/or its affiliates.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -20,6 +20,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://helidon.io/archetype/2.0 https://helidon.io/xsd/archetype-2.0.xsd">

<exec src="native-image.xml"/>
<step name="Packaging and Deployment" optional="true">
<exec src="docker.xml"/>
<inputs>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019, 2023Oracle and/or its affiliates.
# Copyright (c) 2019, 2023 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down