I do think that the <echo> task should have an if/unless attribute.
- similar to the <fail> task.

Peter
Eric Safern wrote:

Hi,

        I've written an ant task that might be useful for others, and you
might want to add to the existing ant tasks.

I call it '<warn>' - and it is, quite simply, '<fail>' without the actual
exiting part. :-)

In other words, it offers <echo type="warning" /> functionality with the if=
and unless= functionality of <fail>.

It was trivial to write - I just plagiarized the <fail> code from Exit.java
and removed the exiting stuff.

I found myself writing all of these targets that do nothing more than print
informational/debugging messages when
properties are set.  It seems much easier to say something like

<warn message="${currentBuildEnv} push of module ${module} to web server
${webServer} is complete at ${PUSH_NOW}." if="moduleSyncSuccess">

than

<antcall target="-reportPushSuccess" />

<!-- -reportPushSuccess: print message reporting success in pushing module
-->
   <target name="-reportPushSuccess" depends="" if="moduleSyncSuccess">
       <echo level="warning">${currentBuildEnv} push of module ${module} to
web server ${webServer} is complete at ${PUSH_NOW}.</echo>
   </target> <!-- -reportPushSuccess -->

Alternatively, I could modify the <echo> target to include the <if> and
<unless> functionality, if you think that's a more general solution.

BTW, this addresses bug #15955.
I know there was some discussion on this issue back in April on the user
list, but I can't see that it was resolved, rejected, or what!


I can post the TAR (it's very small) if you approve...

--
Eric Safern
[EMAIL PROTECTED]
http://www.timebytes.com




--------------------------------------------------------------------- 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]



Reply via email to