Meta-programming with KSP and Kotlin compiler plugins
summary
Claims that KSP runs noticeably faster than kapt (marketing says ~2×), that it has a stable processor API and Java source support, and that it only generates new Kotlin code (no expression-level edits) are all stated. Actual compiler work hits the IR: kotlin compiler plugins can add synthetic declarations, mutate IR at expression level, and enable things like Swift code generation for KMM (example: Sky) that successfully links into frameworks. Downsides: complex setup, unstable APIs across Kotlin releases, heavy testing burden, and stricter Kotlin/Native requirements.
AI-written summary · about
chapters (7)
- 0:00Start
- 0:54Agenda
- 12:33Compiler plugins
- 19:46SyntheticResolveExtension
- 20:41IrGenerationExtension
- 22:17Setting up
- 37:10Recap
related talks
33mMeta-programming with KSP and Kotlin compiler plugins
38mKSP and Plugins. Optimizing Kotlin Multiplatform common code
15mOn the Applicability of Annotation-Based Source Code Modification in Kotlin (Work...
37mWhy you should positively consider introducing and migrating to KSP
26mBuild your own compiler with KSP
36mMeta-programming with Kotlin compiler plugins
47mDealing With KSP in Common Code for Android and iOS
35mK2 compiler in production
