ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Vogel <>
Subject RE: if and unless attributes for all Tasks
Date Wed, 16 May 2001 22:33:13 GMT
This is actually pretty slick!  A couple of points though

1.  It'd be nice for the "code" tag to have an optional "file" attribute 
    to compile + load a file rather than having the code inline in the 
    buildfile (allows someone skimming a build file to ignore/take for
    things that aren't important to them at the moment.  With carefully
    files, it becomes self documenting within the xml file.

2.  The code snippet would need access to all the properties, etc. within
    build file itself.

I'm on the fence on this one, but it might be nice if properties could be
within the code, I can think of ways I'd use the capability, but I'm
concerned about
the resulting readability of the build file.


> -----Original Message-----
> From:
> []
> Sent: Wednesday, May 16, 2001 2:36 PM
> 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