To add a simple dependency on sets of test sources from another subproject, I can do:
testCompile project(':subFoo1').sourceSets.test.output
This solution works, but in many cases it is not intended to add the entire source set as a dependency. For example, I would like to use only test data collectors, in which case files such as test-logback.xml (and regular tests) pollute my test path in the main module.
I tried the idea with a test JAR (which could filter the content, but it is problematic as a dependency) and some combination with eachFileRecurse, but without any luck.
My question is . How to add only a subset of the given source sets (for example, only classes with collectors matching the pattern **/*Builder.*) as a testCompile dependency in another subproject?
source
share