1<?xml version="1.0" ?>
2
3<project name="libaddressinput" default="compile">
4  <property name="src.dir" value="src"/>
5  <property name="test.dir" value="test"/>
6  <property name="build.dir" value="build"/>
7  <property name="classes.dir" value="${build.dir}/classes"/>
8  <property name="jar.dir" value="${build.dir}/jar"/>
9  <property name="testdata.dir" value="/testdata"/>
10  <property name="testlibs.dir" value="testlibs"/>
11  <property name="report.dir" value="${build.dir}/junitreport"/>
12
13  <path id="classpath">
14    <fileset dir="${src.dir}" includes="src/com/android/i18n/**"/>
15    <pathelement location="android.jar"/>
16  </path>
17  <path id="test.classpath">
18    <pathelement location="${classes.dir}"/>
19    <pathelement location="${jar.dir}/${ant.project.name}-test.jar"/>
20    <fileset dir="${testlibs.dir}" includes="**/*.jar"/>
21  </path>
22
23  <target name="compile" description="Compile Java source.">
24    <mkdir dir="${classes.dir}"/>
25    <!-- AddressWidget*.java must be excluded, as they depend on R.class, which
26         would be generated by the Android resource compiler. -->
27    <javac srcdir="${src.dir}/"
28           encoding="utf-8"
29           includes="com/android/i18n/**"
30           excludes="com/android/i18n/addressinput/AddressWidget*.java"
31           destdir="${classes.dir}"
32           classpathref="classpath"
33           includeantruntime="false"
34           debug="on">
35      <compilerarg value="-Xlint"/>
36    </javac>
37    <javac srcdir="${test.dir}"
38           excludes="com/android/i18n/addressinput/AddressWidget*.java"
39           destdir="${classes.dir}"
40           classpathref="test.classpath"
41           encoding="utf-8"
42           includeantruntime="true"
43           debug="on"/>
44  </target>
45
46  <target name="jar" depends="compile">
47    <mkdir dir="${jar.dir}"/>
48    <jar destfile="${jar.dir}/${ant.project.name}.jar">
49      <fileset dir="${classes.dir}">
50        <include name="**/*.class"/>
51        <exclude name="**/*Test*"/>
52      </fileset>
53    </jar>
54  </target>
55
56  <target name="test-jar" depends="compile">
57    <mkdir dir="${jar.dir}"/>
58    <jar destfile="${jar.dir}/${ant.project.name}-test.jar">
59      <fileset dir="${classes.dir}">
60        <include name="**/*.class"/>
61        <exclude name="**/*Test*"/>
62      </fileset>
63      <fileset dir="${testdata.dir}" />
64    </jar>
65  </target>
66
67 <target name="junit" depends="test-jar">
68    <mkdir dir="${report.dir}"/>
69    <junit printsummary="yes">
70      <classpath refid="test.classpath"/>
71      <formatter type="xml"/>
72      <batchtest fork="no" todir="${report.dir}">
73        <fileset dir="${test.dir}">
74          <include name="**/*Test*"/>
75          <exclude name="**/AddressWidget*"/>
76        </fileset>
77      </batchtest>
78    </junit>
79  </target>
80
81  <target name="junitreport">
82    <junitreport todir="${report.dir}">
83      <fileset dir="${report.dir}" includes="TEST-*.xml"/>
84        <report todir="${report.dir}"/>
85    </junitreport>
86  </target>
87
88  <target name="clean" description="Remove generated files.">
89    <delete dir="${build.dir}"/>
90  </target>
91
92  <target name="clean-build" depends="clean,jar"/>
93</project>
94