-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
186 lines (157 loc) · 6.6 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!--
Copyright 2008 Raghav Ramesh
This file is part of TestRR.
TestRR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
TestRR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with TestRR. If not, see <http://www.gnu.org/licenses/>.
-->
<project name="TestRR" default="develop">
<record name="${basedir}/build.log" loglevel="verbose" />
<property name="src" value="${basedir}/src/java" />
<property name="build" value="${basedir}/build"/>
<property name="classes" location="${build}/classes"/>
<property name="build.main" location="${build}/classes/main"/>
<property name="build.test" location="${build}/classes/test"/>
<property name="dist" value="${basedir}/dist" />
<property name="lib" value="${basedir}/lib" />
<property name="doc" value="${basedir}/doc" />
<property name="zip" value="${basedir}/zip" />
<property name="test" value="${basedir}/src/test" />
<property name="resources" value="${basedir}/src/properties" />
<property file="properties/${user.name}.properties" />
<property file="properties/build.properties" />
<path id="project.classpath">
<pathelement location="${resources}"/>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</path>
<taskdef classpathref="project.classpath" resource="tasks.properties" />
<target name="develop" depends="clean, init, compile, test, findbugs, jar, copy, dist" />
<target name="distribute" depends="clean, init, compile, jar, copy, javadoc, dist" />
<dirname property="pwd" file="${ant.file}" />
<property name="coverage.file" value="${build}/coverage/cobertura.ser" />
<target name="clean">
<delete dir="${build}" />
<delete dir="${dist}" />
<delete dir="${zip}" />
<delete file="${coverage.file}" />
</target>
<target name="init">
<mkdir dir="${zip}"/>
</target>
<target name="copy">
<copy todir="${zip}/${ant.project.name}">
<fileset dir="${doc}" includes="COPYING*" />
<fileset dir="${doc}" includes="README" />
</copy>
<copy file="${build}/${ant.project.name}.jar" todir="${zip}/${ant.project.name}"/>
</target>
<target name="compile" depends="init">
<mkdir dir="${build.main}"/>
<javac includes="**/*.java" debug="true" destdir="${build.main}">
<src path="${src}" />
<classpath refid="project.classpath" />
</javac>
<mkdir dir="${build.test}"/>
<javac debug="true" destdir="${build.test}">
<src path="${test}"/>
<classpath path="${build.main}"/>
<classpath path="${resources}"/>
<classpath refid="project.classpath" />
</javac>
</target>
<target name="instrument" depends="compile">
<property name="instrumentExcludes" value="**/*Test.*" />
<mkdir dir="${build}/coverage" />
<cobertura-instrument todir="${build}/coverage/classes" datafile="${coverage.file}">
<fileset dir="${build.main}" excludes="${instrumentExcludes}">
<include name="**/*.class" />
</fileset>
<classpath>
<path refid="project.classpath" />
</classpath>
</cobertura-instrument>
</target>
<target name="test" depends="instrument">
<taskdef classpathref="project.classpath" resource="tasks.properties" />
<mkdir dir="${build}/test" />
<dirname property="pwd" file="${ant.file}" />
<junit printsummary="yes" errorproperty="test.fail" failureproperty="test.fail" fork="yes" showoutput="yes">
<sysproperty key="net.sourceforge.cobertura.datafile" file="${coverage.file}" />
<sysproperty key="build.dir" value="${pwd}" />
<formatter type="xml" />
<batchtest todir="${build}/test">
<fileset dir="${test}" includes="**/*Test*.java"/>
</batchtest>
<classpath>
<pathelement location="${build}/coverage/classes" />
<pathelement location="${build.main}"/>
<pathelement location="${build.test}"/>
<path refid="project.classpath" />
<pathelement location="${junit}" />
</classpath>
</junit>
<mkdir dir="${build}/test/html" />
<junitreport todir="${build}/test">
<fileset dir="${build}/test">
<include name="TEST-*.xml" />
</fileset>
<report todir="${build}/test/html" />
</junitreport>
<cobertura-report destdir="${build}/coverage/xml" datafile="${coverage.file}" format="xml">
<fileset dir="${src}"/>
<classpath refid="project.classpath" />
</cobertura-report>
<cobertura-report datafile="${coverage.file}" destdir="${build}/coverage/html">
<fileset dir="${src}"/>
<classpath refid="project.classpath" />
</cobertura-report>
<fail if="test.fail" message="Tests failed, see reports for details" />
</target>
<target name="jar" depends="compile">
<jar destfile="${build}/${ant.project.name}.jar" basedir="${build.main}"/>
<jar destfile="${build}/${ant.project.name}cli.jar" basedir="${build.main}" includes="**/cli/*.class"/>
</target>
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${lib}/findbugs-ant.jar" />
<target name="findbugs" depends="jar">
<property name="findbugs.path" value="${build}/findbugs" />
<mkdir dir="${findbugs.path}" />
<findbugs home="${findbugs.home}" reportLevel="low" failOnError="true" warningsProperty="findbugs.generated.warnings" output="html" outputFile="${findbugs.path}/index.html">
<auxClasspath refid="project.classpath"/>
<sourcePath path="${src}" />
<class location="${build}/classes/main"/>
</findbugs>
</target>
<target name="javadoc" >
<mkdir dir="${zip}/${ant.project.name}/docs/api"/>
<javadoc destdir="${zip}/${ant.project.name}/docs/api" windowtitle="TestRR API">
<fileset dir="${basedir}/src/java">
<include name="com/ragstorooks/testrr/*.java"/>
</fileset>
<classpath>
<fileset dir="${basedir}/lib">
<include name="**/*.jar" />
</fileset>
<pathelement location="${basedir}/src/java"/>
</classpath>
</javadoc>
</target>
<target name="stampLabel" unless="label" >
<tstamp>
<format property="timestamp" pattern="yyyyMMddhhmmss"/>
</tstamp>
<property name="label" value="${ant.project.name}-${timestamp}" />
</target>
<target name="dist" depends="jar, copy, stampLabel">
<mkdir dir="dist"/>
<zip destfile="dist/${label}.zip" basedir="zip"/>
</target>
</project>