I have the following situation:
- gradle plugin ‘A’ have some code which can be reused by another plugin
- gradle plugin ‘B’ have (currently) copied some code from ‘A’ which can be reused.
What I want to archive:
Both gradle pluings (‘A’ and ‘B’) should be “depends on” some “common” code.
Each plugin should be work independent from each other. Additional the common code “can’t really work alone”.
Solutions which works but aren’t very “clean” in my opinion:
- Create a “stand alone” gradle plugin and publish it. plugin ‘A’ and ‘B’ use (declare it as dependency) the ‘common’ plugin to use the common code.
- Create a module with the common code from ‘A’ but include the code in ‘A’ (for only one artifact at the end). plugin ‘B’ can make a git submodule and include the common module in its own project like it plugin ‘A’ does.
Something to note:
Both plugins (‘A’ and ‘B’) should be 99% independent from each other. Imagine plugin ‘A’ is developed by company ‘C’ and plugin ‘B’ is developed by company ‘D’.
How can I solve that problem in a “clean”/gradle like way?!
Maybe there are other tips/tricks which can I use to solve it?!