blob: 61390d621c6b620a59d55827f8f9d425390f56b7 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<project name="Any23" default="dist" basedir=".">
<property name="name" value="any23"/>
<!-- NOTE, there's also a version string in Any23.java, they should match! -->
<property name="version" value="0.3.0"/>
<property name="project.package" value="com.google.code.any23"/>
<property name="src" value="src/main/java"/>
<property name="src.resources" value="src/main/resources"/>
<property name="src.tests" value="src/test/java"/>
<property name="src.tests.resources" value="src/test/resources"/>
<property name="build" value="bldsrc"/>
<property name="build.tests" value="bldtest"/>
<property name="build.lib" value="bldlib"/>
<property name="lib" value="lib"/>
<property name="javadoc" value="javadoc"/>
<property name="distname" value="${name}-${version}"/>
<property name="jar" value="${lib}/${distname}.jar"/>
<property name="zip" value="${distname}.zip"/>
<property name="tar" value="${distname}.tar.gz"/>
<property name="war" value="${name}.war" />
<property name="junit.jar" value="${lib}/junit-4.5.jar"/>
<path id="project.class.path">
<fileset dir="${lib}">
<include name="**/*.jar"/>
<exclude name="${junit.jar}"/>
</fileset>
<pathelement path="${java.class.path}"/>
</path>
<path id="runtime.class.path">
<path refid="project.class.path"/>
<pathelement path="${src.resources}"/>
<pathelement path="${src.tests.resources}"/>
</path>
<patternset id="distfiles">
<include name="**/*"/>
<exclude name="${build}/**"/>
<exclude name="${build.tests}/**"/>
<exclude name="build/**"/>
<exclude name="target/**"/>
<exclude name="${zip}"/>
<exclude name="${tar}"/>
<exclude name=".project"/>
<exclude name=".classpath"/>
<exclude name=".settings/**"/>
<exclude name="cobertura.ser"/>
<exclude name="*.ipr"/>
<exclude name="*.iws"/>
<exclude name="*.iml"/>
</patternset>
<property name="execfiles" value="rover server"/>
<target
name="clean"
description="Cleanup the generated files and folders."
>
<delete dir="${javadoc}" failonerror="false"/>
<delete dir="${build}" failonerror="false"/>
<delete dir="${build.tests}" failonerror="false"/>
<delete dir="${build.lib}" failonerror="false"/>
<delete file="${war}" failonerror="false"/>
<delete failonerror="false">
<fileset dir="." includes="${lib}/${name}-*.jar,${name}-*.zip,${name}-*.tar.gz"/>
</delete>
</target>
<target name="init">
<mkdir dir="${build}"/>
</target>
<target
name="compile"
depends="init"
description="Compile the source code."
>
<javac srcdir="${src}" destdir="${build}" debug="on" source="1.5" target="1.5">
<classpath refid="project.class.path"/>
</javac>
</target>
<target name="init.tests">
<mkdir dir="${build.tests}"/>
</target>
<target name="compile.tests" depends="init.tests,compile">
<javac srcdir="${src.tests}" destdir="${build.tests}" debug="on" source="1.5" target="1.5">
<classpath>
<path refid="project.class.path"/>
<pathelement path="${build}"/>
<pathelement path="${junit.jar}"/>
</classpath>
<include name="**/*"/>
</javac>
</target>
<target name="copy" depends="compile">
<copy todir="${build}">
<fileset dir="${src}/../resources/">
</fileset>
</copy>
<copy todir="${build}">
<fileset dir="${src}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target
name="test"
depends="compile.tests,copy"
description="Run the test suite."
>
<junit haltonerror="true">
<classpath>
<path refid="runtime.class.path"/>
<pathelement path="${build}"/>
<pathelement path="${build.tests}"/>
<pathelement path="${junit.jar}"/>
</classpath>
<batchtest>
<fileset dir="${src.tests}">
<include name="**/Test*.java"/>
<include name="**/*Test.java"/>
</fileset>
<formatter type="brief" usefile="false" />
</batchtest>
</junit>
</target>
<target
name="jar"
depends="compile,copy"
description="Generate the library JAR."
>
<jar jarfile="${jar}" basedir="${build}">
<manifest>
<attribute name="Main-Class" value="org.deri.any23.cli.Main"/>
</manifest>
</jar>
</target>
<target
name="javadoc"
depends="compile"
description="Generate the source Javadoc."
>
<!-- Creates javadoc documentation for the source
(but not for the tests) -->
<delete dir="${javadoc}"/>
<mkdir dir="${javadoc}"/>
<javadoc packagenames="*"
sourcepath="${src}"
classpathref="project.class.path"
destdir="${javadoc}"
author="true"
version="true"
private="false"
use="true"
splitindex="true"
breakiterator="yes"
windowtitle="Anything to Triples"
doctitle="Anything to Triples">
<link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
</javadoc>
</target>
<target
name="zip"
depends="jar,javadoc"
description="Generate the ZIP library distribution."
>
<zip destfile="${zip}">
<zipfileset prefix="${distname}" dir=".">
<patternset refid="distfiles"/>
</zipfileset>
</zip>
</target>
<target
name="tar"
depends="jar,javadoc"
description="Generate the TAR library distribution."
>
<tar destfile="${tar}" compression="gzip">
<tarfileset prefix="${distname}" dir="." includes="${execfiles}" mode="755"/>
<tarfileset prefix="${distname}" dir="." excludes="${execfiles}">
<patternset refid="distfiles"/>
</tarfileset>
</tar>
</target>
<target
name="dist"
depends="zip,tar"
description="Generate both ZIP and TAR distributions."
/>
<target
name="war"
depends="jar"
description="Generate the library WAR archive."
>
<!-- The jars are in different subdirectories, we must flatten them all into
one directory for the WAR file. So we copy them all into a temporary
directory before building the WAR. -->
<copy todir="${build.lib}" flatten="true">
<fileset dir=".">
<include name="${lib}/*.jar"/>
<include name="${lib}/**/*.jar"/>
<exclude name="${junit.jar}"/>
<exclude name="${lib}/jetty-*/**"/>
</fileset>
</copy>
<war destfile="${war}" needxmlfile="false">
<fileset dir="webapp/">
<include name="**"/>
<exclude name="WEB-INF"/>
</fileset>
<lib dir="${build.lib}" includes="*.jar"/>
<webinf dir="webapp/WEB-INF">
<include name="*"/>
</webinf>
</war>
</target>
</project>