nice. that's what i was looking for - just had my syntax off a bit. Not sure why you put the -> in "def setupClosure = { ->"
works fine without it. what does that do? On Thu, Oct 6, 2011 at 3:22 PM, Rene Groeschke <gra...@breskeby.com> wrote: > Hi Phil, > the obvious way to reduce your duplications is to make your build file a > bit more groovy. remember: gradle files are groovy code. so you can start on > refactoring your build file with something like this: > > ------------- > def setupClosure = { -> > > srcDirs = ["../../src/java/core"] > file('../../build/**dependencies/compile/bpo-**config.txt').eachLine { > line -> > include line > } > > file('../../build/**dependencies/compile/bpo-**config-exclude.txt').eachLine > {line -> > exclude line > } > } > sourceSets.main.java setupClosure > sourceSets.main.resources setupClosure > ------------- > > That snippet is just a starter. I am sure it can be refactored to be even > more groovy. > > regards, > René > > > > Am 06.10.11 22:39, schrieb phil swenson: > > This is awfully repetitive - the closure is identical. I tried a few >> techniques, all which failed. Suggestions? >> >> sourceSets.main.java { >> srcDirs = ["../../src/java/core"] >> file('../../build/**dependencies/compile/bpo-**config.txt').eachLine { >> line -> >> include line >> } >> >> file('../../build/**dependencies/compile/bpo-**config-exclude.txt').eachLine >> { line -> >> exclude line >> } >> } >> >> sourceSets.main.resources { >> srcDirs = ["../../src/java/core"] >> file('../../build/**dependencies/compile/bpo-**config.txt').eachLine { >> line -> >> include line >> } >> >> file('../../build/**dependencies/compile/bpo-**config-exclude.txt').eachLine >> { line -> >> exclude line >> } >> } >> > > > -- > ----------------------- > regards, > René > > rene groeschke > http://www.breskeby.com > @breskeby > > > ------------------------------**------------------------------**--------- > To unsubscribe from this list, please visit: > > > http://xircles.codehaus.org/**manage_email<http://xircles.codehaus.org/manage_email> > > >