Can I directly specify groovy scripts to include in sourceSets , rather than combining include/exclude statements?

(Jay Vyas) #1

Rather than combining inclusion/exclusion filters, I’d like to do something like:

sourceSets {

test {

sourceFiles=[“file1.groovy”, “file2.groovy”]

} }

Is this possible?

(Peter Niederwieser) #2

No, it isn’t possible. You must specify one or more directories (or stick to the defaults). However, the include filters will look pretty much like what you have above. In case it helps, you can also use programmatic include filters (‘include { File file -> … }’).

(Jay Vyas) #3

Thanks (again) peter :slight_smile:

So… These programmatic includes seem quite useful. Are they documented anywhere ? Its not clear how the filter is meant to work ?

Or Maybe you can finish off the …'s in your example above .

(Jay Vyas) #4

I’ve created a new question regarding the use of the includes syntax, seems like a separate subject…

Thanks again for the feedback…

(Jay Vyas) #5

Ah ! I found a pretty reasonable example/ answer here:

The key is that EXCLUDES win over INCLUDES, so in order to accomplish this we need to:

  1. Include a whole directory of tests. 2) User exclusion filter to declare a ! operation which filters out all files NOT matching the ones we want to include.

Is there a more direct way.

(Peter Niederwieser) #6

All you need here is include filters.