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> </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>
Created attachment 20797 [details] Patch against trunk providing the functionaly and some tests
committed in revision 1479422.