ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <>
Subject RE: if and unless attributes for all Tasks
Date Wed, 16 May 2001 23:48:48 GMT

I have some concerns about this task. It sounds simple but there are a
number of complexities with such a task.

Firstly it will be useless unless it has some API into the Ant core - the
callTarget method in your example - who will provide that? In Ant-1 you can
probably access a lot of things but in Ant-2 that will all change and you
may be more restricted in what you can do. One thing for sure, the API
available to tasks *will* change. The script task itself will have some
similar problems - I'm not sure the extent of them yet.

Such a task can create backward compatability issues which we will need to
consider carefully. In Ant-2 we will need to get the task API tied down for
such a task to minimise these backward compatability issues.

Also, there are some practical issues. Where are you going to put the
generated code. Will you do the compile at parse time or execution time?
Will you cache the generated class? There may be some classloader fun.

Overall I'm not sure this is better than just coding an ad hoc task, which
I'm not much in favour of either. At least that keeps the Java code in Java

Anyway, I think you may want to perform some experiments. If you go ahead
please be aware that across the Ant-1/Ant-2 boundary it will break.


> -----Original Message-----
> From:
> []
> Sent: Thursday, 17 May 2001 7:36 AM
> To:;
> Subject: RE: if and unless attributes for all Tasks
> Hi All,
> Roger Vaughn and I have been discussing XML as a flow control language and
> I've come up with a compromise that I'm considering taking a stab at
> writing.  I want to bounce the idea off all of you before I invest a pile
> of time into an idea that one of you might be able to easily debunk.
> I feel that XML is a very poor language for describing conditionals.  All
> the arguments seem to show that.  I suggest a new task called 'code' that
> would work something like this:
>  <target name="make">
>    <code>
>          if(true){
>            callTarget("compile");
>          }
>    </code>
>  </target>
> My task would then take all of the Java between the code tags, put it into
> a file, compile it, load the class then call the task just
> like any other.  Basically, the code tag is just a scriptlet in the
> build.xml.
> To my thinking this has the following advantages:
>      - It doesn't break the current design and architecture
>      - It takes advantage of the fact that we already have a very nice
> language and compiler,
>           we should not have to build another one
>      - Because tasks in this context tend to be one-off, non-reusable bits
> of code, it is
>           really nice to keep the task code in the same file as
> the rest of
> the build.
>      - The java in the code block could call the other tasks, but still
> have all of the
>           flexibility of Java
> My most optimistic hope is that I can write this into a regular task, and
> ANT itself would not have to change at all.
> Can any of you think of a reason this wouldn't work?  If not, I'm going to
> try coding it next week and I've got some scraps of free time coming.
> Let me know what you think, and thank's to Roger for the discussion about
> it.
>                                                         Jason Henriksen
> ------------------------------------------------------------------
> ------------
> Warning : The information contained in this message may be
> privileged and confidential and protected from disclosure. If the
> reader of this message is not the intended recipient, you are
> hereby notified that any dissemination, distribution or copying
> of this communication is strictly prohibited. If you have
> received this communication in error, please notify us
> immediately by replying to this message and then delete it from
> your computer. All e-mail sent to this address will be received
> by the Providian Financial corporate e-mail system and is subject
> to archiving and review by someone other than the recipient.
> ==================================================================
> ============

View raw message