From 8c126e9a0370ace22b9293ea7616a59a25e5e89d Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Tue, 24 Nov 2026 00:55:37 +0100 Subject: Document how to build the OFA Kotlin compiler native image native-image/kotlin-2.4.21-native-image.patch is the change to the Kotlin repository at v2.4.21. It bundles parcelize and plugin jars from outside the repository, adds the constructor metadata that the plugin loader needs, and adds G1, PGO and GraalVM home options. It also has the reachability metadata collected from OFA modules. native-image/build.sh runs the plain, instrumented and PGO builds, and native-image/README.md describes the full procedure and the results. Co-Authored-By: Claude Opus 5.5 --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 7d1e5b6..fb658fc 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,16 @@ kotlin-proxy/ │ ├── fallback.txt # other cached KGP versions (definition lookup only) │ └── .stamp # versions the lists were generated for (drift detection) ├── dist/kotlin-proxy-compiler-stubs.jar # the artifact +├── native-image/ # how to build the OFA Kotlin compiler native image +├── tools/collect_metadata.py # collects native image reachability metadata from a compile +├── tools/ic_check.sh # checks incremental compilation in the OFA build └── test_project/ # AGP test app that consumes the jar ``` +The stub runs a GraalVM native image of the Kotlin compiler, which +`kotlin.proxy.nativeImage` points to. `native-image/README.md` describes how to +build that image with the compiler plugins OFA needs. + ## Building `dist/kotlin-proxy-compiler-stubs.jar` ```bash @@ -330,7 +337,7 @@ via `org.gradle.jvmargs` or the daemon's own args): | property | default | meaning | |---|---|---| | `kotlin.proxy.pgoProfileDir` | unset | for an image built with `--pgo-instrument`: each compile writes `/.iprof`. Merge them with `native-image-utils merge-pgo-profiles --input-dir= --output-file=`. | -| `kotlin.proxy.nativeImage` | unset | native-image distribution root (it holds `bin/kotlinc-native-image.sh`), for example `~/source/kotlin/prepare/compiler-native-image/build/dist`. If unset, the stub downloads the JetBrains release into `/native-image/`. | +| `kotlin.proxy.nativeImage` | required | native-image distribution root (it holds `bin/kotlinc-native-image.sh`), for example `~/source/kotlin/prepare/compiler-native-image/build/dist`. Compilation fails if it is not set. See `native-image/README.md`. | The marker file is what proves the stub ran **inside the out-of-process daemon** (its thread name is `RMI TCP Connection(N)`), regardless of the -- cgit v1.3.1