Hi phil,
sorry,
was a typo on my side. started to declare the closure in another way, but then rewrote it before posting it here. the -> is a fragment i accidently didn't removed from the snippet.

rené

Am 06.10.11 23:57, schrieb phil swenson:
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 <mailto: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





--
-----------------------
regards,
René

rene groeschke
http://www.breskeby.com
@breskeby

Reply via email to