filesMatching and filesNotMatching should support multiple patterns

The filesMatching and filesNotMatching methods (http://www.gradle.org/docs/current/javadoc/org/gradle/api/file/CopySpec.html#filesMatching(java.lang.String,%20org.gradle.api.Action)) should support multiple patterns, so that you can write something like

task copyFiles(type: Copy) {

from ‘src/files’

into ‘$buildDir/copied-files’

// Replace the version number variable in only the text files

filesMatching([’/*.txt’, '/*.properties’]) {

expand version: “1.0”

}

}

Currently you would have to do something like

task copyFiles(type: Copy) {

from ‘src/files’

into ‘$buildDir/copied-files’

// Replace the version number variable in only the text files

[’/*.txt’, '/*.properties’].each {

filesMatching(it) {

expand version: “1.0”

}

}

}

1 Like

This is a good idea.

Would you be interested in contributing this?

Actually I mostly contribute stuff that bugs me personally - like PR #272 and #273 that I opened 2 weeks ago and that await merging hopefully - and I don’t use that feature. I just have seen it in the release notes and thought this addition would be helpful for someone who uses it. :slight_smile: Maybe if I get bored and want my name again in the release notes I’ll add it, but I cannot promise I’ll address this.

No problem and no pressure. I should have taken more time to notice that you are already a contributor and didn’t need any nudging.

Thanks.