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

christopher

03/06/2018, 5:05 AM
I’m playing with my first kapt processor to generate interfaces, and it works when compiled with gradle, but IDEA seems unaware of the processor. I wrote a post over on kotlinlang: https://discuss.kotlinlang.org/t/kapt-idea-doesnt-know-about-generated-classes/6894 if anyone has a moment to take a look at my code.
g

gildor

03/06/2018, 5:52 AM
What is your target directory for generated code? Did you try some existing AP (like Dagger or AutoValue), does it work for you?
Just tried your demo and it’s works for me.
c

christopher

03/06/2018, 6:26 AM
I’ll try a different AP and see if that works then.
Thanks for giving it a try.
g

gildor

03/06/2018, 6:27 AM
Yeah, it’s just work for me On Idea Ultimate 2018.1
c

christopher

03/06/2018, 6:28 AM
Ah, I’m on 2017.3. Also ultimate
g

gildor

03/06/2018, 6:32 AM
Idea and Kotlin plugin actually had some changes recently about detection of generated sources from Gradle. But I pretty sure those changes been released on some 2017.x version Also way as you import project can be different. I use option “Create separate module per source set”, “explicit module groups” and use default gradle wrapper, so actually default settings. I remember that some option can change different source roots behaviour of IDE, but not sure now
c

christopher

03/06/2018, 6:35 AM
I’m going to ask a dumb question: Did you compile (
assemble
at least) before the interface became available? and if you
clean
does it become unresolved again?
Maybe I just have unreasonable expectations…
g

gildor

03/06/2018, 6:38 AM
Yes, you should assemble first (build does assemble too + tests)
yes, correct, after clean Foo is not available anymore
This is default behaviour for Java projects with AP
But for example Android projects generate sources during synchronisation, but it’s completely Android Plugin feature
c

christopher

03/06/2018, 6:41 AM
ah… so I’ve simply been fooled by things like Spring and Lombok, which have IDE plugins, to think that it’s normal for annotations to instantly take effect.
g

gildor

03/06/2018, 6:46 AM
Yes, not sure about Spring code generation, but Lombok should have IDE support, otherwise just nothing will work
4 Views