1<?xml version="1.0"?>
2
3<project name="vogar" default="jar">
4    <property file="local.properties" />
5
6    <!-- can be overridden at the command line with -Dversion=
7         or in IDEA, in the ant properties dialog -->
8    <property name="version" value="0.0"/> <!-- subversion revision? -->
9
10    <property name="installroot" value="build/vogar-${version}"/>
11    <property name="javadocroot" value="${installroot}/docs/api"/>
12    <property name="caliper" value="lib/caliper.jar"/>
13    <property name="gson" value="lib/gson-1.7.1.jar"/>
14    <property name="guava" value="lib/guava.jar"/>
15    <property name="kxml2" value="lib/kxml-libcore-20110123.jar"/>
16    <property name="android" value="${android.platform.dir}/android.jar"/>
17
18    <path id="dependencies">
19        <pathelement location="${caliper}"/>
20        <pathelement location="${gson}"/>
21        <pathelement location="${guava}"/>
22        <pathelement location="${kxml2}"/>
23        <pathelement location="${android}"/>
24    </path>
25
26    <target name="compile"
27            description="Compile all Java source code">
28        <fail unless="android.platform.dir"
29               message="No android.platform.dir. Create local.properties or put Android tools on your $PATH."/>
30        <mkdir dir="build/classes"/>
31        <javac srcdir="src"
32               includes="**"
33               destdir="build/classes"
34               debug="on"
35               source="1.5"
36               target="1.5"
37               classpathref="dependencies">
38            <compilerarg value="-Xlint"/>
39            <!--compilerarg value="-Werror"/-->
40        </javac>
41    </target>
42
43    <target name="jar"
44            depends="compile"
45            description="Build JAR archive of vogar">
46        <jar destfile="build/vogar.jar" update="true" index="true">
47            <fileset dir="build/classes"/>
48            <zipfileset src="${caliper}"/>
49            <zipfileset src="${gson}"/>
50            <zipfileset src="${guava}"/>
51            <zipfileset src="${kxml2}"/>
52            <fileset dir="resources"/>
53            <manifest>
54                <attribute name="Main-Class" value="vogar.Vogar"/>
55            </manifest>
56        </jar>
57    </target>
58
59    <target name="compiletests"
60            depends="jar"
61            description="Compile all Java test code">
62        <mkdir dir="build/test-classes"/>
63        <javac srcdir="test"
64               includes="vogar/**"
65               destdir="build/test-classes"
66               debug="on"
67               source="1.5"
68               target="1.5"
69               classpathref="dependencies">
70            <compilerarg value="-Xlint"/>
71            <!--compilerarg value="-Werror"/-->
72            <classpath>
73                <pathelement location="build/vogar.jar" />
74                <pathelement location="${mockito}"/>
75            </classpath>
76        </javac>
77    </target>
78
79    <target name="clean"
80            description="Remove all generated files.">
81        <delete dir="build"/>
82    </target>
83
84</project>
85