For example I have 3 modules (A, B and C), where A depends on B, and B on C (A->B->C). Module A is entry point for build process, no other module depends on it, like :app module in Android apps. Module A and C have the same flavor dimension and the same set of flavors (eg. flavor1, flavor2, flavor3, flavor4, etc…). Module B doesn’t have any flavors.
Now the question is: how to define these dependencies to be “transitive” in a way that module A i module C always match in flavor even when module B doesn’t have flavor?
module A(flavor1) -> module B -> module C(flavor1)
module A(flavor2) -> module B -> module C(flavor2)
module A(flavor3) -> module B -> module C(flavor3)
etc…
If all 3 modules had the same flavors, Gradle would automatically matched them, but since B doesn’t have flavors, error occurs which is already described in this question: Single flavor module based on multi flavor library in Gradle but non of answers is really relevant
What I need with this is now if I run ./gradlew buildFlavor1Debug to get module A and C with flavor1, and in general to have all modules which know about flavors to match with the flavor given on start of the chain and for modules which don’t know about flavors just to forward/ignore them.
The problem with missingDimensionStrategy ‘dimension’ is that it requires flavor in dependency to be hardcoded/fixed, not dynamic based on entry point of the build, for example: missingDimensionStrategy ‘myDimension’ ‘flavor1’
module A(flavor1) -> module B -> module C(flavor1)
module A(flavor2) -> module B -> module C(flavor1)
module A(flavor3) -> module B -> module C(flavor1)
etc…