You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Eric Safern <es...@lrn.com> on 2004/01/29 23:04:30 UTC

New Ant Task Offered for Submission - 'warn' - a conditional echo at level MSG_WARN

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
eric@timebytes.com
http://www.timebytes.com




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


Re: New Ant Task Offered for Submission - 'warn' - a conditional echo at level MSG_WARN

Posted by Peter Reilly <pe...@corvil.com>.
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
>eric@timebytes.com
>http://www.timebytes.com
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>
>
>
>  
>


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