|
| 1 | +# app-kmp-klib — KLIB target regression sample |
| 2 | + |
| 3 | +A minimal Kotlin Multiplatform app exercising the **KLIB-serialized** targets |
| 4 | +(`wasmJs`, `iosArm64`) that the JVM box tests can't cover. It is the repro behind |
| 5 | +compiler **#40** (wasmJs) and **#44** (iOS). |
| 6 | + |
| 7 | +`App.kt` declares the same `@InjectedParam` target collected by **two |
| 8 | +`@ComponentScan` modules** — the exact shape that emitted the `injectedparams_*` |
| 9 | +hint twice and broke KLIB serialization. |
| 10 | + |
| 11 | +## Build |
| 12 | + |
| 13 | +```bash |
| 14 | +# from the repo root: publish the plugin to mavenLocal first |
| 15 | +./install.sh |
| 16 | + |
| 17 | +cd playground-apps/app-kmp-klib |
| 18 | +../../gradlew compileKotlinIosArm64 # Kotlin 2.3.20 (floor) |
| 19 | +../../gradlew compileKotlinIosArm64 -PkotlinVersion=2.4.0 |
| 20 | +../../gradlew compileKotlinWasmJs |
| 21 | +../../gradlew compileKotlinWasmJs -PkotlinVersion=2.4.0 |
| 22 | +``` |
| 23 | + |
| 24 | +## Expected results |
| 25 | + |
| 26 | +| Target | Kotlin 2.3.20 | Kotlin 2.4.0 | |
| 27 | +|---|---|---| |
| 28 | +| `iosArm64` (annotations) | ✅ | ✅ | |
| 29 | +| `wasmJs` (DSL) | ✅ | ✅ | |
| 30 | +| `wasmJs` (annotations / `@ComponentScan`) | ❌ `KT-82395` | ✅ | |
| 31 | + |
| 32 | +- **iOS** and **wasmJs-DSL** pass on both Kotlin versions — the duplicate-signature |
| 33 | + fix (single hint per target) and the IR-hint source-attribution fix. |
| 34 | +- **wasmJs + annotations on Kotlin 2.3.20** fails with |
| 35 | + `IllegalStateException: No file found for source null`. This is a **Kotlin 2.3.20 |
| 36 | + compiler bug** ([KT-82395](https://youtrack.jetbrains.com/issue/KT-82395)) in the |
| 37 | + JS/Wasm KLIB metadata serializer: the FIR cross-module discovery hints are placed |
| 38 | + in a framework-created file with no resolvable source. The Native backend tolerates |
| 39 | + it; the 2.3.20 wasm/js backend does not. **Fixed by Kotlin 2.4.0** — use Kotlin |
| 40 | + 2.4.0 for annotation-based wasmJs. |
| 41 | + |
| 42 | +> Not wired as a CI gate: the wasmJs-annotation cell is Kotlin-version-dependent by |
| 43 | +> design (passes on 2.4.0, blocked by KT-82395 on 2.3.20). |
0 commit comments