native-image-playground

GraalVM Native Image Playground

GitHub Workflow Status GraalVM CE Kotlin release Style guide

GraalVM Native Image of a kotlin/java app and publish the platform binaries using GitHub action.

Install GraalVM CE Dev

# Install GraalVM CE Dev
$ ./scripts/graalvm-ce-dev.sh

# or Install latest GraalVM CE
$ sdk i java 24-graalce

Build

# Build the native image
$ ./gradlew nativeCompile [-Pquick]

# Use trace agent for metadata generation
$ ./gradlew -Pagent run [--rerun-tasks]
# Gracefully shutdown the server instead of killing Gradle run.
$ curl http://localhost:9080/shutdown
$ ./gradlew metadataCopy

# Run native image tests
$ ./gradlew nativeTest
$ ./gradlew -Pagent nativeTest

# GraalVM JIT Mode
$ ./gradlew build
$ java --enable-preview \
       --add-modules=ALL-SYSTEM \
       -jar build/libs/native-image-playground-*-all.jar

# Find out the classes/jars using top modules mentioned in the native-image build output
$ jdeps -q \
        -R \
        --ignore-missing-deps \
        --multi-release=26 \
        build/libs/native-image-playground-*-all.jar

# Build native image from modular jars
$ native-image \
    -p base-module.jar:main-module.jar \
    -m dev.suresh.Main

Run & Debugging

Resources