Use this map to understand how room metadata becomes generated schema constants.
- Processor type: KSP
SymbolProcessor - Processing entrypoint:
Provider->Processor - Codegen library: KotlinPoet
- Output writer: KSP
CodeGenerator
- Consumer annotates Room entity with
@EntitySchema. ProvidercreatesProcessorfor the current symbol-processing environment.Processorfinds annotated symbols inprocess(...)and forwards validKSClassDeclarationinstances.Candidateextracts table name,@ColumnInfocolumns, and@Embeddedprefixes.ClassFactorybuilds KotlinPoetTypeSpecandFileSpec.- KotlinPoet output is written through the KSP
CodeGenerator.
| Step | File |
|---|---|
| Annotation API | annotations/src/main/kotlin/co/anitrend/support/query/builder/annotation/EntitySchema.kt |
| Processor entrypoint | processor/src/main/kotlin/co/anitrend/support/query/builder/processor/Provider.kt |
| Processor implementation | processor/src/main/kotlin/co/anitrend/support/query/builder/processor/Processor.kt |
| Candidate creation helpers | processor/src/main/kotlin/co/anitrend/support/query/builder/processor/extensions/CodeAnalyserExtension.kt |
| Metadata model | processor/src/main/kotlin/co/anitrend/support/query/builder/processor/model/Candidate.kt |
| KotlinPoet output commit | processor/src/main/kotlin/co/anitrend/support/query/builder/processor/factory/ClassFactory.kt |
| Column mapping | processor/src/main/kotlin/co/anitrend/support/query/builder/processor/model/column/ColumnItem.kt |
| Embedded mapping | processor/src/main/kotlin/co/anitrend/support/query/builder/processor/model/embed/EmbedItem.kt |
| Table mapping | processor/src/main/kotlin/co/anitrend/support/query/builder/processor/model/table/TableItem.kt |
- Processor module applies the KSP plugin and depends on
:annotations. - Sample module consumes processor with
ksp(project(":processor")). - The processor test harness uses the Zac Sweers kotlin-compile-testing fork with KSP enabled.
The migration to KSP is complete in current source:
ProviderandProcessordefine the current entrypoint shape.- Symbol traversal is KSP-based through
KSClassDeclarationand related symbols. - Generated Kotlin is emitted through
CodeGeneratorplus KotlinPoet. - Module and sample wiring use
ksp(...). - Validate schema stability with
./gradlew :processor:testand./gradlew :sample:kspDebugKotlin.
- KSP overview: https://kotlinlang.org/docs/ksp-overview.html
- Android KSP migration: https://developer.android.com/build/migrate-to-ksp
- KotlinPoet: https://square.github.io/kotlinpoet/