KSP and Plugins. Optimizing Kotlin Multiplatform common code
summary
Demo builds a KSP annotation processor that reads Kotlin AST, generates Kotlin source files for dependency registration, and compiles them into the multiplatform module; it speeds up work vs KAPT but cannot modify existing files and needs generated-source path tweaks. A second piece is an IR-based compiler plugin that injects lazy fields and adds automatic registration by lowering IR; it produces no source artifacts and runs correctly but is harder to implement and relies on an experimental IR backend. Both target Android and iOS.
AI-written summary · about
chapters (13)
- 0:00Introduction and speaker intro
- 1:08Kotlin Multiplatform overview
- 4:40Dependency injection challenges
- 7:14Kotlin Symbol Processing basics
- 12:35Setting up KSP in project
- 16:58Connecting KSP to annotations
- 17:20Kotlin compiler plugins overview
- 18:28Plugin structure and components
- 20:55Transformer for lazy injection
- 27:15KSP output and verification
- 28:39Automating registration with plugins
- 35:04Comparison of KSP and plugins
- 36:29Summary and final thoughts
related talks
47mDealing With KSP in Common Code for Android and iOS
33mMeta-programming with KSP and Kotlin compiler plugins
15mOn the Applicability of Annotation-Based Source Code Modification in Kotlin (Work...
44mMeta-programming with KSP and Kotlin compiler plugins
26mBuild your own compiler with KSP
37mWhy you should positively consider introducing and migrating to KSP
36mFact or kapt? Build your next annotation processor with KSP
36mMeta-programming with Kotlin compiler plugins
