I’m playing with my first kapt processor to genera...
# kapt
c
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
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
I’ll try a different AP and see if that works then.
Thanks for giving it a try.
g
Yeah, it’s just work for me On Idea Ultimate 2018.1
c
Ah, I’m on 2017.3. Also ultimate
g
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
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
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
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
Yes, not sure about Spring code generation, but Lombok should have IDE support, otherwise just nothing will work