blob: 4d57e3045c55843de38490d728cc91e88a3f29b0 [file] [log] [blame]
<project default="all" xmlns:ac="antlib:net.sf.antcontrib">
<description>
This build file is designed to report the performance
of ant from various releases.
to use:
* install ant-contrib.jar to ($ANT_HOME|$HOME/.ant)/lib
* install beanshell jar and bsf jar
* use unix (with bash) or install cygwin
* set the env variables {whichever needs testing}
ANT_HOME
ANT_HOME_6_5 (the directory containing ant 1.6.5)
ANT_HOME_6_4
ANT_HOME_5_4
* run ant
For example:
export ANT_HOME="c:/cygwin/home/me/svn/trunk/dist"
export ANT_HOME_5_4="l:/apps/apache-ant-1.5.4"
ant.bat
TODO: more build files.
</description>
<property environment="env"/>
<target name="all" depends="gen,do-times"/>
<target name="clean">
<delete quiet="yes" dir="build"/>
</target>
<macrodef name="run-ant-files">
<attribute name="env-ant"/>
<sequential>
<ac:if>
<isset property="@{env-ant}"/>
<then>
<ac:shellscript shell="bash">
export ANT_HOME=${@{env-ant}}
echo $ANT_HOME
echo -n "-- props.xml --: "
$ANT_HOME/bin/ant -f build/gen/props.xml | grep time
echo -n "-- ant-call.xml --: "
$ANT_HOME/bin/ant -f build/gen/ant-call.xml | grep time
</ac:shellscript>
</then>
</ac:if>
</sequential>
</macrodef>
<target name="do-times">
<run-ant-files env-ant="env.ANT_HOME"/>
<run-ant-files env-ant="env.ANT_HOME_6_5"/>
<run-ant-files env-ant="env.ANT_HOME_6_2"/>
<run-ant-files env-ant="env.ANT_HOME_5_4"/>
</target>
<target name="gen-dirs">
<mkdir dir="build/gen"/>
</target>
<target name="avail">
<available property="avail.props.xml"
file="props.xml" filepath="build/gen"/>
<available property="avail.ant-call.xml"
file="ant-call.xml" filepath="build/gen"/>
</target>
<target name="gen-props" depends="gen-dirs,avail" unless="avail.props.xml">
<script language="beanshell">
import java.io.*;
out = new PrintWriter(new BufferedWriter(new FileWriter(
"build/gen/props.xml")));
out.println("&lt;project name='props' default='props'&gt;");
out.println(" &lt;target name='props'&gt;");
for (int i = 0; i &lt; 20000; ++i) {
out.println(
" &lt;property name='prop" + i + "' value='val'/&gt;");
}
out.println(" &lt;/target&gt;");
out.println("&lt;/project&gt;");
out.close();
self.log("Created build/gen/props.xml");
</script>
</target>
<target name="gen-ant-call" depends="gen-dirs,avail"
unless="avail.ant-call.xml">
<script language="beanshell">
import java.io.*;
out = new PrintWriter(new BufferedWriter(new FileWriter(
"build/gen/ant-call.xml")));
out.println("&lt;project name='ant-call' default='call'&gt;");
out.println(" &lt;target name='me'/&gt;");
out.println(" &lt;target name='call'&gt;");
for (int i = 0; i &lt; 1000; ++i) {
out.println(" &lt;antcall target='me'/&gt;");
}
out.println(" &lt;/target&gt;");
out.println("&lt;/project&gt;");
out.close();
self.log("Created build/gen/ant-call.xml");
</script>
</target>
<target name="gen" depends="gen-ant-call,gen-props"/>
</project>