Reputation: 803
I have a gradle project with composite build. I have to get the source files collection to use in jacoco instrumentation. Is there any to get the source directories of all included builds.
settings.gradle
rootProject.name = 'my-composite'
includeBuild 'my-app'
includeBuild 'my-utils'
I am currently using files method to get the collection in build.gradle
project.ext.files1 =
fileTree("C:/my-composite/my-app/src").matching {
include '*.java'
}
project.ext.files2 =
fileTree("C:/my-composite/my-utils/src").matching {
include '*.java'
}
project.ext.allFiles = project.ext.files1.plus(project.ext.files2)
can we generate the source list dynamically using gradle.includedBuild('my-app')? (or) Is there any way to use a task to return source directory of each inculdede build? or is there any other way to do it?
Upvotes: 3
Views: 564
Reputation: 171084
Should be able to do:
fileTree(gradle.includedBuild("my-app").projectDir.resolve("src")).matching {
include("*.java")
}
Upvotes: 1