Hey there,
I'm working on a compiler plugin which generates new files in the AnalysisHandlerExtension.
Everything works fine until I turn on incremental compilation.
The problem is that the compiler has no idea about the relation between the generated files and their "originating files".
The first compilation works fine.
Then when a originating file changes, the compiler only compiles the originating file (Here I create a new generated file). But the compiler starts another compilation round and now compiles both the originating file and the generated file.
And this is the problem. The compiler should not trigger another round only to recompile the two files from the previous round.
I tried to cache the relations between the files and delete the generated ones, when ever a originating one changes, but this does not work, because the dirty generated files are already in the environment of the compiler.
I also tried to manually remove the files via reflection but the compiler can't handle that.
Another thing I tried is to just generate the file again, but this causes other issues, because the compiler analysis the old version of the file which may have errors in it.
Is there a workaround for my issue?
Thanks for your reply.
So basically the plugin runs without incremental compilation or did i miss something?
r
ralf
09/28/2020, 6:20 PM
It disables incremental compilation for the tasks that would be otherwise broken. It doesn’t do this for all tasks.
m
Manuel Wrage
09/28/2020, 6:28 PM
Ok. Have you noticed any performance hits by doing that?
Do you access descriptors or only psi elements?
r
ralf
09/28/2020, 6:36 PM
Both. Sure, there’s a perf hit. Slack looked into the plugin and they saw a large increase. In our case it was minimal, because the modules in which we run Dagger and the compiler plugin are tiny.