SourceDirectorySet filtering

The filtering for SourceDirectorySets is currently broken. The include/exclude patterns don’t apply to directories. So the the getSrcDirTrees method will return all source folders even though some of them are completely excluded by a filter.

One use case is with Xtext languages: They can link against Java and can produce Java code themselves. So my input is “all Java source directories minus my own output directories”. This currently does not work, so I have to subclass internal API to work around it.

Hey stefan, can you create a reproducable example for this that demos your issue?


apply plugin: 'java' {
  exclude "**/src/main/java/**"
  //includes src/main/java, even though that is completely filtered
  // see DefaultSourceDirectorySet#126