From abd47f3bd948e571e13ed99dcf9fffc8ae61504d Mon Sep 17 00:00:00 2001 From: Geert Bevin Date: Sun, 19 Feb 2023 10:30:10 -0500 Subject: [PATCH] Updates for RIFE2 v1.3.0. Added README information about GraalVM native-image support. --- README.md | 27 +++++++++++++++++++ app/build.gradle.kts | 4 +-- .../native-image/resource-config.json | 8 ++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 app/src/main/resources/META-INF/native-image/resource-config.json diff --git a/README.md b/README.md index 4792915..14db369 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,33 @@ For example: java -javaagent:[path-to]/rife2-[version]-agent.jar -jar app/build/libs/hello-uber-1.0.jar ``` +## Making a native executable + +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: + +```bash +native-image --no-fallback --enable-preview -jar app/build/libs/hello-uber-1.0.jar +``` + +You'll end up with a `hello-uber-1.0` file that can be executed directly without +the need of a JVM: + +```bash +./hello-uber-1.0 +``` + +> **NOTE:** RIFE2 support for GraalVM native-image is still in preliminary +> stages. There's no solution yet to replace the features of the RIFE2 Java +> agent, and it's only been tested in a limited context. When expanding the +> code of the project, you most likely will have to update the native-image +> configuration files located in `app/src/main/resources/META-INF/native-image`. +> More information about that can be found in the [GraalVM manual](https://www.graalvm.org/latest/reference-manual/native-image/metadata/). + ## Get in touch Thanks for using RIFE2! diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ef5e230..ad32a36 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -27,8 +27,8 @@ sourceSets.main { } dependencies { - implementation("com.uwyn.rife2:rife2:1.2.1") - runtimeOnly("com.uwyn.rife2:rife2:1.2.1:agent") + implementation("com.uwyn.rife2:rife2:1.3.0") + runtimeOnly("com.uwyn.rife2:rife2:1.3.0:agent") runtimeOnly("org.eclipse.jetty:jetty-server:11.0.13") runtimeOnly("org.eclipse.jetty:jetty-servlet:11.0.13") runtimeOnly("org.slf4j:slf4j-simple:2.0.5") diff --git a/app/src/main/resources/META-INF/native-image/resource-config.json b/app/src/main/resources/META-INF/native-image/resource-config.json new file mode 100644 index 0000000..ad0b0a3 --- /dev/null +++ b/app/src/main/resources/META-INF/native-image/resource-config.json @@ -0,0 +1,8 @@ +{ + "resources":{ + "includes":[ + {"pattern":"^webapp/.*$"} + ] + }, + "bundles":[] +}