From c29e88a15583b1fbece4cfcd7a6aadd00353a6ac Mon Sep 17 00:00:00 2001 From: Stephan Behnke Date: Thu, 19 Dec 2024 16:03:44 -0800 Subject: [PATCH] Update GraalVM config --- temporal-test-server/README.md | 17 +++++++++++++---- temporal-test-server/build.gradle | 5 +++-- temporal-testing/build.gradle | 15 ++++++++++++++- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/temporal-test-server/README.md b/temporal-test-server/README.md index 7bacde5d6..bce26d3fa 100644 --- a/temporal-test-server/README.md +++ b/temporal-test-server/README.md @@ -38,9 +38,18 @@ This will result in a local image being built: ## GraalVM native-image configuration -The GraalVM native-image compiler uses the native-image.properties file and the +The GraalVM native-image compiler uses the `native-image.properties` file and the referenced JSON files during compilation. The JSON files are generated by running the test server java code in a JVM configured with the [GraalVM tracing -agent](https://www.graalvm.org/latest/reference-manual/native-image/metadata/AutomaticMetadataCollection/) configured, -e.g. with the flag -`-agentlib:native-image-agent=config-output-dir=temporal-test-server/src/main/resources/META-INF/native-image/io.temporal/temporal-test-server`. +agent](https://www.graalvm.org/latest/reference-manual/native-image/metadata/AutomaticMetadataCollection/): + +:warning: Only code that is *executed* will be picked up by the agent. + +Steps: + +1. [Install GraalVM](https://www.graalvm.org/downloads/) +2. Run the SDK tests with the GraalVM tracing agent: + ``` + ./gradlew temporal-testing:test -Pagent=standard + ``` + Make sure that `JAVA_HOME` is pointing at the GraalVM installation. diff --git a/temporal-test-server/build.gradle b/temporal-test-server/build.gradle index a6bb98f94..454e40fc5 100644 --- a/temporal-test-server/build.gradle +++ b/temporal-test-server/build.gradle @@ -1,13 +1,14 @@ buildscript { ext { // 0.11.0 and later are build on JDK 11 bytecode version - graalVersion = "${JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_11) ? '0.12.0' : '0.10.0'}" + graalPluginVersion = "${JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_11) ? '0.12.0' : '0.10.0'}" } } plugins { id 'application' - id 'com.palantir.graal' version "${graalVersion}" + // TODO: This project is not used internally at palantir and is no longer maintained. It will soon be archived. + id 'com.palantir.graal' version "${graalPluginVersion}" id 'com.google.protobuf' version '0.9.2' } diff --git a/temporal-testing/build.gradle b/temporal-testing/build.gradle index 606f88fcc..18cd0e2fe 100644 --- a/temporal-testing/build.gradle +++ b/temporal-testing/build.gradle @@ -1,5 +1,6 @@ plugins { id 'application' + id 'org.graalvm.buildtools.native' version '0.10.4' } description = '''Temporal Workflow Java SDK testing''' @@ -33,6 +34,18 @@ dependencies { testRuntimeOnly group: 'ch.qos.logback', name: 'logback-classic', version: "${logbackVersion}" } +graalvmNative { + // Dependency resolution is looking for a library compatible with JVM runtime version 8, + // but 'org.graalvm.buildtools:junit-platform-native:0.10.4' is only compatible with JVM runtime version 11 or newer. + testSupport = false + + agent { + metadataCopy { + outputDirectories.add("temporal-test-server/src/main/resources/META-INF/native-image/io.temporal/temporal-test-server") + } + } +} + test { useJUnitPlatform() -} +} \ No newline at end of file