https://kotlinlang.org logo
#kapt
Title
# kapt
s

spierce7

02/04/2018, 11:14 PM
how does the kapt build cache work? Does it figure out which code effects the annotation processor, and re-run when it changes, or does it just only ever run once (which seems like it would be really bad)?
kapt.useBuildCache = true
y

yan

02/05/2018, 8:43 PM
^ @h0tk3y
h

h0tk3y

02/05/2018, 8:51 PM
Currently, the cache key for the kapt tasks is mostly the same as that for the compilation tasks (sources, classpath, compiler classpath, compiler arguments etc.) plus the annotation processors classpath & options. If the annotation processors that you use only depend on the sources & classpath, produce only Java/Kotlin sources and classes, and are pure (give the same outputs for the same inputs), it's fine to cache them. Many annotation processors fall into this category, so you can just try and see if the cache works for you. If they read or write anything beside that, it's up to you to add those things as inputs/outputs to the kapt tasks.
Basically, it will re-run just fine on changes in your sources and classpath.
s

spierce7

02/06/2018, 3:36 PM
Thanks 🙂
that sounds great
4 Views