-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.xml
279 lines (236 loc) · 10.3 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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="fbapi4j" default="default">
<property name="version" value="0.5" />
<property name="src.dir" location="${basedir}/src" />
<property name="test.src.dir" location="${basedir}/test" />
<property name="demo.src.dir" location="${basedir}/demo" />
<property name="lib.dir" location="${basedir}/lib" />
<property name="build.dir" location="${basedir}/bin" />
<property name="classes.dir" location="${build.dir}/classes" />
<property name="test.classes.dir" location="${build.dir}/test-classes" />
<property name="demo.classes.dir" location="${build.dir}/demo-classes" />
<property name="reports.dir" location="${build.dir}/reports" />
<property name="test.reports.dir" location="${reports.dir}/tests" />
<property name="dist.dir" location="${basedir}/dist" />
<ivy:settings file="ivysettings.xml" />
<ivy:cachepath pathid="classpath-ivy-compile" conf="compile" log="quiet" />
<ivy:cachepath pathid="classpath-ivy-runtime" conf="runtime" log="quiet" />
<ivy:cachepath pathid="classpath-ivy-test" conf="test" log="quiet" />
<path id="classpath-runtime">
<pathelement path="${classes.dir}" />
<path refid="classpath-ivy-runtime" />
</path>
<path id="classpath-compile">
<path refid="classpath-runtime" />
<path refid="classpath-ivy-compile" />
</path>
<path id="classpath-test">
<pathelement path="${test.classes.dir}" />
<path refid="classpath-compile" />
<path refid="classpath-ivy-test" />
</path>
<path id="classpath-demo">
<pathelement path="${demo.classes.dir}" />
<path refid="classpath-runtime" />
</path>
<!-- =================================
target: default
================================= -->
<target name="default" depends="clean, init, build, test, dist" description="A complete build, minus the tests." />
<!-- =================================
target: init
================================= -->
<target name="init" depends="init-src, init-test, init-demo, init-report" description="Build the empty directories for building the project" />
<!-- - - - - - - - - - - - - - - - - -
target: init-src
- - - - - - - - - - - - - - - - - -->
<target name="init-src" description="Build the empty directories for compiling the source of the project">
<mkdir dir="${src.dir}" />
<mkdir dir="${classes.dir}" />
<mkdir dir="${lib.dir}" />
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<!-- - - - - - - - - - - - - - - - - -
target: init-test
- - - - - - - - - - - - - - - - - -->
<target name="init-test" description="Build the empty directories for testing the project">
<mkdir dir="${test.src.dir}" />
<mkdir dir="${test.classes.dir}" />
</target>
<!-- - - - - - - - - - - - - - - - - -
target: init-demo
- - - - - - - - - - - - - - - - - -->
<target name="init-demo" description="Build the empty directories for executing the demos">
<mkdir dir="${demo.src.dir}" />
<mkdir dir="${demo.classes.dir}" />
</target>
<!-- - - - - - - - - - - - - - - - - -
target: init-report
- - - - - - - - - - - - - - - - - -->
<target name="init-report" description="Build the empty directories for reporting on the project">
<mkdir dir="${reports.dir}" />
<mkdir dir="${test.reports.dir}" />
</target>
<!-- =================================
target: build
================================= -->
<target name="build" depends="init, compile, copy-resources" description="Compile source and tests, copy raw data from source folders to build folders" />
<!-- - - - - - - - - - - - - - - - - -
target: compile
- - - - - - - - - - - - - - - - - -->
<target name="compile" depends="fetch-dependencies, compile-src, compile-test, compile-demo" description="Compile the java and test source" />
<!-- - - - - - - - - - - - - - - - - -
target: fetch-dependencies
- - - - - - - - - - - - - - - - - -->
<target name="fetch-dependencies">
<ivy:retrieve pattern="${lib.dir}/[artifact]-[revision].[ext]" type="jar" conf="compile" />
<ivy:retrieve pattern="${lib.dir}/[artifact]-[revision].[ext]" type="jar, bundle" conf="runtime" />
<ivy:retrieve pattern="${lib.dir}/[artifact]-[revision].[ext]" type="jar" conf="test" />
</target>
<!-- - - - - - - - - - - - - - - - - -
target: compile-src
- - - - - - - - - - - - - - - - - -->
<target name="compile-src" depends="init" description="Compile the java source">
<javac destdir="${classes.dir}" target="1.5" debug="true">
<src path="${src.dir}" />
<classpath refid="classpath-compile" />
</javac>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: compile-test
- - - - - - - - - - - - - - - - - -->
<target name="compile-test" depends="compile-src" description="Compile the test source">
<javac destdir="${test.classes.dir}" target="1.5" debug="true">
<src path="${test.src.dir}" />
<classpath refid="classpath-test" />
</javac>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: compile-demo
- - - - - - - - - - - - - - - - - -->
<target name="compile-demo" depends="compile-src" description="Compile the demo source">
<javac destdir="${demo.classes.dir}" target="1.5" debug="true">
<src path="${demo.src.dir}" />
<classpath refid="classpath-demo" />
</javac>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: copy-resources
- - - - - - - - - - - - - - - - - -->
<target name="copy-resources" depends="copy-resources-src, copy-resources-test, copy-resources-demo" description="Copy resources from the source to the build folders" />
<!-- - - - - - - - - - - - - - - - - -
target: copy-resources-src
- - - - - - - - - - - - - - - - - -->
<target name="copy-resources-src" depends="compile-src" description="Copy source resources">
<copy todir="${classes.dir}">
<fileset dir="${src.dir}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: copy-resources-test
- - - - - - - - - - - - - - - - - -->
<target name="copy-resources-test" depends="compile-test" description="Copy test resources">
<copy todir="${test.classes.dir}">
<fileset dir="${test.src.dir}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: copy-resources-demo
- - - - - - - - - - - - - - - - - -->
<target name="copy-resources-demo" depends="compile-demo" description="Copy demo resources">
<copy todir="${demo.classes.dir}">
<fileset dir="${demo.src.dir}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<!-- =================================
target: test
================================= -->
<target name="test" depends="build, junit" description="Run all automated tests" />
<!-- - - - - - - - - - - - - - - - - -
target: junit
- - - - - - - - - - - - - - - - - -->
<target name="junit" depends="build" description="Run the junit automated tests">
<junit fork="true">
<classpath refid="classpath-test" />
<formatter type="brief" usefile="false" />
<formatter type="xml" />
<batchtest fork="yes" todir="${test.reports.dir}">
<fileset dir="${test.src.dir}">
<include name="**/*Test*.java" />
<exclude name="**/*Suite.java" />
</fileset>
</batchtest>
</junit>
<delete dir="${instrumented.classes.dir}" />
</target>
<!-- =================================
target: demo
================================= -->
<target name="demo" depends="build, run-demos" description="Run all the demo code" />
<!-- =================================
target: run-demos
================================= -->
<target name="run-demos" depends="build">
<java >
</java>
</target>
<!-- =================================
target: report
================================= -->
<target name="report" depends="test" description="Run the source code reports" />
<!-- =================================
target: dist
================================= -->
<target name="dist" depends="compile, dist-jar" description="Build the final distributable" />
<!-- - - - - - - - - - - - - - - - - -
target: dist-jar
- - - - - - - - - - - - - - - - - -->
<target name="dist-jar" depends="build" description="Build a distributable jar file">
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="lib/jarjar-1.0.jar" />
<jarjar jarfile="${dist.dir}/${ant.project.name}-${version}.jar">
<fileset dir="${classes.dir}" />
<zipfileset src="${lib.dir}/mime-util-2.1.jar" />
<zipfileset src="${lib.dir}/slf4j-api-1.5.10.jar" />
<zipfileset src="${lib.dir}/slf4j-nop-1.5.10.jar" />
<rule pattern="org.slf4j.**" result="com.fieldexpert.fbapi4j.slf4j.@1" />
<rule pattern="eu.medsea.**" result="com.fieldexpert.fbapi4j.@1" />
</jarjar>
<jar jarfile="${dist.dir}/${ant.project.name}-nodep-${version}.jar">
<fileset dir="${classes.dir}" />
</jar>
</target>
<!-- =================================
target: clean
================================= -->
<target name="clean" depends="clean-build, clean-lib, clean-dist" description="Clean up all build-generated artefacts" />
<!-- - - - - - - - - - - - - - - - - -
target: clean-build
- - - - - - - - - - - - - - - - - -->
<target name="clean-build" description="Clean up the build directory">
<delete dir="${build.dir}" />
</target>
<!-- - - - - - - - - - - - - - - - - -
target: clean-lib
- - - - - - - - - - - - - - - - - -->
<target name="clean-lib" description="Clean up the lib directory">
<delete dir="${lib.dir}" />
</target>
<!-- - - - - - - - - - - - - - - - - -
target: clean-dist
- - - - - - - - - - - - - - - - - -->
<target name="clean-dist" description="Clean up the dist directory">
<delete dir="${dist.dir}" />
</target>
<!-- - - - - - - - - - - - - - - - - -
target: clean-cache
- - - - - - - - - - - - - - - - - -->
<target name="clean-cache" description="Clean up the ivy cache directory">
<ivy:cleancache />
</target>
</project>