I have a question, I have a gradle plugin I made t...
# gradle
m
I have a question, I have a gradle plugin I made that generates code using KotlinPoet, and it puts the code file in build/generated/bot-compiler-plugin/Code/Commands, but its not being registered as a sources root, like SQL Delight does, and I am not sure how to make it do that I am using Gradle 6.5.1 with kts gradle.build files, and am using the MyApt library for annotation preprocessing to generate the kotlin code
Here is a image comparing my root to SQL Delight
v
Get the
main
source set, get the
java
source directory set from it, call
srcDir
on it with the directory you generate to.
And if you want to improve the IntelliJ integration, you can also mark the directories as generated sources like here: https://github.com/Vampire/command-framework/blob/master/buildSrc/src/main/kotlin/net/kautler/antlr.gradle.kts#L59
❤️ 2
j
Have a look at my https://github.com/jillesvangurp/es-kotlin-client project. It uses a similar setup to what you are describing and generates code via this plugin: https://github.com/jillesvangurp/es-kotlin-codegen-plugin
❤️ 1
Note you might also have to declare dependencies, to your codegen task.
And if you're using Android/Multiplatform, the setup is slightly different