Files
lightspeed/build.xml
2017-03-16 10:57:29 -05:00

92 lines
3.0 KiB
XML

<project name="Lightspeed" default="jar" basedir=".">
<description>
Standard Lightspeed Build File
</description>
<!-- set global properties for this build -->
<property name="src" location="${opdir}/src"/>
<property name="test" location="${opdir}/test"/>
<property name="bin" location="${opdir}/bin"/>
<property name="lib" location="${opdir}/lib"/>
<property name="dist" location="${bin}/dist"/>
<property name="name" value="ProjectSWG"/>
<property name="main.class" value="main.ProjectSWG"/>
<property name="jar" location="${dist}/${name}.jar"/>
<property name="ext-jar" location="${dist}/${name}-dependencies.jar"/>
<path id="ant.path">
<fileset dir="lib/ant/">
<include name="*.jar" />
</fileset>
<pathelement location="junit-4.12.jar"/>
</path>
<taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpathref="ant.path" />
<target name="init">
<!-- Create the bin directory structure used by compile -->
<mkdir dir="${bin}"/>
</target>
<target name="compile" depends="init" description="Compile the sources">
<path id="classpath">
<pathelement path="${classpath}"/>
<fileset dir="${lib}" includes="**/*.jar" />
</path>
<!-- Compile sources -->
<javac srcdir="${src}" destdir="${bin}" includeantruntime="true" fork="true" debug="true">
<classpath refid="classpath" />
</javac>
<!-- Compile tests -->
<javac srcdir="${test}" destdir="${bin}" includeantruntime="true" fork="true" debug="true">
<classpath refid="classpath" />
</javac>
</target>
<target name="test" depends="compile" description="Test">
<junit printsummary="yes" haltonfailure="no" includeantruntime="true" fork="true" dir="${opdir}">
<classpath>
<pathelement location="${bin}" />
<pathelement location="hamcrest-core-1.3.jar" />
<pathelement location="junit-4.12.jar" />
<fileset dir="${lib}" includes="**/*.jar" />
</classpath>
<test name="main.TestAll" haltonfailure="no">
</test>
</junit>
</target>
<target name="jar" depends="compile" description="Create the JAR">
<!-- Create the distribution directory -->
<delete dir="${dist}" />
<mkdir dir="${dist}"/>
<!-- Create the classpath -->
<path id="classpath">
<fileset dir="${lib}" includes="**/*.jar" />
</path>
<pathconvert property="manifest.classpath" pathsep=" " refid="classpath">
<!-- Map it to a manifest-compatible string -->
<map from="${opdir}/" to=""/>
</pathconvert>
<jar jarfile="${ext-jar}">
<zipgroupfileset dir="${lib}">
<include name="**/*.jar"/>
</zipgroupfileset>
</jar>
<!-- Create the JAR -->
<jar destfile="${jar}" basedir="${bin}">
<fileset dir="${bin}" includes="**/*.class" />
<zipfileset src="${ext-jar}" excludes="META-INF/**/*" />
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
<delete file="${ext-jar}" />
</target>
<target name="clean" description="Clean up">
<!-- Delete the ${bin} directory -->
<delete dir="${dist}"/>
<delete dir="${bin}"/>
</target>
</project>