devinsy-xml/build.xml

98 lines
3.4 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="dist" name="Create Jar for Project devinsy-utils">
<!--ANT 1.7 is required -->
<property file="build.properties"/>
<property name="build.dir" value="${basedir}/build" />
<property name="build.src" value="${basedir}/src" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="test.src" value="${basedir}/test" />
<property name="test.classes" value="${build.dir}/test-classes" />
<property name="dist.dir" value="${basedir}/dist" />
<property name="debug" value="on"/>
<path id="build.classpath">
<fileset dir="lib" includes="**/*.jar"/>
</path>
<path id="test.classpath.compile">
<path refid="build.classpath"/>
<pathelement path="${build.classes}"/>
</path>
<path id="test.classpath.run">
<path refid="test.classpath.compile"/>
<pathelement path="${test.classes}"/>
</path>
<!-- Help -->
<target name="help" description="Display detailed usage information">
<echo>Type ant -p</echo>
</target>
<!-- ***** Clean ***** -->
<target name="clean" description="Clean temporary directories">
<delete dir="${build.dir}"/>
</target>
<!-- ***** Compile ***** -->
<target name="compile" description="Compile main code">
<mkdir dir="${build.dir}/classes"/>
<javac srcdir="${build.src}" destdir="${build.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
<classpath refid="test.classpath.compile"/>
</javac>
</target>
<!-- ***** Compile test ***** -->
<target name="compile-test" description="Compile test code">
<mkdir dir="${test.classes}"/>
<javac srcdir="${test.src}" destdir="${test.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
<classpath refid="test.classpath.compile"/>
</javac>
</target>
<!-- ***** Test ***** -->
<target name="test" description="Run unit tests" depends="clean,compile,compile-test">
<mkdir dir="${build.dir}/test-reports"/>
<junit printsummary="yes" haltonfailure="yes">
<classpath refid="test.classpath.run"/>
<formatter type="plain" usefile="true" />
<batchtest fork="yes" todir="${build.dir}/test-reports/">
<fileset dir="test">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- ***** Dist ***** -->
<target name="dist" description="Build distribution" depends="clean,compile">
<!-- -->
<mkdir dir="${dist.dir}"/>
<buildnumber file="build.num" description="Id of the build"/> <!-- AUTOMATIC MANAGEMENT -->
<property name="dist.version" value="${product.revision.major}.${product.revision.minor}.${build.number}" />
<property name="dist.name" value="${product.name}-${dist.version}" />
<!-- Package compiled -->
<property name="dist.jar" value="${dist.dir}/${dist.name}.jar" />
<tstamp>
<format property="dist.time" pattern="dd/MM/yyyy HH:mm:ss" /> <!-- TODAY -->
</tstamp>
<jar destfile="${dist.jar}" >
<manifest>
<attribute name="Built-By" value="${user.name} using ant"/>
<attribute name="Built-Date" value="${dist.time}"/>
</manifest>
<fileset dir="${basedir}/build" excludes="TestTree/**" />
<zipfileset dir="${basedir}/" includes="LICENSE"/>
</jar>
<!-- Package sources -->
<property name="dist.srczip" value="${basedir}/dist/${dist.name}-sources.zip" />
<zip destfile="${dist.srczip}" update="true" preserve0permissions="true">
<fileset dir="${basedir}/src"/>
<zipfileset dir="${basedir}/" includes="LICENSE"/>
</zip>
</target>
</project>