Bug 43362 - Add conditional attributes
Summary: Add conditional attributes
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: unspecified
Hardware: All other
: P2 enhancement with 1 vote (vote)
Target Milestone: 1.9.1
Assignee: Ant Notifications List
Keywords: PatchAvailable
Depends on:
Reported: 2007-09-12 06:39 UTC by Peter Reilly
Modified: 2013-05-05 23:53 UTC (History)
0 users

Patch against trunk providing the functionaly and some tests (27.83 KB, patch)
2007-09-12 06:40 UTC, Peter Reilly
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Reilly 2007-09-12 06:39:23 UTC
This patch allows conditional attributes to be
used to suppress evaluation of unknown elements.
This has the effect of adding conditional execution for
tasks and conditon inclusion of nested elements.

Example usage:
<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>
  <macrodef name="mycommand">
     <attribute name="level" default=""/>
     <attribute name="debug" default=""/>
      <attribute name="file"/>
       <exec executable="mycommand">
       <arg value="--debug"  if:true="@{debug}"/>
       <arg value="--level"    unless:blank="@{level}"/>
       <arg value="@{level}"  unless:blank="@{level}"/>
       <arg value="@{file}"/>

Comment 1 Peter Reilly 2007-09-12 06:40:36 UTC
Created attachment 20797 [details]
Patch against trunk providing the functionaly and some tests
Comment 2 Antoine Levy-Lambert 2013-05-05 23:53:54 UTC
committed in revision 1479422.