-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
255 lines (222 loc) · 9.79 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<project name="kcae" default="build">
<!-- Where the main source code lives -->
<property name="src.dir" location="src" />
<!-- Where the unit test code lives -->
<property name="test.dir" location="test" />
<!-- Top level directory where build artifacts go -->
<property name="build.dir" location="build" />
<!-- Where main class files go -->
<property name="class.dir" location="${build.dir}/classes" />
<!-- Where coverage instrumented class files go -->
<property name="instclass.dir" location="${build.dir}/instclasses" />
<property name="cobertura.file" location="${build.dir}/cobertura.ser" />
<!-- Where unit test class files go -->
<property name="testclass.dir" location="${build.dir}/testclasses" />
<!-- Where documentation goes -->
<property name="doc.dir" location="${build.dir}/docs" />
<property name="javadoc.dir" location="${doc.dir}/javadoc" />
<property name="report.dir" location="${doc.dir}/reports" />
<property name="coverage.dir" location="${report.dir}/coverage" />
<property name="findbugs.html" location="${report.dir}/findbugs.html" />
<!-- Where external dependencies live -->
<property name="ext.dir" location="ext" />
<!-- The URL for downloading external dependencies -->
<property name="ext.url" value="http://www.kanga.org/kcae/ext" />
<!-- FindBugs has a lot of weird dependencies; we don't pull it all in
willy nilly. -->
<property name="findbugs.dir" location="findbugs-2.0.1-rc2" />
<property name="findbugs.jar" location="${findbugs.dir}/lib/findbugs.jar" />
<!-- Where distribution files go -->
<property name="dist.dir" location="dist" />
<!-- The JAR file containing the main classes -->
<property name="jar.file" location="${dist.dir}/kcae.jar" />
<include file="ckget.xml" />
<!-- All Java source code files -->
<path id="src.path" cache="true">
<fileset dir="${src.dir}" includes="**/*.java" />
</path>
<!-- Main class files -->
<path id="main.class.path" cache="false">
<fileset dir="${class.dir}" includes="**/*.class" />
</path>
<!-- Instrumented class files -->
<path id="inst.class.path" cache="false">
<fileset dir="${instclass.dir}" includes="**/*.class" />
</path>
<!-- Test class files -->
<path id="test.classes" cache="false">
<fileset dir="${testclass.dir}" includes="**/*.class"
excludes="**/*$*.class"/>
</path>
<!-- External dependencies classpath -->
<path id="ext.class.path" cache="false">
<fileset dir="${ext.dir}" includes="**/*.jar" />
</path>
<!-- Findbugs classpath -->
<path id="findbugs.class.path" cache="false">
<fileset dir="${findbugs.dir}/lib" includes="**/*.jar" />
</path>
<!-- Load any ant tasks defined by the external dependencies -->
<taskdef classpathref="ext.class.path" resource="tasks.properties" />
<target name="build" depends="jar,coverage" />
<target name="dist" depends="jar" />
<target name="fast" depends="fast-jar" />
<target name="jar" depends="fast-jar" />
<target name="fast-jar" depends="compile">
<jar destfile="${jar.file}" basedir="${class.dir}"
includes="**/*.class,**/*.properties,**/*.fnt,**/*.png,**/*.shx" />
</target>
<target name="coverage" depends="test,coverage-report">
</target>
<target name="coverage-report">
<cobertura-report format="html" datafile="${cobertura.file}"
destdir="${coverage.dir}" srcdir="${src.dir}" />
</target>
<target name="findbugs" depends="jar">
<java jar="${findbugs.jar}" fork="true" maxmemory="1024M">
<classpath>
<path refid="findbugs.class.path" />
</classpath>
<arg value="-textui" />
<arg value="-sourcepath" /><arg value="${src.dir}" />
<arg value="-auxclasspath" /><arg pathref="ext.class.path" />
<arg value="-low" />
<arg value="-html" />
<arg value="-output" /><arg file="${findbugs.html}" />
<arg file="${jar.file}" />
</java>
</target>
<target name="test" depends="compile,instrument,test-compile">
<junit fork="on" forkmode="once" haltonfailure="false"
failureproperty="testfailed" includeantruntime="false"
showoutput="true">
<classpath>
<pathelement path="${instclass.dir}" />
<pathelement path="${testclass.dir}" />
<path refid="ext.class.path" />
<pathelement path="${ant.library.dir}/ant-junit.jar" />
<pathelement path="${ant.library.dir}/ant-junit4.jar" />
<pathelement path="${ant.library.dir}/ant.jar" />
</classpath>
<jvmarg value="-Dfile.encoding=UTF8" />
<jvmarg value="-Dnet.sourceforge.cobertura.datafile=${cobertura.file}" />
<jvmarg value="-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog" />
<jvmarg value="-Dorg.apache.commons.logging.simplelog.defaultlog=debug" />
<jvmarg value="-ea" />
<batchtest>
<path refid="test.classes" />
</batchtest>
<formatter type="plain" usefile="false" />
</junit>
<fail if="testfailed" message="One or more JUnit tests failed"/>
</target>
<target name="test-compile" depends="compile,instrument">
<javac srcdir="${test.dir}" destdir="${testclass.dir}" fork="true"
includes="**/*.java" debug="true" target="1.6" source="1.6"
includeantruntime="false" encoding="UTF-8">
<classpath>
<path refid="ext.class.path" />
<pathelement path="${instclass.dir}" />
</classpath>
</javac>
</target>
<target name="instrument" depends="compile">
<delete file="${cobertura.file}" />
<cobertura-instrument datafile="${cobertura.file}"
todir="${instclass.dir}">
<includeClasses regex=".*" />
<instrumentationClasspath>
<path refid="main.class.path" />
</instrumentationClasspath>
</cobertura-instrument>
<!-- Copy over any interface classes (Cobertura doesn't instrument them or
copy them over). -->
<copy todir="${instclass.dir}" overwrite="false">
<path refid="main.class.path" />
</copy>
<!-- Copy over any property files -->
<copy todir="${instclass.dir}" force="true" includeEmptyDirs="false">
<fileset dir="${src.dir}">
<include name="**/*.properties" />
<include name="**/*.fnt" />
<include name="**/*.shx" />
</fileset>
</copy>
</target>
<target name="compile" depends="init">
<javac srcdir="${src.dir}" destdir="${class.dir}" fork="true"
includes="**/*.java" debug="true" target="1.6" source="1.6"
includeantruntime="false" encoding="UTF-8">
<classpath>
<fileset dir="${ext.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
<copy todir="${class.dir}" force="true" includeEmptyDirs="false">
<fileset dir="${src.dir}">
<include name="**/*.properties" />
</fileset>
</copy>
<copy todir="${class.dir}" force="true"
includeEmptyDirs="false">
<fileset dir="${src.dir}">
<include name="**/*.fnt" />
<include name="**/*.png" />
<include name="**/*.shx" />
</fileset>
</copy>
</target>
<target name="javadoc" depends="init">
<javadoc destdir="${javadoc.dir}" sourcepath="${src.dir}" version="true"
failonerror="true" source="1.6" classpathref="ext.class.path">
<link href="http://docs.oracle.com/javase/6/docs/api/" offline="true"
packagelistLoc="misc/docs.oracle.com" />
</javadoc>
</target>
<target name="init">
<mkdir dir="${build.dir}" />
<mkdir dir="${class.dir}" />
<mkdir dir="${class.dir}/kanga/kcae/res" />
<mkdir dir="${instclass.dir}" />
<mkdir dir="${testclass.dir}" />
<mkdir dir="${doc.dir}" />
<mkdir dir="${javadoc.dir}" />
<mkdir dir="${report.dir}" />
<mkdir dir="${coverage.dir}" />
<mkdir dir="${ext.dir}" />
<mkdir dir="${dist.dir}" />
<ckget dir="${ext.dir}" url="${ext.url}/asm-3.0.jar"
checksum="e1f92f5aeae04b8e1ebdc5d46c5225f0" />
<ckget dir="${ext.dir}" url="${ext.url}/asm-tree-3.0.jar"
checksum="f1e52edb3419a56f42949aecd27720cd" />
<ckget dir="${ext.dir}" url="${ext.url}/cobertura-1.9.4.1.jar"
checksum="312cc39a5dbedccc17c3a3855732044e" />
<ckget dir="${ext.dir}" url="${ext.url}/commons-io-2.3.jar"
checksum="132db2975a086024994c920769b900db" />
<ckget dir="${ext.dir}" url="${ext.url}/commons-lang3-3.1.jar"
checksum="71b48e6b3e1b1dc73fe705604b9c7584" />
<ckget dir="${ext.dir}" url="${ext.url}/commons-logging-1.1.1.jar"
checksum="e2c390fe739b2550a218262b28f290ce" />
<ckget dir="${ext.dir}" url="${ext.url}/commons-logging-adapters-1.1.1.jar"
checksum="d955f7cdb65df53936654db488084ea1" />
<ckget dir="${ext.dir}" url="${ext.url}/commons-logging-api-1.1.1.jar"
checksum="4ec8e1d8171e578b3151e898311a8710" />
<ckget dir="${ext.dir}" url="${ext.url}/findbugs-annotations-2.0.1-rc2.jar"
checksum="eb4867fa212ea876b9bc1127ed42a17b" />
<ckget dir="${ext.dir}" url="${ext.url}/guava-13.0.1.jar"
checksum="539a72e3c7b7bd1b12b9cf7a567fb28a" />
<ckget dir="${ext.dir}" url="${ext.url}/jackson-core-asl-1.9.7.jar"
checksum="0839b0bf5845e1385f17f234ea8e847f" />
<ckget dir="${ext.dir}" url="${ext.url}/jackson-mapper-asl-1.9.7.jar"
checksum="bd9b018b997742b57063578f6402c52a" />
<ckget dir="${ext.dir}" url="${ext.url}/jakarta-oro-2.0.8.jar"
checksum="42e940d5d2d822f4dc04c65053e630ab" />
<ckget dir="${ext.dir}" url="${ext.url}/jsr305.jar"
checksum="144c0767e2aaf0c21a935908d0e52c68" />
<ckget dir="${ext.dir}" url="${ext.url}/junit-4.10.jar"
checksum="972c3b8fb2cc26008cbceb01ff889ec4" />
<ckget dir="${ext.dir}" url="${ext.url}/log4j-1.2.9.jar"
checksum="6a44d84b72897f28189f4792e2015b93" />
</target>
</project>