Is there still no Gradle plugin to generate Kotlin...
# announcements
j
Is there still no Gradle plugin to generate Kotlin code based on (any platform) Kotlin code (similar to java annotation processors), or any kind of plans/KEEP for metaprogramming in Kotlin ? Something like official compiler API to manipulate (or even read only) the AST would be really nice.
c
There's kapt for annotation processing. And you can implement your own code generators, e.g. by using kotlin poet
j
Annotation processing works only for Kotlin JVM, I want something similar for any platform 🙂
c
Oh, I see, I've misunderstood the question. I don't think there is anything like that, at least I haven't seen or heard anything about it, but I haven't purposefully researched the topic.
k
Yes, they're planning a an official compiler plugin API. There are hints about it scattered trough a lot of videos and forums, eg. here's a sentence about it:

https://youtu.be/FAhR_sqlUy4?t=848â–¾

j
Yeah I have noticed a few things inside the repository regarding IR but I'm being impatient for an official (beta/experimental) release.. 🙂
l
You can make a gradle plugin that uses KotlinPoet, like SqlDelight is doing.
j
Generating code is not the problem, reading (and maybe modifying) the AST in a proper way is 🙂