Code Generation Using Kotlin Symbol Processing (KSP)
summary
Kotlin Symbol Processing (KSP) is presented as a faster alternative to KAPT by parsing Kotlin natively; the talk shows a concrete example that builds a Processor module and a consumer module using SymbolProcessorProvider and a SymbolProcessor that calls Resolver and codeGenerator.newFile to emit code. It covers multi-round processing by deferring symbols via validate = false and explains how to enable incremental builds by declaring inputs and outputs. It notes that Room already supports KSP but many major libraries do not, so additional migration work is needed for production use.
AI-written summary · about
chapters (16)
- 0:00Introduction
- 0:49KSP basics
- 2:14Project setup
- 3:37Symbol processor provider
- 6:06Processor implementation
- 7:49Code analysis
- 9:54Retrieve analysis data
- 10:16Code generation
- 12:01Multi-round processing
- 15:14Multi-round delays
- 17:01Resolver methods per round
- 18:04Incremental processing
- 19:09Incremental implementation
- 21:17Incremental setup
- 23:21KSP roadmap
- 24:26Summary
related talks
36mExploring Kotlin Symbol Processing: A Practical Guide
37mWhy you should positively consider introducing and migrating to KSP
28mMetaprogramming with Kotlin Symbol Processing
26mBuild your own compiler with KSP
35mExploring Kotlin Symbol Processing: A Practical Guide
47mDealing With KSP in Common Code for Android and iOS
36mFact or kapt? Build your next annotation processor with KSP
33mMeta-programming with KSP and Kotlin compiler plugins
