I don't actually think adding includesFile would *necessarily* be bloat in this case. I mean look at the groovy collections API, there are many convenience methods available that you could handle by just doing each and writing a little code. It depends on if the includesFile pattern is something that is commonly used and you want to provide as a conveinence for legacy builds. I don't know actually....in my case it's in a separate file because there are about 50 filters to apply. This is terrible practice IMO, but I wouldn't be surprised if it's common in legacy code bases.
but anyway..... I know groovy pretty well and my original approach was something close your code. I think ant is an abomination and using XML for it was one of the biggest mistakes in the history of the java ecosystem. I wasn't able to get include/exclude on the source set to behave the same way ant include/exclude works. That's why i then investigated the gradle copy task, then ended up with ant.copy. However, maybe I just F'ed up my original code :) I will revisit the groovy approach and see if I can get it to work... thanks phil On Sat, Aug 6, 2011 at 9:40 AM, Daz DeBoer <[email protected]> wrote: > On 6 August 2011 08:12, phil swenson <[email protected]> wrote: >> >> the ant copy patternset "includesfile" pulls in an external text file >> that has all the include patterns (like com/blah/**). ant also has an >> "excludesfile". >> >> if there is a way to convert the sourceset to match this functionality >> so I could avoid the entire copy piece, that would be cool of >> course.... > > If you're coming from an Ant background, you're not used to having the > full power of a dynamic language in your build script. I'd highly > recommend taking the time to learn a little Groovy, which will make > your whole Gradle experience a little more, err, groovy. > One benefit of having groovy available is that it's trivial for you to > implement things like "includesfile", so we don't have to bloat Gradle > to handle every possible contingency. > > Try something like: > > sourceSets { > main { > java { > file('includes.txt').eachLine { line -> > include line > } > file('excludes.txt').eachLine { line -> > exclude line > } > } > } > } > > -- > Darrell (Daz) DeBoer > Principal Engineer, Gradleware > http://www.gradleware.com > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
