Well, I managed to sort this out using the <subant> task and <propertyset>
to pass only the required properties along.

No more hard-coded folder lists or duplicated build files now!  

 

 

  _____  

From: Greg Irvine [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 15 June 2006 4:08 PM
To: 'Ant Users List'
Subject: "Recursiveness" / property already used in a "generic" build...

 

Hi all.

 

I'm trying to write a generic build file that uses a properties file to
inform the generic build file of which subprojects to build. 

 

So, the build.xml loads a build.properties which has a property buildorder
which is a list of subprojects in that directory to build, and this order is
specific due to dependencies.

 

I have this working just fine (generally).

 

This works if multiple folders have the same level do the same thing.  I'm
assuming this works because once the explicit call to build Folder1 returns,
any properties set in Folder1 or lower are cleared, so when Folder2 build
loads the build.properties the buildorder property set in Folder1 has been
cleared.

 

Parent -> Build.xml explicitly calls build on Folder1 and Folder2

          Folder1 -> build.xml + build.properties (buildorder=SubFolder1,
SubFolder2, SubFolder3)

                      -> SubFolder1

                      -> SubFolder2

                      -> SubFolder3

          Folder2-> build.xml + build.properties (buildorder=SubFolder1,
SubFolder2, SubFolder3)

                      -> SubFolder1

                      -> SubFolder2

                      -> SubFolder3

 

The problem I have is that if one of those projects is in fact a folder that
itself has a list of projects to build I find the property buildorder is
already set by the parent build file and fails trying to build the same
stuff again but in the subfolder.

          Folder1 -> build.xml + build.properties (buildorder=SubFolder1,
SubFolder2, SubFolder3)

                      -> SubFolder1 -> build.xml + build.properties
(buildorder=SubSubFolder1, SubSubFolder2, SubSubFolder3)

                                      -> SubSubFolder1

                                      -> SubSubFolder2

                                      -> SubSubFolder3

                      -> SubFolder2

                      -> SubFolder3

 

i.e. Folder1 build loads buildorder from build.properties and calls
build.xml in SubFolder1 (as specific in build.properties) which tries to
load it's build.properties which tries to define buildorder and of course
can't.

Hence, the build in SubFolder1 tries to build SubFolder1, SubFolder2,
SubFolder3 as defined by the parent buildorder again instead of the "new"
SubSubFolder1.

 

Any suggestions on how to get around this would be great.

 

Thanks and regards,

 

Greg.

 

Ps. If you REALLY think Maven is a better option let me know and I'll just
have to do an ROI analysis.

Reply via email to