ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28882] - Add if and unless attributes to ProjectComponent.
Date Tue, 11 Sep 2007 14:04:00 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28882>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28882





------- Additional Comments From ddevienne@gmail.com  2007-09-11 07:04 -------
I would much prefer Peter's addition of task-invisible namespaced attributes,
because it is more powerful that if/unless on sequential, since allows
conditional use of any XML tag, like his <arg> example. (note that I've used a
custom conditional sequential for years myself, so I'm not biais against it!)

That said, I wonder how the antlib-defined extra "action" attribs are defined
and used, and how well that plays with XML NS rules. You can't write
if:ac:foo="" for example. Ideally I would prefer the "action" attributes to be
part of a limited expression language for conditions, and be part of the
attribute value itself:

<project name="x">
   <property name="onWindows" value="true"/>
   <target name="abc">
        <echo ant:if="isset(onWindows)">I am on windows</echo>
        <echo ant:unless="isset(onWindows)">I am *not* on windows</echo>
   </target>
   <macrodef name="mycommand">
      <attribute name="level" default=""/>
      <attribute name="debug" default=""/>
       <attribute name="file"/>
     <sequential>
        <exec executable="mycommand">
        <arg value="--debug"  ant:if="istrue(@{debug})"/>
        <arg value="--level"  ant:unless="isempty(@{level})"/>
        <arg value="@{level}" ant:unless="isempty(@{level})"/>
        <arg value="@{file}"/>
   </sequential>
  </macrodef>
</project>

Then antlibs can declare new action verbs and use the them with the NS prefix, a
la XPath, like ant:if="ac:isfalse(${debug})". I realize this is much more
difficult to achieve, so Peter's proposed syntax sounds fine too. I'm just
throwing the idea out there. --DD

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message