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 following three configuration directories into the final native image configuration atbuild/step-3-final-native-image-config
:- the base configuration at
src/base-config
- the previously generated configuration at
../core/src/main/resources/META-INF/native-image
; and - the cleaned native image generated at the step 2.
- the base configuration at
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
Replace the previous configuration with the newly generated one:
$ cp -vf \
build/step-3-final-native-image-config/*.json \
../core/src/main/resources/META-INF/native-image/com.linecorp.armeria/armeria
Review the changes with the tools like git diff
and send a pull request.