Skip to content

Commit

Permalink
Update GraalVM config
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanos committed Dec 20, 2024
1 parent 53a8af7 commit c29e88a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
17 changes: 13 additions & 4 deletions temporal-test-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
5 changes: 3 additions & 2 deletions temporal-test-server/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
}

Expand Down
15 changes: 14 additions & 1 deletion temporal-testing/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'application'
id 'org.graalvm.buildtools.native' version '0.10.4'
}

description = '''Temporal Workflow Java SDK testing'''
Expand Down Expand Up @@ -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()
}
}

0 comments on commit c29e88a

Please sign in to comment.