Gradle build scripts for "empty" example application#311
Closed
chirontt wants to merge 1 commit into
Closed
Conversation
especially to produce "empty" native image by GraalVM.
Collaborator
|
Thanks! macOS doesn't work but looks like for reasons unrelated to this change. Will investigate later. Windows did work for me! |
Collaborator
|
This is merged as ae145dc, not sure why Github didn't pick it up |
Collaborator
|
Works after b6e8664 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
... especially to produce "empty" native image by GraalVM.
Caveat: I haven't tested it on Mac platforms. Please try it on a Mac to see if it works.
Below is the
README.mdtext:Gradle build scripts for
emptyexample applicationThis directory contains Gradle scripts to build the
emptyexample application, especially to produce a native image of the application using the GraalVM tool.The scripts assume you already have the Gradle build tool installed and is available in the path. Standard Gradle commands can then be used to build the
emptyapplication, such as:gradle run: compile and run the applicationgradle jar: generate the application'sjarfile inbuild/libs/directoryBy default, the locally-compiled JWM classes are used as dependencies to compile the
emptyapplication. To use a published JWM version in Maven repository, specify the-PjwmVersion=...option in the Gradle commands, e.g.gradle run -PjwmVersion=0.4.25: compile and run the application with JWM0.4.25version published in Maven repositoryAll of the above build commands would work on all platforms supported by JWM.
Especially the scripts make use of the latest Gradle native image plugin to generate the
empty-nativeexecutable for current platform, as detailed below.Building
emptynative imagePrerequisites
A GraalVM JDK 25+ distribution is required to be installed and is available in the system, e.g. from Oracle release, or from a GraalVM Community distribution or from a Liberica Native Image Kit release, with the JAVA_HOME environment variable pointing to the installation and its
bindirectory be added to the path. More detailed installing info for various OSes is here.A C compiler for the current platform is also required to produce the native image executable. Detailed setup info is available here.
Building native image
First, the native image metadata for the
emptyapplication need be generated, by running the application with the-Pagentoption:Use and interact with the running
emptyapplication as per normal, then close it.Then generate its native image with the command:
The resulting native image will be produced in the
build/native/nativeCompile/directory, and can be executed directly:or in Windows:
Supported platforms
The
emptynative images can be produced on platforms supported by GraalVM, namely:x64/arm64,x64/arm64(but thex64support is removed in GraalVM 25.0.2+),x64.