Hey all,
I have a multi-module Android project which contains multiple applications. Each one of those application modules includes a set of interfaces that an annotation processor will use to generate code based on the class-path of this module. Today, those interfaces are duplicated, and I can't move them to a shared module due to the code generation requirement (class-path).
I tried to create a shared folder and include it as a source directory to all those application modules (I know this sounds ridiculous, but I did not find another way...) but, for some reason, only one of the application modules randomly recognized the folder as part of it (sourceroot) and the others fails (both at IDE and compilation level).
Is there a way to include a piece of code in multiple modules to be compiled and processed inside the included module?
I appreciate any help you can provide.
v
Vampire
03/07/2021, 1:17 AM
If you are working on *nix you could probably symlink the directory which should then also work in the IDE.
In Gradle itself it should probably work to just reference the sources multiple times if done correctly, but it could well be that it is not IDE-compatible.
m
Marcello Galhardo
03/07/2021, 3:54 PM
In Gradle I tried to use sourcesets/srcDirs but looks like a sourcesets can have only one "source root" and therefore, it failed. :-(
v
Vampire
03/07/2021, 11:30 PM
What do you mean with can only have one source root?
I just recently wrote a build where the main source set has checked in code in
Yes, as I said, that it does not work in IntelliJ is known, or at least I knew that.
But you said it also does not work in Gradle and that is what confuses me because in Gradle it should work just fine.