Excluding empty directories from SourceSets


(Ahsan Rabbani) #1

Can I exclude empty directories from SourceSets, similar to how the Copy task has that option? We have numerous cases where some of our resources are placed in the actual source directory itself unfortunately. So by adding the source directory as a resources directory I end up with a huge output resources tree with mostly empty directories.


Build-Cache issue - How to Exclude empty directories from compile
(Peter Niederwieser) #2
sourceSets.all {
  tasks[processResourcesTaskName].includeEmptyDirs = false
}

Or even:

tasks.withType(Copy) {
  includeEmptyDirs = false
}

(Ahsan Rabbani) #3

Thanks. I didn’t realize the processResources task extended Copy.