Hi
I’m trying to write small gradle script (in groovy) that process selected files from my project, parse its kotlin content to extract data and write them to other file.
I was hoping to use kotlin-compiler-embeddable to extract the data in easy way (as I probably need to use code parser, and from searching I found compiler do support that).
I had found examples of using compiler to extract whole files, but they are not gradle tasks and are using older version of compiler.
My project is using kotlin 1.3.72, and with this version i do get exception while running the script:
Execution failed for task '[...]'.
> org/jetbrains/kotlin/com/intellij/ui/RowIcon
I can’t find solution for this crash, or package that would provide this dependency, but after downgrading compiler to 1.3.50 all is working.
Do anyone have suggestion on how to use latest version or the proper way to parse kotlin file in groovy gradle task?
Code I use for parsing the file:
KtFile ktfile = PsiManager.getInstance(project)
.findFile(localFileSystem.findFileByPath("path/to/file.kt"))
println(ktfile.getDeclarations())