Can we run ksp plugin on raw input string of source code?
03/25/2023, 4:37 PM
You mean Android raw resources or just some const string in code?
03/25/2023, 4:44 PM
Just some constant string. Imagine there will be some IDE plugin or desktop app getting some source code and we want to generate something by parsing this code. I’m trying to utilize tokenization from ksp, a string of source code should give me something like this which I could use to write generation code
03/25/2023, 4:46 PM
You will need some annotation somewhere that references the class/file and then you should be able to find it. And i "think" we had an API to get the value of a property if it is constant but I'm not 100% sure
03/26/2023, 5:23 PM
we can only do this on annotation argument values, or returns true/false about if a property declares default value.
03/27/2023, 2:03 PM
Yes, the input string of source code will have target annotation, just want to understand if I could invoke code generator on demand at runtime or execute as java command
03/29/2023, 11:51 AM
what do you mean by at runtime or as java command? We do have a command line artifact.
03/29/2023, 12:00 PM
To give one example, let’s say I have some tool, could be desktop app / web app which will take Kotlin Annotated Code as input from some textbox, and I want to generate json file out of it. To be able write json properly, I need kotlin code parser, which when provided with source code string, will give me something like this.