Hello folks, I’m working in a personal project tha...
# compiler
a
Hello folks, I’m working in a personal project that has the purpose of injecting the annotated classes names into the
okhttp3.OkHttpClient
bytecode. To do it, i tried to use the gradle transformation API with two transformers. The first one iterating over project classes and storing the annotated classes names and the second one visiting the
OkHttpClient
bytecode and injecting the references. Then here the problem begins, the transformers are running in parallel and I didn’t find any way to make them run sequentially. Then, there’s no guarantee that all project’s classes were visited when manipulating the bytecode. To solve it, I thought to use kotlin compiler plugin, since its task runs before the instrumentation task. On KCP, I iterate over annotated classes through
IrGenerationExtension
, generate a kotlin class containing the list of annotated classes and add it to the sourceSet. It works, but partially. because the generated file isn’t included on current build. Meaning that I need to build project twice to get current changes (that is, on a clean build, the generated class it’s not even included on .dex). I would like to know if someone already needed to generate a class in time able to be included on current build. (or better, if is there a solution for that problem using only gradle plugin). btw, also tried to use ClassGraph to list annotated classes directly on Gradle plugin, but I didn’t managed to get the project’s classpath before project evaluation (what is already too late to apply transformation) best regards