This is a way of doing 'ifs' with Ant.
<macrodef name="copy-and-filter">
<attribute name="sys"/>
<attribute name="target"/>
<attribute name="source"/>
<sequential>
<condition property="myProp" value="JUST1">
<equals arg1="@{sys}" arg2="MySystem"/>
</condition>
<condition property="myProp" value="NOT1">
<equals arg1="@{sys}" arg2="SomeOtherSystem"/>
</condition>
<copy tofile="@{target}" file="@{source}">
<filterset onmissingfiltersfile="ignore" recurse="true">
<filter token="replaceThis" value="${myProp}"/>
<filtersfile file="myfilters/filterFile@{sys}.properties"/>
</filterset>
</copy>
</sequential>
</macrodef>
The conditional property myProp will be set depending on the values of the @sys@ attribute passed in.
All filters in the file: filtersFile@sys@ so you can specify a different file for each sys property.
No comments:
Post a Comment