I’m having an issue with incremental compilation. I’ve read the docs and used
ksp.incremental.log=true
(very helpful, btw!) so I think I understand what is going on.
My generated file (aggregating) relies on both a symbol in sources acquired with
getSymbolsWithAnnotation
and a set of classes on the classpath (via
getDeclarationsFromPackage
). The file’s originating elements reflect this, as do the ksp incremental logs, so the dependencies seem correctly understood by KSP.
My problem is that when there are classpath changes and the processor incrementally runs, KSP sees that only the classpath files changed and does not consider my source file as dirty, so my call to
getSymbolsWithAnnotation
does not return anything. This is problematic because I need both the symbol in source as well as the classpath files to generate my output file, and this fails when I cannot get the source symbol with
getSymbolsWithAnnotation
.
I understand why KSP does this, and it is optimal for some cases, but it makes generating a file that depends on both sources and classpath difficult - I think I would have to work around this by manually getting all files and parsing them.
Would it be reasonable instead for KSP to look at the set of inputs to a generated file, and if any one of those input is a classpath change then consider the rest of the inputs as dirty as well? according to the docs this is already done with sources, but maybe not for classpath changes?
Propagation by input-output correspondence: If a source file is changed or affected, all other source files having some output in common with that file are affected.