cs2440-lab2/build.xml

88 lines
2.8 KiB
XML

<project name="MyProject" default="run" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="testdir" location="src/tests" />
<property name="dist" location="dist" />
<property name="lib" location="lib" />
<target name="init">
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<mkdir dir="${testdir}" />
<mkdir dir="${src}" />
<mkdir dir="${lib}" />
</target>
<path id = "classpath.base">
<fileset dir="lib/" includes="*.jar" />
<pathelement location="${src}" />
</path>
<path id = "classpath.test">
<pathelement path = "../lib/junit-4.13.1.jar" />
<path refid = "classpath.base" />
<pathelement location = "${build}" />
</path>
<target name="path">
<echo message="${toString:classpath.base}"/>
</target>
<target name="test" depends="compile">
<echo message="${toString:classpath.base}" />
<echo message="${toString:classpath.test}" />
<junit>
<classpath refid = "classpath.test" />
<test name = "tests.MazeGameTest" />
<formatter type="brief" usefile="false" />
</junit>
</target>
<target name="compile" depends="init"
description="compile the source">
<!-- Compile the Java code from ${src} into ${build} -->
<path refid = "classpath.base" />
<javac includeantruntime="true" srcdir="${src}" destdir="${build}">
<classpath>
<path refid="classpath.base" />
</classpath>
</javac>
<!--<javac includeantruntime="true" srcdir="${testdir}" destdir="${build}">
<classpath>
<path refid="classpath.base" />
</classpath>
</javac>-->
</target>
<target name="clean"
description="clean up">
<!-- Delete the ${build} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<target name="dist" depends="compile"
description="generate the distribution">
<manifest file="build/MANIFEST.MF">
<attribute name="Main-Class" value="Main" />
</manifest>
<mkdir dir="${dist}/lib" />
<jar jarfile="${dist}/lib/project-${DSTAMP}.jar" basedir="${build}" manifest ="build/MANIFEST.MF" />
</target>
<target name="run" depends="compile">
<java classname="solution.MazeGame">
<classpath>
<pathelement path="${build}" />
</classpath>
</java>
</target>
</project>