Skip to content

Commit d52e308

Browse files
perezdgoogle-java-format Team
authored andcommitted
GraalVM native-image Maven build support
Closes #358. This appears to work as expected. I have a [weird case](oracle/graal#4254) I'm not really sure how to address (the need to specify -Djava.home during execution), but otherwise, this produces a fully static binary that is very fast and works. To execute the build, you run the following command: ``` mvn -Pnative -DskipTests package ``` Fixes #728 COPYBARA_INTEGRATE_REVIEW=#728 from perezd:native-image 9b64d07 PiperOrigin-RevId: 424692716
1 parent fa48f48 commit d52e308

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

core/pom.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,5 +249,44 @@
249249
</plugins>
250250
</build>
251251
</profile>
252+
<profile>
253+
<id>native</id>
254+
<build>
255+
<plugins>
256+
<plugin>
257+
<groupId>org.graalvm.buildtools</groupId>
258+
<artifactId>native-maven-plugin</artifactId>
259+
<version>0.9.9</version>
260+
<extensions>true</extensions>
261+
<executions>
262+
<execution>
263+
<id>build-native</id>
264+
<goals>
265+
<goal>build</goal>
266+
</goals>
267+
<phase>package</phase>
268+
</execution>
269+
<execution>
270+
<id>test-native</id>
271+
<goals>
272+
<goal>test</goal>
273+
</goals>
274+
<phase>test</phase>
275+
</execution>
276+
</executions>
277+
<configuration>
278+
<imageName>google-java-format</imageName>
279+
<classpath>
280+
<param>${project.build.directory}/${project.artifactId}-${project.version}-all-deps.jar</param>
281+
</classpath>
282+
<buildArgs>
283+
<buildArg>-H:IncludeResourceBundles=com.sun.tools.javac.resources.compiler</buildArg>
284+
<buildArg>--no-fallback</buildArg>
285+
</buildArgs>
286+
</configuration>
287+
</plugin>
288+
</plugins>
289+
</build>
290+
</profile>
252291
</profiles>
253292
</project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"name": "com.sun.tools.javac.parser.UnicodeReader",
4+
"allDeclaredMethods": true
5+
}
6+
]

0 commit comments

Comments
 (0)