I created my plugin to use PSI
api from JetBrains
to parse all kotlin files and gather the annotations info then generate all the classes. That hit the wall due to the complexity of reading annotation’s params.
So I have switched back to the idiomatic way which is to leverage the power of the Annotation Processing
and use its API
to read and manipulate/generate the necessary source files.
Getting back to your previous suggestions, I have tried them all but I am still facing the same problem. Also adding a SourceSet
to android is not that trivial cuz it requires adding an extra buildType
which certainly creates all the default compile
tasks but it will not recompile the service
project for some reason.
We have gone so far and deep though this issue so getting back to roots sounds like a good thing to me. The original problem occurs when :service:CompileDebugKotlin
task (the task responsible for compiling the source code in service
module) is getting executed before any of the dependant module got the chance to generate their source (A.K.A executed their annotation processors.).
If there is a way to delay the service
from compiling it sources just until all dependant modules have finalised their annotation processing task (kaptDebugCompile
) and copied the file back to service
build folder. Now when service
runs the task compileDebugKotlin
it will be aware of the new files and everything will work fine later when the dependant modules will execute their own compileDebugKotlin
because they will see the binaries compiled in service
.
I am sorry if my problem frustrated you, sure thing it did that to me and still does since a month now. I can’t really let this go cuz I feel that it’s pretty possible to achieve if I manage to figure our the correct project config.
Million thanks @Lance you’ve been brilliant