ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guru Balse <guru.ba...@oracle.com>
Subject Re: Way for buildfile to verify that Ant version is 1.5.2 or grea ter ?
Date Fri, 22 Oct 2004 15:30:03 GMT
A simple solution is to use a "main" ant script which drives the other one (which does the
<taskdef>) using <ant>, so that the "main" script can detect the ANT version and
fail before any taskdefs are loaded via the second script.

Dominique Devienne wrote:
> 
> > From: Stefan Bodewig [mailto:bodewig@apache.org]
> > On Fri, 22 Oct 2004, Jan Materne <Jan.Materne@rzf.fin-nrw.de> wrote:
> > > A non usual way is checking for the existing of special classes.  So
> > > you 'only' have to check which classes were added in a release and
> > > you could check for them.
> >
> > It might help to have a concrete example ;-)
> >
> > <available property="Ant-1.5.2-or-later"
> >            classname="org.apache.tools.ant.types.ResourceFactory"/>
> > <fail message="You must use Ant 1.5.2 or later"
> >       unless="Ant-1.5.2-or-later"/>
> 
> I've had similar issues in the past, and didn't find a good solution.
> This is why I advocated to have a version attribute on <project>.
> 
> The problem is that if you have a script that uses Ant 1.6+ tasks
> with new attributes compared to their equivalent in 1.5, the build will
> never reach the <available>+<fail>. It will fail at parsing time,
> before any task gets to execute. That's because Ant 1.5, unlike 1.6,
> instantiate some tasks at parsing time, and others later on, while
> Ant 1.6 does them all later on, the first time there's used.
> 
> Furthermore, Ant 1.5 does not allow arbitrary task at top level,
> so the <available>+<fail> must be within a target, complicating
> the logic of the script.
> 
> And Jan's <scriptdef> is Ant 1.6+ specific of course.
> 
> So no, there's no clean and safe way to do this, short of writing
> your own main() for Ant, or implementing a custom ProjectHelper...
> Ant should have had a version attribute long ago. --DD
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org

-- 
Guru Balse
   Oracle - Server Technologies - iAS Integration QA
   Work: 650.506.1611 (1op668 - HQ)

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


Mime
View raw message