AntDaniel Kasmeroglu - Mar 29, 2017 22:16
Get the directory of the ant.xml file
<project name="bobo" basedir=".">
<!-- ant always provides the location of the file in a property "ant.file.{projectname}" -->
<dirname file="${ant.file.bobo}" property="dir.scriptdir"/>
...
</project>
Macros for convenient logging
<macrodef name="info">
<attribute name="msg"/>
<sequential>
<echo message="@{msg}" level="info"/>
</sequential>
</macrodef>
<macrodef name="warn">
<attribute name="msg"/>
<sequential>
<echo message="@{msg}" level="warning"/>
</sequential>
</macrodef>
<macrodef name="error">
<attribute name="msg"/>
<sequential>
<echo message="@{msg}" level="error"/>
</sequential>
</macrodef>
<macrodef name="remove-java-comments">
<attribute name="file"/>
<sequential>
<copy file="@{file}" tofile="@{file}.n" overwrite="true">
<filterchain>
<stripjavacomments/>
</filterchain>
</copy>
<delete file="@{file}"/>
<move file="@{file}.n" tofile="@{file}"/>
</sequential>
</macrodef>