First, generate the native image configuration files by running the tests annotated with
GenerateNativeImageTrace
with native-image-agent
.
$ ../gradlew nativeImageConfig
The generation process consists of the following 3 sub-steps:
processNativeImageTraces
task processes the native image traces generated by running the tests annotated with@GenerateNativeImageTrace
. It generates the native image configuration atbuild/step-1-process-native-image-traces
.simplifyNativeImageConfig
task simplifies the native image configuration generated byprocessNativeImageTraces
. It generates the cleaned native image configuration atbuild/step-2-clean-native-image-config
.nativeImageConfig
task merges the base configuration atsrc/base-config
and the cleaned native image configuration atbuild/step-2-clean-native-image-config
. It generates the final native image configuration atbuild/step-3-final-native-image-config
.
Then, review the generated native image configuration files at build/step-3-final-native-image-config
to ensure it doesn't contain any irrelevant entries. You can remove such entries by updating the following places:
processNativeImageTraces
task:- the caller-based filters
at
src/trace-filters/caller-filter.json
to filter out entries by call sites.
- the caller-based filters
at
simplifyNativeImageConfig
taskexcludedTypePatterns
andexcludedResourcePatterns
properties inbuild.gradle.kts
to filter out entries by call targets.
nativeImageConfig
task- the base configuration at
src/base-config
to add entries manually
- the base configuration at
You can also annotate more tests classes with @GenerateNativeImageTrace
if you find them trigger the code path
that should be evaluated by native-image-agent
.
If you updated the build configuration or added or removed @GenerateNativeImageTrace
annotation,
repeat the process from beginning.
Step 3: Compare the generated native image configuration to the current configuration and update the current configuration
If you didn't have to update the build configuration, compare the generated native image configuration to
the current configuration at core/src/main/resources/META-INF/native-image/
. If you find any differences,
update the current configuration accordingly and send a pull request.