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”
}
}
}