On 03/11/2010, at 10:52 PM, richardm wrote:

> 
> I have a multi-project build with a flat layout as follows:
> 
> - main-build
>    build.gradle
>    settings.gradle
> - ProjA
>    - ProjA1
>    - ProjA2
> - ProjB
> 
> ProjA contains 2 other projects.  Their is a single build file in the
> main-build project.  My sub-projects ProjA1 and ProjA2 aren't inheriting any
> properties from ProjA.  The example below shows a simple property being set
> in ProjA.  If I try to output this in ProjA1 I get an error 'Could not find
> property 'propATest' on project ':projA/projA1''
> 
> I've tried setting the path with project(':projA:projA1') rather than
> project(':projA/projA1'), but this doesn't work 'Project with path
> ':projA:projA1' could not be found in root project 'main-build'.
> 
> settings.gradle
> includeFlat 'projA', 'projB', 'projA/projA1', 'projA/projA2'

includeFlat() creates a flat project structure. What you're asking for above is 
the following hierarchy:

root
+-- projA
+-- projA/projA1
+-- projA/projA2
+-- projB

That is, 'projA/projA1' is not a child of 'projA'. It sounds like you're after 
something more like this:

root
+-- projA
|     +-- projA1
|     +-- projA2
+-- projB

You need to do something like this in your settings script:

// Define the logical project structure
include 'projA', 'projA:projA1', 'projA:projA2', 'projB'

// Specify the project directory for each project
project(':projA').projectDir = new File(settingsDir, '../projA')
project(':projA:projA1').projectDir = new File(settingsDir, '../projA/projA1')
... and so on, you can probably write some code to automate this ...

The above leaves the projectDir for the root project as 'main-build'

Alternatively, you could do something like this in your settings script:

rootProject.projectDir = settingsDir.parentFile

include 'projA', 'projA:projA1', 'projA:projA2', 'projB'


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to