Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (67 sloc) 4.05 KB
<?xml version="1.0" encoding="utf-8" ?>
<project name="java-statsd-client" default="snapshot" basedir=".">
<property name="target.version" value="1.0.0"/>
<property name="build.dir" value="${basedir}/build"/>
<tstamp><format property="build.number" pattern="yyyyMMddHHmmss" timezone="GMT"/></tstamp>
<tstamp><format property="build.timestamp" pattern="yyyy-MM-dd HH:mm:ss" timezone="GMT"/></tstamp>
<target name="-version-for-snapshot" unless="version.label">
<property name="version.label" value="${target.version}-SNAPSHOT-${build.number}"/>
</target>
<target name="-version-for-release" unless="version.label">
<property name="version.label" value="${target.version}"/>
</target>
<target name="-version" depends="-version-for-snapshot,-version-for-release">
<echo message="Building version ${version.label}"/>
</target>
<target name="clean" description="Clean this project">
<delete dir="${build.dir}" failonerror="false"/>
<mkdir dir="${build.dir}"/>
</target>
<target name="jar" description="Create Jar files" depends="clean,-version">
<mkdir dir="${build.dir}/main.classes"/>
<javac srcdir="${basedir}/src/main/java" destdir="${build.dir}/main.classes" includes="**"
includeantruntime="false" encoding="utf-8" source="1.6" target="1.6" debug="true" debuglevel="lines,source"/>
<jar destfile="${build.dir}/${ant.project.name}-${version.label}.jar">
<fileset dir="${build.dir}/main.classes"/>
<fileset dir="${basedir}" includes="LICENSE README.md"/>
<manifest>
<attribute name="Implementation-Title" value="${ant.project.name}"/>
<attribute name="Implementation-Vendor" value="YouDevise"/>
<attribute name="Implementation-Version" value="@{moduleversion}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Built-Date" value="${build.timestamp}"/>
</manifest>
</jar>
<jar destfile="${build.dir}/${ant.project.name}-${version.label}-sources.jar">
<fileset dir="${basedir}/src/main/java"/>
<fileset dir="${basedir}" includes="LICENSE"/>
</jar>
<mkdir dir="${build.dir}/test.classes"/>
<zip destfile="${build.dir}/test-compiledeps.jar"><zipgroupfileset dir="${basedir}/vendor/buildlib" includes="**/*.jar"/></zip>
<javac srcdir="${basedir}/src/test/java" destdir="${build.dir}/test.classes" includes="**"
includeantruntime="false" encoding="utf-8" source="1.6" target="1.6" debug="true" debuglevel="lines,source"
classpath="${build.dir}/test-compiledeps.jar:${build.dir}/${ant.project.name}-${version.label}.jar"/>
<jar destfile="${build.dir}/${ant.project.name}-test-${version.label}.jar">
<fileset dir="${build.dir}/test.classes"/>
<zipfileset src="${build.dir}/test-compiledeps.jar" excludes="**/META-INF/**"/>
</jar>
</target>
<target name="test" description="Test this project" depends="jar">
<mkdir dir="${build.dir}/testreport"/>
<mkdir dir="${build.dir}/test.tmp"/>
<junit printsummary="yes" haltonfailure="yes" forkmode="once" tempdir="${build.dir}/test.tmp">
<classpath>
<pathelement location="${build.dir}/${ant.project.name}-${version.label}.jar"/>
<pathelement location="${build.dir}/${ant.project.name}-test-${version.label}.jar"/>
</classpath>
<formatter type="xml"/>
<batchtest fork="yes" todir="${build.dir}/testreport">
<zipfileset src="${build.dir}/${ant.project.name}-test-${version.label}.jar">
<include name="com/timgroup/statsd/**/*Test.class"/>
</zipfileset>
</batchtest>
</junit>
</target>
<target name="snapshot" description="Create a tested snapshot jar file" depends="test"/>
<target name="release" description="Create a tested release jar file" depends="-version-for-release,snapshot"/>
</project>