ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: changing the main initialization procedure
Date Thu, 23 May 2002 22:27:40 GMT
Yes, by all means, send it to me personally or through ant-user at your
convenience ;-) And thanks for offering!

I am very much interested by your approach. I know I need a templating
system for the builds of the projects I'm trying to integrate / homogenize,
but just don't know how to go about it or which tool to use yet. So far I've
identified several possible routes: completely ad-hoc (to the point of
writing actual Jaxp code to manipulate all these xml files!), 'traditional'
xslt like myrmidon, maybe Maven or AntHill too, or your approach. From the
little I know about each approach, yours sounds the more interesting to me
at this point (and one I could actually wrap my head around too).

Thanks, --DD

-----Original Message-----
From: Wannheden, Knut [mailto:knut.wannheden@paranor.ch] 
Sent: Thursday, May 23, 2002 10:40 AM
To: 'Ant Users List'
Subject: RE: changing the main initialization procedure

Well it's maybe abusing the true purpose of XSLT, but it's what I'm doing
anyways.  I use my buildfile template as the input for the stylesheet, use
the document() function to load the customization buildfile and do the
merging with XSLT templates.  Of course the merging has to be done by hand,
i.e. checking if the customization buildfile overrides any
targets/properties in the template buildfile.  So in the end the stylesheet
just copies parts from either buildfile and doesn't contain the template
itself.  I can send it to you if you wish, but it's not ready yet...

I guess if I'd write my own Ant ProjectHelper the process could be a little
bit easier, as the ProjectHelper could merge the buildfiles itself by using
the methods provided by Project.  But I still have to look into that code
first.  The XSLT approach was more straight forward for me, as I already had
something similar.

--
knut

> -----Original Message-----
> From: Dominique Devienne [mailto:DDevienne@lgc.com]
> Sent: Donnerstag, 23. Mai 2002 17:29
> To: 'Ant Users List'
> Subject: RE: changing the main initialization procedure
> 
> 
> A little off-topic, but could you point me to some info on 
> how you can merge
> two xml files to produce a third using an xslt stylesheet?
> 
> In either Myrmidon's templating system using xslt, or 'Java 
> and XSLT' book,
> the xslt stylesheet *contains* the xml template as well. If I remember
> correctly, you pointed out a while ago that it didn't 
> separate the the ANT
> build template and the stylesheet, which I agree with. It 
> also requires to
> know xslt to update the template, which is bad.
> 
> Please forgive my ignorance of XSLT related matter ;-) --DD
> 
> -----Original Message-----
> From: Wannheden, Knut [mailto:knut.wannheden@paranor.ch] 
> Sent: Thursday, May 23, 2002 3:04 AM
> To: 'Ant Users List'
> Subject: RE: changing the main initialization procedure
> 
> > 
> > Peter Donald (have to use full name because this list is 
> > soooo full ;) , any
> > hint on how to include a basic templating mechanism with 
> current Ant?
> > I recall you favor templating, and I'm sure you can help us 
> > (I'm interested
> > too) and give us some advice.
> > 
> 
> Just to briefly describe how I've implemented my templates: I have a
> template buildfile (regular Ant buildfile) with some common 
> (or default)
> targets, paths, properties, etc.  Then for every "real" 
> project I merge
> (with XSLT) this template with another customization (also an 
> Ant buildfile)
> which overrides definitions in the template.  This works like a simple
> inheritance mechanism.  So I could have a template like:
> 
> <project name="template" default="compile">
> 
>  <property name="source-dir" value="src"/>
>  <property name="build-dir" value="build"/>
> 
>  <target name="init"/>
>  <target name="compile" depends="init">
>   <javac srcdir="${source-dir}" destdir="${build-dir}"/>
>  </target>
> 
> </project>
> 
> and a customization for a project (notice the additional 
> <super/> in target
> compile):
> 
> <project name="custom">
> 
>  <property name="build-dir" value="classes"/>
> 
>  <target name="idlj">
>   <exec/>
>  </target>
> 
>  <target name="compile" depends="init,idlj">
>   <super/>
>  </target>
> 
> </project>
> 
> which would be merged into:
> 
> <project name="custom" default="compile">
> 
>  <property name="source-dir" value="src"/>
>  <property name="build-dir" value="classes"/>
> 
>  <target name="init"/>
> 
>  <target name="idlj">
>   <exec/>
>  </target>
> 
>  <target name="compile" depends="init,idlj">
>   <javac srcdir="${source-dir}" destdir="${build-dir}"/>
>  </target>
> 
> </project>
> 
> I found this to work quite nicely.  I added the <super> 
> target because I
> wanted as few changes as possible in the template to cause 
> manual changes to
> be made to the customization.
> 
> --
> knut
> 
> --
> To unsubscribe, e-mail:   
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:ant-user-help@jakarta.apache.org>
> 

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message