Find file
Fetching contributors…
Cannot retrieve contributors at this time
151 lines (133 sloc) 5.36 KB
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build-all" name="sigint-emitter-java">
<property environment="env"/>
<property file="build.properties"/>
<property name="dir.src.java" value="${basedir}/src/main/java"/>
<property name="dir.src.test" value="${basedir}/test/java"/>
<property name="dir.build" value="${basedir}/build"/>
<property name="dir.compile" value="${dir.build}/classes/main"/>
<property name="dir.compile.test" value="${dir.build}/classes/test"/>
<property name="dir.lib" value="${basedir}/lib"/>
<property name="dir.dist" value="${basedir}/dist"/>
<property name="dir.test.results" value="${dir.build}/junit"/>
<property name="dir.test.report" value="${dir.test.results}/report"/>
<property name="project.name" value="${ant.project.name}-${version}"/>
<path id="lib.classpath">
<fileset dir="${dir.lib}">
<include name="**/*.jar"/>
<exclude name="**/sources/*"/>
</fileset>
</path>
<path id="compile.classpath">
<pathelement location="${dir.compile}"/>
<path refid="lib.classpath"/>
</path>
<path id="runtime.classpath">
<pathelement location="${dir.compile}"/>
<path refid="lib.classpath"/>
</path>
<path id="unit_test.classpath">
<path refid="runtime.classpath"/>
<pathelement location="${dir.compile.test}"/>
</path>
<target name="_init">
<mkdir dir="${dir.compile}"/>
<mkdir dir="${dir.compile.test}"/>
<mkdir dir="${dir.dist}"/>
<mkdir dir="${dir.src.test}"/>
</target>
<target name="clean" description="--> Clean everything">
<delete dir="${dir.build}"/>
<delete dir="${dir.dist}"/>
</target>
<!-- ======================================================================
target: compile
====================================================================== -->
<target name="compile" depends="_init">
<javac destdir="${dir.compile}"
failonerror="yes"
fork="yes"
source="${javac.source}"
debug="${javac.debug}">
<classpath>
<path refid="compile.classpath"/>
</classpath>
<src>
<pathelement location="${dir.src.java}"/>
</src>
</javac>
<javac destdir="${dir.compile.test}"
failonerror="yes"
fork="yes"
source="${javac.source}"
debug="${javac.debug}">
<classpath>
<path refid="compile.classpath"/>
</classpath>
<src>
<pathelement location="${dir.src.test}"/>
</src>
</javac>
</target>
<!-- ======================================================================
target: build
====================================================================== -->
<target name="build" depends="compile, unit-test"/>
<!-- ======================================================================
target: build-all
====================================================================== -->
<target name="build-all" depends="clean, compile, unit-test"/>
<!-- ======================================================================
target: unit-test
====================================================================== -->
<target name="unit-test" depends="_init, compile" description="--> Execute unit tests">
<delete dir="${dir.test.results}"/>
<mkdir dir="${dir.test.results}"/>
<junit printsummary="true">
<classpath refid="unit_test.classpath"/>
<formatter type="xml" usefile="true"/>
<batchtest errorproperty="test.failure" failureproperty="test.failure" fork="yes" todir="${dir.test.results}">
<fileset dir="${dir.src.test}">
<include name="**/*Test.java"/>
<include name="**/*TestCase.java"/>
</fileset>
</batchtest>
</junit>
<mkdir dir="${dir.test.report}"/>
<junitreport todir="${dir.test.report}">
<report format="frames" todir="${dir.test.report}"/>
<fileset dir="${dir.test.results}"/>
</junitreport>
<fail if="test.failure" message="Unit-Tests failed."/>
</target>
<!-- =================================
target: docs
================================= -->
<target name="dist-docs" description="--> Generate the service documentation">
<echo message="This task has not been implemented!"/>
</target>
<!-- ======================================================================
target: release
====================================================================== -->
<target name="release" depends="_init, compile" description="--> Release a distro">
<manifestclasspath property="jar.classpath" jarfile="${dir.dist}/${ant.project.name}deps.jar">
<classpath refid="lib.classpath" />
</manifestclasspath>
<jar destfile="${dir.dist}/${project.name}.jar">
<fileset dir="${dir.compile}"/>
</jar>
<jar destfile="${dir.dist}/${project.name}-src.jar">
<fileset dir="${dir.src.java}"/>
</jar>
<tar destfile="${dir.dist}/${project.name}-deps.tgz" compression="gzip">
<tarfileset dir="${dir.dist}" prefix="${project.name}" includes="${project.name}.jar"/>
<tarfileset dir="${dir.lib}" prefix="${project.name}">
<include name="*.jar"/>
</tarfileset>
</tar>
<jar destfile="${dir.dist}/${project.name}-nodeps.jar">
<zipgroupfileset dir="lib" includes="*.jar" excludes="junit*, mockito*, slf4j*" />
<zipgroupfileset dir="${dir.dist}" includes="${project.name}.jar" />
</jar>
</target>
</project>