On 19/01/11 11:08, Rene Groeschke wrote:
------
include 'ModuleA'
include 'ModuleB'
include 'ModuleC'
include 'ModuleD'

rootProject.name = 'Joccis-SDK'

rootProject.children.each {project ->
     String fileBaseName = project.name.toLowerCase()
     project.buildFileName = "${fileBaseName}.gradle"
        project.projectDir = new File(settingsDir.parent, project.name)
     assert project.projectDir.isDirectory()
     assert project.buildFile.isFile()
}
------


Thanks, that works very well, at least for doing the whole build by executing Gradle from the root or "BuildCommon" project. However if I execute Gradle from one of the subprojects it has no knowledge of the tasks that are normally configured by the build.gradle script in BuildCommon. Is there a best practice for doing this backwards reference to BuildCommon? I was thinking of writing an init task in BuildCommon that wrote settings.gradle files in each subproject directory which is a bit messy. Alternatively I could put the generated settings.gradle at the workspace root since gradle will search there. The drawback with this is that the generated settings.gradle cannot be seen from the Eclipse IDE. However, since it
is generated and not intended to be modified, perhaps this is a moot point.

I was thinking that these back references would be helpful for building certain subsets of the workspace projects. For example running the (re)build task from within ModuleA would only build the projects that ModuleA depends apon. Running the same task from BuildCommon would
do the same action on all checkedout projects.

This is my example multiproject build thus far:

BuildCommon/build.gradle:

subprojects {

    apply plugin: 'java'

    sourceSets {
        main {
            java {
                srcDir 'src/java'
            }
        }
    }

}

BuildCommon/settings.gradle:

/*
 * I intend to generate the following includes automatically
 * depending on what projects have been checked out
 */
include 'ModuleA'
include 'ModuleB'

rootProject.name = 'BuildCommon'

rootProject.children.each {project ->
    String fileBaseName = project.name
    project.projectDir = new File(settingsDir.parent, project.name)
    assert project.projectDir.isDirectory()
    assert !project.buildFile.exists() || project.buildFile.isFile()
}




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

   http://xircles.codehaus.org/manage_email


Reply via email to