/
build.xml
74 lines (65 loc) · 3.09 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?xml version="1.0"?>
<project name="pythagoras" default="compile" basedir="." xmlns:artifact="urn:maven-artifact-ant">
<property name="src.dir" location="src/main/java"/>
<property name="tsrc.dir" location="src/test/java"/>
<property name="target.dir" location="target"/>
<property name="classes.dir" location="${target.dir}/classes"/>
<property name="tclasses.dir" location="${target.dir}/test-classes"/>
<property name="ooo-build.vers" value="2.9"/>
<ant antfile="etc/bootstrap.xml"/>
<import file="${user.home}/.m2/ooo-build/${ooo-build.vers}/ooo-build.xml"/>
<target name="-prepare" depends="-init-ooo">
<mkdir dir="${target.dir}"/>
<mavendep pom="pom.xml"/>
<mavendep pom="pom.xml" id="test" scope="test"/>
<path id="test.classpath">
<path refid="test.path"/>
<pathelement location="${classes.dir}"/>
<pathelement location="${tclasses.dir}"/>
</path>
</target>
<target name="clean" description="Deletes all build results.">
<delete dir="${target.dir}"/>
</target>
<target name="compile" depends="-prepare" description="Compiles the code.">
<mkdir dir="${classes.dir}"/>
<ooojavac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="pom.xml.path">
<exclude name="pythagoras/gwt/**"/>
</ooojavac>
<mkdir dir="${tclasses.dir}"/>
<ooojavac srcdir="${tsrc.dir}" destdir="${tclasses.dir}" classpathref="test.classpath"/>
</target>
<target name="javadoc" depends="-prepare" description="Builds the Java documentation">
<mkdir dir="${target.dir}/docs"/>
<javadoc sourcepath="${src.dir}" destdir="${target.dir}/docs"
additionalparam="-breakiterator" classpathref="pom.xml.path">
<link href="http://download.oracle.com/javase/6/docs/api/"/>
</javadoc>
</target>
<target name="test" depends="compile" description="Runs the unit tests.">
<taskdef name="unit" classpathref="test.path"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
<mkdir dir="${target.dir}/test-reports"/>
<unit printsummary="off" haltonfailure="yes" fork="${junit.fork}">
<classpath refid="test.classpath"/>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="${target.dir}/test-reports">
<fileset dir="${tsrc.dir}" includes="**/*Test.java"/>
</batchtest>
</unit>
</target>
<target name="package" depends="test" description="Compiles code and builds jar file.">
<jar destfile="${target.dir}/${ant.project.name}.jar">
<fileset dir="${classes.dir}" includes="**"/>
<fileset dir="${src.dir}" includes="**"/> <!-- include source for GWT -->
</jar>
</target>
<target name="install" depends="package" description="Installs to local Maven repository.">
<maveninstall file="${target.dir}/${ant.project.name}.jar" pom="pom.xml"/>
</target>
<target name="deploy" depends="package,javadoc" description="Deploys to remote Maven repository.">
<mavendeploy file="${target.dir}/${ant.project.name}.jar" pom="pom.xml"
srcdir="${src.dir}" docdir="${target.dir}/docs"/>
</target>
</project>