blob: ec75451419de0f8b2bda96d1d95049232238fa7f [file] [log] [blame]
<project>
<target name="simple">
<macrodef name="my.echo">
<attribute name="text"/>
<sequential>
<echo message="@{text}"/>
</sequential>
</macrodef>
<my.echo text="Hello World"/>
</target>
<target name="text">
<macrodef name="my.echo">
<attribute name="text"/>
<sequential>
<echo>@{text}</echo>
</sequential>
</macrodef>
<my.echo text="Inner Text"/>
</target>
<target name="duplicate.attribute">
<macrodef name="my.echo">
<attribute name="text"/>
<attribute name="text"/>
<sequential>
<echo>@{text}</echo>
</sequential>
</macrodef>
</target>
<target name="duplicate.element">
<macrodef name="my.echo">
<element name="text"/>
<element name="text"/>
<sequential>
<text/>
</sequential>
</macrodef>
</target>
<target name="uri">
<macrodef name="echo" uri="abc">
<attribute name="text"/>
<sequential>
<echo message="@{text}"/>
</sequential>
</macrodef>
<x:echo xmlns:x="abc" text="Hello World"/>
</target>
<target name="nested">
<macrodef name="nested">
<element name="nested"/>
<sequential>
<nested/>
</sequential>
</macrodef>
<nested>
<nested>
<echo>A nested element</echo>
</nested>
</nested>
</target>
<target name="double">
<macrodef name="double">
<attribute name="prop"/>
<sequential>
<echo>@@{prop} is '@{prop}', value of $${@{prop}} is '${@{prop}}'</echo>
</sequential>
</macrodef>
<property name="property" value="A property value"/>
<double prop="property"/>
</target>
<target name="ignorecase">
<macrodef name="ignore">
<attribute name="MyAttribute"/>
<sequential>
<echo>@{myattribute} is @{MYATTRIBUTE}</echo>
</sequential>
</macrodef>
<ignore myattribute="a"/>
<ignore Myattribute="b"/>
</target>
<target name="ignore-element-case">
<macrodef name="ignore">
<element name="MyElement"/>
<sequential>
<myElement/>
<MyElEmEnT/>
</sequential>
</macrodef>
<ignore>
<MYELEMENT>
<echo>nested element</echo>
</MYELEMENT>
</ignore>
</target>
<target name="textelement">
<macrodef name="echotest">
<text name="text" optional="yes"/>
<sequential>
<echo>@{text}</echo>
</sequential>
</macrodef>
<echotest>
Hello world
</echotest>
</target>
<target name="text.trim">
<macrodef name="echotest">
<text name="text" trim="yes"/>
<sequential>
<echo>[@{text}]</echo>
</sequential>
</macrodef>
<echotest>
Hello world
</echotest>
</target>
<target name="duplicatetextname">
<macrodef name="echotest">
<attribute name="text"/>
<text name="text"/>
<sequential>
<echo>@{text}</echo>
</sequential>
</macrodef>
</target>
<target name="duplicatetextname2">
<macrodef name="echotest">
<text name="text"/>
<attribute name="text"/>
<sequential>
<echo>@{text}</echo>
</sequential>
</macrodef>
</target>
<target name="escape">
<macrodef name="escape">
<attribute name="a"/>
<attribute name="b"/>
<sequential>
<echo>a@b or a@@b is @{a}@@@{b}</echo>
</sequential>
</macrodef>
<escape a="avalue" b="bvalue"/>
</target>
<target name="attribute.description">
<macrodef name="d">
<attribute name="description"/>
<attribute name="d" default="p"/>
<sequential>
<echo>description is @{description}</echo>
</sequential>
</macrodef>
<d description="hello world"/>
</target>
<target name="implicit">
<macrodef name="implicit">
<element name="implicit" implicit="yes"/>
<sequential>
<echo>Before implicit</echo>
<implicit/>
<echo>After implicit</echo>
</sequential>
</macrodef>
<implicit>
<echo>In implicit</echo>
</implicit>
</target>
<target name="implicit.notoptional">
<macrodef name="implicit">
<element name="implicit" implicit="yes"/>
<sequential>
<echo>Before implicit</echo>
<implicit/>
<echo>After implicit</echo>
</sequential>
</macrodef>
<implicit>
</implicit>
</target>
<target name="implicit.optional">
<macrodef name="implicit">
<element name="implicit" optional="yes" implicit="yes"/>
<sequential>
<echo>Before implicit</echo>
<implicit/>
<echo>After implicit</echo>
</sequential>
</macrodef>
<implicit>
</implicit>
</target>
<target name="implicit.explicit">
<macrodef name="implicit">
<element name="explicit" optional="yes"/>
<element name="implicit" optional="yes" implicit="yes"/>
<sequential>
<implicit/>
<explicit/>
</sequential>
</macrodef>
</target>
<property name="default.override" value="old"/>
<macrodef name="simple.override">
<attribute name="attr" default="${default.override}"/>
<sequential>
<echo>value is @{attr}</echo>
</sequential>
</macrodef>
<target name="override.default">
<antcall target="override.call">
<param name="default.override" value="new"/>
</antcall>
</target>
<target name="override.call">
<simple.override/>
</target>
<target name="backtraceoff">
<macrodef name="nobacktrace" backtrace="false">
<sequential>
<fail>This is a failure</fail>
</sequential>
</macrodef>
<nobacktrace/>
</target>
<target name="backtraceon">
<macrodef name="nobacktrace" backtrace="true">
<sequential>
<fail>This is a failure</fail>
</sequential>
</macrodef>
<nobacktrace/>
</target>
<target name="top-level-text">
<macrodef name="top">
<element name="em"/>
<sequential>
<echo><em/></echo>
</sequential>
</macrodef>
<top>
<em>
Hello World
</em>
</top>
</target>
</project>