diff --git a/README.md b/README.md index bbe260e..bb2039a 100644 --- a/README.md +++ b/README.md @@ -92,18 +92,23 @@ GraalVM supports creating a single Ahead-Of-Time [native executable](https://www.graalvm.org/native-image/) from your java bytecode. -Once you have at least GraalVM 22.3.1 Java 19 installed, you can generate the -UberJar as above, then create your native binary as such: +Once you have at least GraalVM 22.3.1 Java 17 installed, you can generate the native binary with: ```bash -native-image --no-fallback --enable-preview -jar app/build/libs/hello-uber-1.0.jar +./gradlew nativeCompile ``` -You'll end up with a `hello-uber-1.0` file that can be executed directly without +You'll end up with a `hello-1.0` file that can be executed directly without the need of a JVM: ```bash -./hello-uber-1.0 +./app/build/native/nativeCompile/hello-1.0 +``` + +Alternatively, you can run the native executable directly with: + +```bash +./gradlew nativeRun ``` > **NOTE:** RIFE2 support for GraalVM native-image is still in preliminary diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ddab02a..72a0cfb 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -6,6 +6,7 @@ plugins { application id("com.uwyn.rife2") `maven-publish` + id("org.graalvm.buildtools.native") version "0.9.20" } base { @@ -68,3 +69,7 @@ publishing { } } } + +graalvmNative.binaries.all { + imageName.set("hello-$version") +} diff --git a/app/src/main/resources/META-INF/native-image/reflect-config.json b/app/src/main/resources/META-INF/native-image/reflect-config.json index 9b0c3be..065517e 100644 --- a/app/src/main/resources/META-INF/native-image/reflect-config.json +++ b/app/src/main/resources/META-INF/native-image/reflect-config.json @@ -1,6 +1,10 @@ [ -{ - "name":"rife.template.html.hello", + { + "name":"rife.template.html.hello", + "methods":[{"name":"","parameterTypes":[] }] + }, + { + "name":"rife.template.html.world", "methods":[{"name":"","parameterTypes":[] }] -} + } ] diff --git a/settings.gradle.kts b/settings.gradle.kts index f3be8d5..b4af770 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,4 +1,8 @@ pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + } includeBuild("build-logic") }