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

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

sourceSets {

test {

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

} }

Is this possible?

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 -> … }’).

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 .

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

http://forums.gradle.org/gradle/topics/how_can_we_use_the_programmatic_include_files_syntax_for_sourcesets

Thanks again for the feedback…

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

http://forums.gradle.org/gradle/topics/sourcesets_how_can_i_include_exclude_and_include_again_in_sourcesets_in_that_order

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.

All you need here is include filters.