Norbi
11/29/2023, 5:46 PMProcessorA
generates class a.b.ClassA
2. ProcessorB
enumerates declarations in package a.b
using com.google.devtools.ksp.processing.Resolver#getDeclarationsFromPackage
and generates one aggregated class a.b.Aggregated
from them.
If ProcessorB
is executed before ProcessorA
then ProcessorB
is called one more time for a round#2.
I tried to cache data about the classes processed in round#1 in the ProcessorB
instance but when I try to regenerate a.b.Aggregated
in round#2 then a kotlin.io.FileAlreadyExistsException: .../Aggregated.kt
exception is thrown, despite using aggregating = true
.
Maybe do you have an idea what should I try? Thanks.Norbi
11/29/2023, 6:04 PMFileAlreadyExistsException
.ephemient
11/29/2023, 6:13 PMNorbi
11/29/2023, 7:22 PMephemient
11/29/2023, 7:33 PMprocess
is called through multiple rounds (make sure not to cache the symbols themselves, https://kotlinlang.org/docs/ksp-multi-round.html#information-consistent-cross-rounds) and then write out the aggregation in finish
Norbi
11/29/2023, 9:01 PMfinish()
until now (probably simply because there was no need for it 🙂 ).
Thanks for the very useful idea.