Exploring Kotlin Symbol Processing: A Practical Guide
summary
Builds a small peoplehub app that stores people in a local DB and uses Kotlin Symbol Processing to auto‑generate a DBMapper interface plus an implementation that maps domain and DB data classes, written with KotlinPoet. KSP claims up to two times faster than KAPT, ties each KSP version to a specific Kotlin compiler, forbids in-place code mutation (only generates new files), supports multiplatform with extra Gradle config, and KSP2 is currently in beta.
AI-written summary · about
chapters (25)
- 0:00Introduction to KSP and the speaker
- 1:29What is Kotlin Symbol Processing
- 3:15Limitations of KAP and compiler plugins
- 5:01Why KSP is a better choice
- 6:29Use cases for KSP in development
- 7:33Setting up KSP in Gradle
- 8:59How KSP models Kotlin code
- 11:05Type resolution in KSP
- 12:29Limitations of KSP
- 13:11Building the PeopleHub demo app
- 16:20Project setup for KSP implementation
- 17:47Creating the GenerateMapper annotation
- 18:52Defining the symbol processor provider
- 19:59Implementing the symbol processor
- 21:23Verifying KSP setup with logs
- 22:24Understanding the resolver in KSP
- 23:07Processing annotations with KSP
- 24:53Generating code with Kotlin Poet
- 26:16Extracting annotation arguments
- 27:39Generating mapper interface and class
- 29:46Adding functions to generated mappers
- 31:33Implementing mapping logic in classes
- 32:36Using KSP in multiplatform projects
- 33:20Future plans for KSP
- 34:25Key takeaways and closing remarks
related talks
36mExploring Kotlin Symbol Processing: A Practical Guide
37mWhy you should positively consider introducing and migrating to KSP
47mDealing With KSP in Common Code for Android and iOS
25mCode Generation Using Kotlin Symbol Processing (KSP)
28mMetaprogramming with Kotlin Symbol Processing
33mMeta-programming with KSP and Kotlin compiler plugins
26mBuild your own compiler with KSP
36mFact or kapt? Build your next annotation processor with KSP
