Thanks again Dominique. I'll also try this and see which is best among
your 2 propositions.
I'm also tempted to rewrite my build to transform the following:
framework/
|_ src
|_ share-12-13-14
|_ share-13-14
|_ j2ee-12
|_ j2ee-13
|_ j2ee-14
into
framework
|_ share-12-13-14
|_ src
|_ share-13-14
|_ src
|_ j2ee-12
|_ src
|_ j2ee-13
|_ src
|_ j2ee-14
|_ src
each share* and h2ee* directories corresponding to different build.xml
With this solution, there is no need to do "if" to build each project.
Combined with Ant 1.6 import/macrodef/presetDef the individual build.xml
should also be quite empty.
Any take on this?
Thanks
-Vincent
> -----Original Message-----
> From: Dominique Devienne [mailto:[EMAIL PROTECTED]
> Sent: 24 May 2004 01:27
> To: 'Ant Users List'
> Subject: RE: How to create paths that depend on a condition?
>
> Also, as somebody else mentioned, the if/unless of <patternset> could
> come to your rescue for an even simpler solution:
>
> <javac [...]>
> <src>
> <dirset dir="${src.test.dir}">
> <include name="share-12-13-14" />
> <include name="share-13-14" if="j2ee1[34].available" />
> </dirset>
> </src>
> </javac>
>
> Provided one's using Ant 1.6.x, with the smarts Antoine added to
> DirectoryScanner, this should not scan all of the ${src.test.dir}
> as it used to (works nonetheless, it's just slow...). You'd still
> need the <condition> to combine your two .available properties,
> so it may not be that better, especially with Ant 1.5.x. --DD
>
> > -----Original Message-----
> > From: Dominique Devienne [mailto:[EMAIL PROTECTED]
> > Sent: Sunday, May 23, 2004 6:15 PM
> > To: 'Ant Users List'
> > Subject: RE: How to create paths that depend on a condition?
> >
> > > From: Vincent Massol [mailto:[EMAIL PROTECTED]
> > >
> > > Ok, I've found a solutiob but it looks really ugly:
> > >
> > > <dirset dir="${src.test.dir}/share-13-14">
> > > <and>
> > > <filename name="share-13-14"/>
> > > <or>
> > > <selector if="j2ee13.available"/>
> > > <selector if="j2ee14.available"/>
> > > </or>
> > > </and>
> > > </dirset>
> > >
> > > Any better solution?
> >
> > Maybe... If I understand correctly, you want to include the
share-12-13-
> 14
> > path element only if either j2ee1[34]* properties are defined. I
haven't
> > tested this, but I think I remember the 'path' attribute of
> <pathelement>
> > will accept an empty value, simply ignoring it. So
> >
> > <condition property="j2ee1[34].srcdir"
> > value="${src.test.dir}/share-13-14">
> > <or>
> > <isset property="j2ee13.available" />
> > <isset property="j2ee14.available" />
> > </or>
> > <condition>
> > <property name="j2ee1[34].srcdir" value="" />
> >
> > <javac [...]>
> > <src>
> > <pathelement location="${src.test.dir}/share-12-13-14"/>
> > <pathelement path="${j2ee1[34].srcdir}"/>
> > </src>
> > </javac>
> >
> > Should do what you want, is easy enough to read, and is pure Ant.
--DD
> >
> > <usual-lamentation>
> > I'd rather have if/unless on all Ant elements, as I lament often,
> > rather than rely on knowledge of edge cases behavior in
<pathelement>
> > though. I've created for my own task a Path-derivative that accepts
> > nested <element>s, with built-in
if/unless/iftrue/unlessTrue/os/osFamily
> > condition attributes, but it's only really useful in my own tasks
only,
> > unless you id/refid that Path, or when using the semi-official
ant:type
> > magic attribute (which still works only with tasks with add*(Path),
> > and not the ones using create*(Path)).
> >
> > Anyways, I think your use case is yet more evidence for the
usefulness
> > of generalized if/unless.
> > </usual-lamentation>
> >
> > > > -----Original Message-----
> > > > From: Vincent Massol [mailto:[EMAIL PROTECTED]
> > > >
> > > > I'd like to create a <path> that depends on some property being
> > > > defined or not. This is for putting inside the <javac> task.
> > > > I cannot find the right combination. Here's what I'd like to do:
> > > >
> > > > <javac [...]>
> > > > <src>
> > > > <pathelement location="${src.test.dir}/share-12-13-14"/>
> > > > ---> start here
> > > > <dirset dir="${src.test.dir}/share-13-14">
> > > > <and>
> > > > <depth max="0"/>
> > > > <or>
> > > > <selector if="j2ee13.available"/>
> > > > <selector if="j2ee14.available"/>
> > > > </or>
> > > > </and>
> > > > </dirset>
> > > > ---> stop here
> >
> >
---------------------------------------------------------------------
> > 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]