What you describe seems similar in some ways to what I've been doing around
my <subant> task, but it seems to me you still think the Makefile way rather
than the Ant way...
Anyhow, here's what I've done, so you can decide for yourself if you want to
take a similar approach. My goal was to build two dozens projects, all with
dependencies between them. Here's how I did it.
1) Defined an XML file gathering all the information about the projects,
detailed enough to be able to generate a build file for each. The XML file
contains the static dependency information between the projects. Also
defined a schema for that file to validate it before using it.
<target name="validate" depends="init"
description="Ensures dependencies.xml's is correct
(schema-valid)">
<schemavalid file="dependencies.xml"
externalNoNamespaceSchema="dependencies.xsd" />
<echo message="${dependencies} is schema-valid" />
</target>
2) XSLT this file into one build.xml per project (using the Xalan redirect
extension, similarly to the junit-frames.xsl of Ant).
<target name="buildfiles" depends="init, validate"
description="Builds all the modules directories and build files">
<style in="dependencies.xml"
out="build/dependencies-out.xml"
style="dependencies2build.xsl"
processor="trax" />
<style in="dependencies.xml"
out="build/dependencies-bat-out.xml"
style="dependencies2build-bat.xsl"
processor="trax" />
</target>
3) Use my <subant> task to call all the sub-projects build in the right
build/dependency order. The build order is inferred from the XML file
defined in (1) and a specific build path resolver (the <subant> posted in
BugZilla doesn't have this resolver extension I added later, and just builds
in the statically specified <buildpath> order).
<buildpath ident="buildpath"
resolverClassname="com.lgc.buildmagic.TahoeBuildPathResolver">
<param name="destdir" value="${destdir}" />
<param name="dependencies" value="${dependencies}" />
</buildpath>
<property name="buildpath" refid="buildpath" />
4) I have a master build.xml file which re-generates the sub-projects
build.xml files using regular Ant tasks like <uptodate> and normal
dependencies between targets (see dependency on buildfiles target below).
Targets that recurse to the subprojects simply look like this:
<target name="build" depends="buildfiles"
description="Builds all the modules">
<subant buildpathref="buildpath" />
</target>
<target name="jar" depends="buildfiles"
description="Builds the JARs of all modules">
<subant buildpathref="buildpath" />
</target>
In a nutshell, that's it. Note that recursion is limited to one level, and
I'm not trying to decide when to build and where to go (no multi-level
recursion). Everything is statically defined in the main XML file (called
dependencies.xml in my case).
This whole thing took me a long time to build, and evolves a few custom
tasks, but in the end it worked, and is fully Ant (1.5.1) driven. But this
is definitely not for the fainted of heart. My real purpose for building
this monster was to keep internal dependencies between the various 'modules'
of the same (huge) code base in check (too many developer writing too much
code too fast), but it sounds similar enough to your approach that I'm
taking the time to explain it here, in the hope that it might help you
decide how to proceed in your case. Cheers, --DD
-----Original Message-----
From: Sebastien BLANC [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 10:42 PM
To: [EMAIL PROTECTED]
Subject: project management w/ ANT
Hello !
Here is how I did work with ant for now:
I have a script that generates all build.xml files from a
build.xml.template and a rbuild.xml.template, and from the top src
directory.
build.xml.template contains applicative targets such as doclet, compile,
archive, unit test, doc generation and so on.
rbuild.xml.template contains the recursive targets of compilation.
now that my build.xml.template quality is pretty fine, I'd like to know
if there is a way for me to ligthen the process:
is there a java tool anywhere that would generate all these sub-dummy
ant files from my r/build.xml.template reference parsing the tree and
its subdirectories to perform the same task for me:
- generate recursive rbuild.xml where there are subdirectories
- generate build.xml where there are java files by referencing the
referenced build.xml w/ antcalls and replacing the directory path in the
build.xml.reference.
- optionally generate a mix when there are java files and subdirectories
(I actually don't have this conf and don't think this is very clean for
a java project, but just an opinion).
my script is a UNIX shell script using the find command and so that's
why I ask ... coz I can't use it directly on WIN32. I know this is
doable in java but I had not the time.
I think this is a pretty common project task and so I worry if anybody
ever tried smthg ? for most of the ANT samples I've seen there is only
one build.xml that does the job on the whole tree but in distributed
dvt. this is never the case where engineers only work on specific
directories. more specifically w/ J2EE/xdoclet, one directory has to
match one jar file (if u want to ease the generation process).
another common task would be to parse the java files under
subdirectories in a subdirectory w/ java files and generates the correct
dependencies so that the recursive build.xml is generated in the correct
order.
does everybody put all its build.xml files in configuration system mgt
or do u generate them as private files as well ?
I looked at maven but did not find such automation.
thanx for any input.
seb.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]