I'm starting to really sink my teeth into the 0.8 release and reconfigure my multi-project build to use them. I think ultimately my config will be much simpler than it was but this new feature is so powerful that I wanted to see if there might be even more short-cuts.

Some description of my setup...

I have a legacy source tree in maven style, for example:
src/main/java/foo
src/main/java/bar
src/main/java/util
src/test/java/foo
...
src/main/resources/foo
...

And so on. In some cases, "bar" may itself have sub-packages. As an arbitrary example, maybe "api" and "impl".

Parallel to this I have a directory for my gradle build files in a hierarchy related to the projects themselves.
gradle/build.gradle
gradle/settings.gradle
gradle/foo/build.gradle
gradle/bar-api/build.gradle
gradle/bar-impl/build.gradle
...and so on.

In gradle 0.7 I ended up giving all sub-projects a srcRootName="../../src"... I haven't really found an equivalent of doing this with the new source sets. But I press on.

In gradle 0.7 I used to have a bunch of stuff like:

compile {
    include( "foo/**" )
}

compileTests {
    include( "foo/**" )
}

In gradle 0.8 I end up with a structure like:
sourceSets {
    main {
        java {
            srcDir '../../src/main/java/foo'
        }
        resources {
            srcDir '../../src/main/resources/foo'
        }
    }
    test {
        java {
            srcDir '../../src/test/java/foo'
        }
        resources {
            srcDir '../../src/test/resources/foo'
        }
    }
}

Which is still repetitive in some respects but definitely cleaner and centralized... both good things.

A project like "bar" is even trickier where I might have to exclude certain sub-directories from one project. Like maybe bar-api includes two specific sub-packages and bar-impl includes everything but those two.

Being a bit of a newb with gradle and groovy, I started to wonder if there are any built in tricks for reducing this repetition.

So far, my current plan is to include some methods in the root project for specifying which packages a sub-project uses and let that method do all of the repetitive configuring based off of the "global" src roots. I haven't quite worked out those details yet as I haven't given up hope on a built-in solution.

Thanks for any help.
-Paul


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to