MinecraftForge/ForgeGradle — pull request #23 by bdew (2013-12-06 00:53:38+00:00)
Title: SourceCopyTask should respect includes/excludes on the sources

I probably didn't explain too well what's going on...

SourceDirectorySet has 2 PatternSet's, filter and patterns.

Filter contains some default filter added by the language plugin (so for java it's something like "**/*.java" by default), that's the one you apply in current code.

Patterns is empty by default, when you add includes/excludes in sourceSets, they go there. That's what my patch adds to SourceCopyTask.

In my patch i'm constructing a new PatternSet from those patterns because the field that holds them is private and not exposed via the gradle API. Looking at gradle source it looks like it's meant to use the SourceDirectorySet object itself which implements the PatternFilterable interface (using that second PatternSet) but it doesn't work with FileTree.matching() because later gradle tries to cast it directly to PatternSet instead of using the interface and crashes.