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 11:18:38 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 peterreilly@apache.org  2007-09-11 04:18 -------
I am preparing a patch to add namespaced conditional attributes.
The conditional attributes act at the UE level, and are
not seen by the tasks / or types.
The attribute is evalualted and if false, the UE is not processed
further.
There are two namespaces - ant:if and ant:unless, the patch
also allows antlibs to define their own condtional attributes
in their namespace.
The attributes are:
   set  - check if an property exists
   true - check if the value of the attribute is true
   blank - check if the value of the attribute is "" (or null)
   
   the ant:if checks for positive results and the ant:unless checks for
   negative results.


something like:
<project name="x" xmlns:if="ant:if" xmlns:unless="ant:unless">

   <property name="onWindows" value="true"/>

   <target name="abc">
        <echo if:set="onWindows">I am on windows</echo>
        <echo unless:set="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"  if:true="@{debug}"/>
        <arg value="--level"    unless:blank="@{level}"/>
        <arg value="@{level}"  unless:blank="@{level}"/>
        <arg value="@{file}"/>
   </sequential>
  </macrodef>

</project>

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