|
Ant example source code file (build.xml)
The build.xml source code<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("<project name='props' default='props'>"); out.println(" <target name='props'>"); for (int i = 0; i < 20000; ++i) { out.println( " <property name='prop" + i + "' value='val'/>"); } out.println(" </target>"); out.println("</project>"); 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("<project name='ant-call' default='call'>"); out.println(" <target name='me'/>"); out.println(" <target name='call'>"); for (int i = 0; i < 1000; ++i) { out.println(" <antcall target='me'/>"); } out.println(" </target>"); out.println("</project>"); out.close(); self.log("Created build/gen/ant-call.xml"); </script> </target> <target name="gen" depends="gen-ant-call,gen-props"/> </project> Other Ant examples (source code examples)Here is a short list of links related to this Ant build.xml source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.