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
Czar
01/29/2019, 2:36 PM
There's kapt for annotation processing. And you can implement your own code generators, e.g. by using kotlin poet
j
jdemeulenaere
01/29/2019, 3:31 PM
Annotation processing works only for Kotlin JVM, I want something similar for any platform 🙂
c
Czar
01/29/2019, 3:34 PM
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
karelpeeters
01/29/2019, 6:46 PM
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
jdemeulenaere
01/29/2019, 8:59 PM
Yeah I have noticed a few things inside the repository regarding IR but I'm being impatient for an official (beta/experimental) release.. 🙂
l
louiscad
01/30/2019, 6:54 AM
You can make a gradle plugin that uses KotlinPoet, like SqlDelight is doing.
j
jdemeulenaere
01/30/2019, 1:49 PM
Generating code is not the problem, reading (and maybe modifying) the AST in a proper way is 🙂