Skip to content

Commit

Permalink
support -Dnative.image.skip and -Dnative.image.buildStatic
Browse files Browse the repository at this point in the history
Signed-off-by: tvallin <[email protected]>
  • Loading branch information
romain-grecourt authored and tvallin committed Nov 8, 2023
1 parent e441e12 commit 0b1b3ef
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 15 deletions.
2 changes: 0 additions & 2 deletions applications/mp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,12 @@
<goals>
<goal>generateResourceConfig</goal>
</goals>
<phase>package</phase>
</execution>
<execution>
<id>build-native-image</id>
<goals>
<goal>compile</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
Expand Down
55 changes: 54 additions & 1 deletion applications/parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,15 @@
<executions>
<execution>
<id>resource-config</id>
<phase>package</phase>
<configuration>
<!-- generate records for all module's resources -->
<isDetectionEnabled>true</isDetectionEnabled>
</configuration>
</execution>
<execution>
<id>build-native-image</id>
<phase>package</phase>
<configuration>
<!-- generate an argument file for native image - great for troubleshooting -->
<useArgFile>true</useArgFile>
Expand All @@ -205,7 +207,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 @@ -215,6 +216,58 @@
</pluginManagement>
</build>
<profiles>
<profile>
<id>native-image-skip</id>
<activation>
<property>
<name>native.image.skip</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<executions>
<execution>
<id>resource-config</id>
<phase>none</phase>
</execution>
<execution>
<id>build-native-image</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>native-image-static</id>
<activation>
<property>
<name>native.image.buildStatic</name>
</property>
</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
2 changes: 0 additions & 2 deletions applications/se/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,12 @@
<goals>
<goal>generateResourceConfig</goal>
</goals>
<phase>package</phase>
</execution>
<execution>
<id>build-native-image</id>
<goals>
<goal>compile</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip
RUN mvn package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip

# Do the Maven build!
# Incremental docker builds will resume here when you change sources
ADD src src
RUN mvn package -Pnative-image -DskipTests
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests

RUN echo "done!"

Expand Down
4 changes: 2 additions & 2 deletions examples/quickstarts/helidon-quickstart-mp/Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip
RUN mvn package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip

# Do the Maven build!
# Incremental docker builds will resume here when you change sources
ADD src src
RUN mvn package -Pnative-image -DskipTests
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests

RUN echo "done!"

Expand Down
4 changes: 2 additions & 2 deletions examples/quickstarts/helidon-quickstart-se/Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip
RUN mvn package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip

# Do the Maven build!
# Incremental docker builds will resume here when you change sources
ADD src src
RUN mvn package -Pnative-image -DskipTests
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests

RUN echo "done!"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip
RUN mvn package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip

# Do the Maven build!
# Incremental docker builds will resume here when you change sources
ADD src src
RUN mvn package -Pnative-image -DskipTests
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests

RUN echo "done!"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ WORKDIR /helidon
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip
RUN mvn package -Pnative-image -Dnative.image.skip -Dmaven.test.skip -Declipselink.weave.skip

# Do the Maven build!
# Incremental docker builds will resume here when you change sources
ADD src src
RUN mvn package -Pnative-image -DskipTests
RUN mvn package -Pnative-image -Dnative.image.buildStatic -DskipTests

RUN echo "done!"

Expand Down

0 comments on commit 0b1b3ef

Please sign in to comment.