https://kotlinlang.org logo
#ksp
Title
# ksp
n

Norbi

12/14/2023, 11:04 AM
I'm writing a KSP processor that works just fine on the first compilation after clean. But later on an incremental(?) compilation the previously generated files get deleted (by the compiler?) and my processor is not called to generate them again. So I have to clean the Gradle module to force my processor to be called again. (I have just started to experiment with the
ksp.incremental=false
flag but my processor seems to be working as expected with incremental compilation turned off.) Do you have any recommendation how can I debug/fix this problem? (Or similar problems related to incremental processing?) Thanks.
l

Lilian GALLON

12/14/2023, 1:23 PM
I got the same issue, and I got it fixed by specifying
sources
in
Dependencies
that I pass to
output.writeTo(...)
I have something like:
Copy code
output.writeTo(
    codeGenerator,
    Dependencies(true, inputFiles)
)
The
inputFiles
being the files that are used to produce the
output
🙏 1
1
n

Norbi

12/14/2023, 1:45 PM
Thanks, @Lilian GALLON, I will take a look at how to use it in kotlin-poet.
👌 1
d

David Rawson

12/14/2023, 11:29 PM
Maybe you can also look at the logs that you get by manipulating the Gradle properties explained here: https://kotlinlang.org/docs/ksp-incremental.html#reporting-bugs
🙏 1
j

Jithin Murali

01/30/2024, 7:43 AM
Hi, @Norbi, when I try to experiment with
ksp.incremental=false
in
gradle.properties
, the
kspDebugKotlin
task fails when I attempt to build the app. Is there a specific reason for this, or am I missing something?
n

Norbi

01/30/2024, 8:14 AM
Sorry, I don't know, I don't have
kspDebugKotlin
task in my project. Maybe ask in the channel with the error details and stack trace...
j

Jithin Murali

01/30/2024, 8:25 AM
Thanks for replying @Norbi, My error got cleared after i cleared caches and restart studio.
👍🏻 1
5 Views