-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
108 lines (97 loc) · 4.61 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?xml version="1.0"?>
<project name="depot" default="compile" basedir="." xmlns:artifact="urn:maven-artifact-ant">
<!-- project metadata -->
<property name="src.dir" value="src/main/java"/>
<property name="test.dir" value="src/test/java"/>
<property name="deploy.dir" value="dist"/>
<property name="classes.dir" value="${deploy.dir}/classes"/>
<property name="tclasses.dir" value="${deploy.dir}/test-classes"/>
<property name="javadoc.dir" value="${deploy.dir}/docs"/>
<property name="ooo-build.vers" value="2.9"/>
<ant antfile="bootstrap.xml"/>
<import file="${user.home}/.m2/ooo-build/${ooo-build.vers}/ooo-build.xml"/>
<target name="-prepare" depends="-init-contrib">
<mkdir dir="${deploy.dir}"/>
<mavendep pom="pom.xml" scope="compile"/>
<mavendep pom="pom.xml" id="test" scope="test"/>
<path id="built.path">
<path refid="test.path"/>
<pathelement location="${classes.dir}"/>
<pathelement location="${tclasses.dir}"/>
</path>
</target>
<target name="genrecord" depends="-prepare"
description="Generates fields for persistent record classes.">
<taskdef name="grecord" classname="com.samskivert.depot.tools.GenRecordTask"
classpathref="built.path"/>
<!-- make sure the record class files are all compiled -->
<ooojavac destdir="${classes.dir}" classpathref="built.path" srcdir="${src.dir}"
version="1.5">
<include name="**/*Record.java"/>
</ooojavac>
<ooojavac destdir="${tclasses.dir}" classpathref="built.path" srcdir="${test.dir}"
version="1.5">
<include name="**/*Record.java"/>
</ooojavac>
<!-- now update the source files -->
<grecord classpathref="built.path">
<fileset dir="${src.dir}" includes="**/*Record.java"/>
<fileset dir="${test.dir}" includes="**/*Record.java"/>
</grecord>
</target>
<target name="clean" description="Cleans out build results.">
<delete dir="${deploy.dir}"/>
</target>
<target name="compile" depends="-prepare" description="Compiles the code.">
<mkdir dir="${classes.dir}"/>
<copy todir="${classes.dir}">
<fileset dir="src/main/resources" includes="**/*.tmpl"/>
</copy>
<ooojavac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="pom.xml.path"
version="1.5"/>
<mkdir dir="${tclasses.dir}"/>
<ooojavac srcdir="${test.dir}" destdir="${tclasses.dir}" classpathref="built.path"
version="1.5"/>
</target>
<target name="javadoc" depends="-prepare" description="Generates javadoc documentation.">
<mkdir dir="${javadoc.dir}"/>
<tstamp><format property="year" pattern="yyyy" /></tstamp>
<javadoc windowtitle="${ant.project.name} API" doctitle="${ant.project.name} API"
access="public" overview="src/main/javadoc/overview.html" destdir="${javadoc.dir}"
additionalparam="-breakiterator">
<packageset dir="${src.dir}">
<exclude name="**/impl/**"/>
</packageset>
<bottom>Copyright © 2006-${year} Michael Bayne, et al. All Rights Reserved.</bottom>
<classpath refid="built.path"/>
<link href="http://download.oracle.com/javase/1.5.0/docs/api/"/>
<link href="http://samskivert.github.com/samskivert/apidocs/"/>
</javadoc>
</target>
<target name="tests" depends="compile" description="Runs the unit tests.">
<!-- allows passing -Dtest=NamePrefix to restrict to subset of tests -->
<property name="test" value=""/>
<taskdef name="unit" classpathref="test.path"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
<mkdir dir="${deploy.dir}/test-reports"/>
<unit printsummary="off" haltonfailure="yes" fork="${junit.fork}">
<classpath refid="built.path"/>
<sysproperty key="com.samskivert.depot.debug" value="${debug}"/>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="${deploy.dir}/test-reports">
<fileset dir="${test.dir}" includes="**/${test}*Test.java"/>
</batchtest>
</unit>
</target>
<target name="package" depends="compile" description="Compiles code and builds jar file.">
<jar destfile="${deploy.dir}/${ant.project.name}.jar" basedir="${classes.dir}"/>
</target>
<target name="install" depends="package" description="Installs to local Maven repo.">
<maveninstall file="${deploy.dir}/${ant.project.name}.jar" pom="pom.xml"/>
</target>
<target name="deploy" depends="package,tests,javadoc" description="Deploys to remote Maven repo.">
<mavendeploy file="${deploy.dir}/${ant.project.name}.jar" pom="pom.xml"
srcdir="${src.dir}" docdir="${javadoc.dir}"/>
</target>
</project>