Build.xml
From Santa Fe Institute Events Wiki
<?xml version="1.0"?>
<project name="CoopNetBlue" default="all" basedir=".">
<property name="build.compiler" value="modern"/>
<property name="projectName" value="CoopNetBlue"/>
<property name="modelName" value="ModelParameters"/>
<property name="repastVersion" value="3.0"/>
<property name="debugFile" value="debug.out"/>
<property name="isDistFile" value=".isdist"/>
<property name="myJavacPars" value=""/>
<property name="ROOTDIR" value=".."/>
<property name="NAME" value="NONAME"/>
<property name="args" value=""/>
<property name="binDir" value="bin"/>
<property name="classDir" value="classes"/>
<property name="srcDir" value="src"/>
<property name="libDir" value="lib"/>
<property name="distDir" value="dist"/>
<property name="saveDir" value="Saves"/>
<property name="java.runtime" value="/tools/jdk1.5.0_06/jre/lib/rt.jar"/>
<property name="repastDir" value="/media/hda2/seoc/Repast-3.1/Repastj"/>
<property name="cscslibDir" value="/media/hda2/seoc/Repast-3.1/Repastj"/>
<property name="visadDir" value="/media/hda2/seoc/Repast-3.1/Repastj"/>
<fileset id="repast.jars" dir="${repastDir}">
<include name="repast.jar"/>
<include name="lib/colt.jar"/>
<include name="lib/jgl3.1.0.jar"/>
<include name="lib/plot.jar"/>
<include name="lib/trove.jar"/>
</fileset>
<fileset id="cscs.jars" dir="${cscslibDir}">
<include name="graph3d.jar"/>
<include name="ioutils.jar"/>
<include name="hbbeta2-printf.jar"/>
</fileset>
<fileset id="visad.jars" dir="${visadDir}">
<include name="visad.jar"/>
</fileset>
<path id="classpath">
<pathelement location="${classDir}"/>
<fileset refid="repast.jars"/>
<fileset refid="cscs.jars"/>
<fileset refid="visad.jars"/>
</path>
<property name="classpath.string" refid="classpath"/>
<target name="help"
depends="getDate,getTime">
<echo>
ANT TASKS
all creates the "${classDir}" directory, compiles the code,
and puts the compiled classes into the "${classDir}"
directory.
batchrun run the program in batch mode. arguments can be passed
to the batch run by doing:
ant batchrun -Dargs="your arguments here"
see below about setting arguments on the command line
clean deletes the directory "${classDir}"
compile compiles the project and puts the compiled classes in
"${classDir}"
To have all the warnings printed, compile with
ant compile -DmyJavacPars="-Xlint:unchecked"
debug run the project in debug mode, piping the output to ${debugFile}
distjar creates a distribution jarfile in "${distDir}/${projectName}.jar"
parsereport parses an XML report file given by the F argument.
for example, to parse the report file "report.xml.00" do:
ant parsereport -Dargs="report.xml.00"
prepare prepares the project to be compiled (creates the
"${classDir}" directory)
projecthelp shows the help that is printed in the project
realclean deletes "${classDir}", "${libDir}", "${distDir}", and the debug
and report files
run run the program in GUI mode. you can pass arguments to the
model by doing:
ant run -Dargs="your arguments here"
see below about setting arguments on the command line
save create a jarfile with the contents of the current directory
and store it in:
"${saveDir}/projectName-today'sdate-timerightnow.jar"
for example, if one were created right now it would have
the name:
"${saveDir}/${projectName}-${today}-${timenow}.jar"
OPTIONAL PARAMETERS
Here is the list of buildfile parameters that can be changed:
NAME DESCRIPTION
debugFile the debug file name
args a listing of the arguments to send to the java program
example:
ant run -Dargs="iPFN=dat/parameters1.xml nA=100"
debugFile and args could be used with any of the run commands
To set any of the above parameters do -DNAMEOFARGUMENT="value"
For example,
ant run -Dargs="iPFN=dat/parameters1.xml nA=100"
</echo>
</target>
<target name="all"
description="creates the ${classDir} directory, compiles the code, and puts the compiled classes into the ${classDir} directory"
depends="prepare, compile"/>
<target name="prepare" description="prepares the project to be compiled (creates the ${classDir} directory)">
<mkdir dir="${classDir}"/>
</target>
<target name="compile"
description="compiles the project and puts the compiled classes in ${classDir}"
depends="prepare">
<dependset>
<srcfileset dir="${srcDir}" includes="**/*.java"/>
<srcfileset dir="." includes="build.xml"/>
<targetfileset dir="${classDir}" includes="**/*.class"/>
</dependset>
<javac destdir="${classDir}"
srcdir="${srcDir}">
<classpath refid="classpath"/>
<compilerarg line="${myJavacPars}"/>
</javac>
</target>
<target name="run"
description="run the project and send output to screen"
depends="compile">
<java classname="${projectName}.GUIModel"
fork="true">
<classpath refid="classpath"/>
<arg line="${args}"/>
</java>
</target>
<target name="debug"
description="run the project in GUI mode and pipe the output to ${debugFile}"
depends="compile">
<echo message="*** debug mode: Piping debug output to ${debugFile} ***"/>
<java classname="${projectName}.GUIModel"
fork="true"
output="${debugFile}">
<classpath refid="classpath"/>
<arg line="${args}"/>
</java>
</target>
<target name="batchrun"
depends="compile"
description="run the project in batch mode">
<java classname="${projectName}.BatchModel"
fork="true">
<classpath refid="classpath"/>
<arg line="${args}"/>
</java>
</target>
<target name="projecthelp"
description="shows the help that is printed in the project"
depends="compile">
<java classname="${projectName}.GUIModel"
fork="true">
<classpath refid="classpath"/>
<arg line="--help"/>
</java>
</target>
<target name="clean"
description="deletes the directory ${classDir}">
<delete dir="${classDir}"/>
</target>
<target name="realclean"
description="deletes ${classDir}, ${libDir}, ${distDir}, and the debug and report files">
<delete dir="${classDir}"/>
<delete dir="${libDir}"/>
<delete dir="${distDir}"/>
<delete file="${debugFile}"/>
<delete file="report.00"/>
</target>
<target name="save"
depends="getDate, getTime"
description="create a save jar in ${saveDir}/${projectName}-${today}-${timenow}.jar">
<jar jarfile="${saveDir}/${projectName}-${today}-${timenow}.jar"
basedir="."
includes="${srcDir}/**, dat/**, *.txt, build.xml"/>
<echo message="The jarfile is in ${saveDir}/${projectName}-${today}-${timenow}.jar"/>
</target>
<target name="getDate">
<tstamp>
<format property="today"
pattern="yyMMdd"/>
</tstamp>
</target>
<target name="getTime">
<tstamp>
<format property="timenow"
pattern="HHmm"/>
</tstamp>
</target>
<target name="parsereport"
description="parse a report file given by the args argument"
depends="compile">
<java classname="mcharter.parseReport"
fork="true">
<classpath refid="classpath"/>
<arg line="${args}"/>
</java>
</target>
</project>