-
Notifications
You must be signed in to change notification settings - Fork 0
/
swing-template-build.xml
410 lines (366 loc) · 16.7 KB
/
swing-template-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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
<?xml version="1.0" encoding="UTF-8"?>
<project name="swing-template-build">
<!-- ***************************************************
Inizializzazione delle proprieta'
*************************************************** -->
<property file="./dependent.properties" />
<target name="-init-folders" depends="">
<!-- Cartelle -->
<property name="src.dir" location="./src" />
<property name="test.src.dir" location="./test" />
<property name="build.dir" location="./build/classes" />
<property name="test.dir" location="./build/test" />
<property name="test.build.dir" location="${test.dir}/classes" />
<property name="test.report.dir" location="${test.dir}/report" />
<property name="test.data.dir" location="${test.src.dir}/dati" />
<property name="dist.dir" location="./dist" />
<property name="utilita.src.dir" location="../utilita/src" />
<property name="utilita.build.dir" location="../utilita/build/classes" />
<property name="javadoc.dir" location="./dist/javadoc" />
<property name="utilita.javadoc.dir" location="../utilita/dist/javadoc" />
<property name="misc.dir" location="./varie" />
<property name="resources.dir" location="${misc.dir}/risorse" />
<property name="conf.dir" location="${src.dir}/conf" />
<condition property="test.data.dir.present">
<available file="${test.data.dir}" type="dir" />
</condition>
<condition property="resources.dir.present">
<available file="${resources.dir}" type="dir" />
</condition>
<condition property="conf.dir.present">
<available file="${conf.dir}" type="dir" />
</condition>
</target>
<fileset id="test.jars" dir="${lib.dir}">
<include name="junit.jar" />
<include name="jfcunit.jar" />
<include name="jakarta-regexp.jar" />
<include name="xerces.jar" />
</fileset>
<target name="-init-classpath" depends="-init-folders">
<property name="build.sysclasspath" value="ignore" />
<path id="compile.classpath">
<pathelement location="${build.dir}" />
<fileset dir="${lib.dir}" includes="commons-logging-*.jar" />
</path>
<path id="run.classpath">
<path refid="compile.classpath" />
<fileset dir="${lib.dir}" includes="log4j-*.jar" />
</path>
<fileset id="run.jar.fileset" dir="${lib.dir}">
<include name="commons-logging-*.jar" />
</fileset>
<path id="run.jar.classpath">
<fileset refid="run.jar.fileset" />
</path>
<path id="test.classpath">
<path refid="run.classpath" />
<pathelement location="${test.build.dir}" />
<fileset refid="test.jars" />
</path>
</target>
<target name="-init-release" if="release.build" depends="">
<echo message="Build di release" />
<property name="build.debug" value="off" />
<property name="build.debuglevel" value="lines" />
<property name="build.optimize" value="on" />
</target>
<target name="-init-debug" unless="release.build" depends="">
<echo message="Build di debug" />
<property name="build.debug" value="on" />
<property name="build.debuglevel" value="lines,vars,source" />
<property name="build.optimize" value="off" />
</target>
<target name="init" depends="-init-folders, -init-classpath, -init-release, -init-debug" description="inizializza le proprieta' e i path">
<property name="main.class" value="it.unibas.${ant.project.name}.controllo.Controllo" />
<echo message="${main.class}" />
</target>
<!-- ***************************************************
Clean
*************************************************** -->
<target name="clean" depends="init" description="ripulisce le cartelle riproducibili">
<delete dir="${build.dir}" />
<delete dir="${test.dir}" />
<delete dir="${dist.dir}" />
</target>
<!-- ***************************************************
Preparazione
*************************************************** -->
<target name="-create-misc-dir" depends="init">
<mkdir dir="${misc.dir}" />
</target>
<target name="prepare" depends="-create-misc-dir" description="ricrea le cartelle riproducibili">
<mkdir dir="${build.dir}" />
<mkdir dir="${test.build.dir}" />
<mkdir dir="${test.report.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<target name="-create-resources-dir" depends="init" unless="resources.dir.present">
<mkdir dir="${resources.dir}" />
</target>
<target name="-prepare-resources" depends="prepare,-create-resources-dir">
<copy todir="${build.dir}/risorse">
<fileset dir="${resources.dir}" />
</copy>
<copy todir="${build.dir}">
<fileset dir="${src.dir}" includes="**/*.jfrm" />
</copy>
</target>
<target name="-prepare-conf" depends="prepare" if="conf.dir.present">
<copy todir="${build.dir}">
<fileset dir="${conf.dir}" includes="*.*" />
</copy>
</target>
<target name="-create-test-data-dir" depends="init" unless="test.data.dir.present">
<mkdir dir="${test.data.dir}" />
</target>
<target name="-prepare-test" depends="prepare,-create-test-data-dir">
<copy todir="${test.build.dir}/dati">
<fileset dir="${test.data.dir}" />
</copy>
</target>
<!-- ***************************************************
Compilazione
*************************************************** -->
<target name="compile" depends="prepare, -prepare-resources, -prepare-conf" description="compila il codice">
<javac srcdir="${src.dir}"
destdir="${build.dir}"
classpathref="compile.classpath"
debug="${build.debug}"
debuglevel="${build.debuglevel}"
optimize="${build.optimize}">
<compilerarg value="-Xlint:unchecked" />
</javac>
</target>
<target name="compile-test" depends="compile" description="compila i test">
<javac srcdir="${test.src.dir}"
destdir="${test.build.dir}"
classpathref="test.classpath"
debug="${build.debug}"
debuglevel="${build.debuglevel}">
</javac>
</target>
<!-- ***************************************************
Esecuzione dei test
*************************************************** -->
<target name="test" depends="test-modello, test-persistenza, test-funzionali" description="esegue i test sul modello">
</target>
<target name="test-modello" depends="-prepare-test, compile-test" description="esegue i test sul modello">
<junit haltonfailure="false"
errorProperty="test.failed"
failureProperty="test.failed"
fork="true">
<assertions>
<enable/>
</assertions>
<classpath refid="test.classpath" />
<batchtest todir="${test.report.dir}">
<fileset dir="${test.build.dir}">
<include name="**/modello/Test*.class" />
</fileset>
</batchtest>
<formatter type="plain" usefile="false" />
<formatter type="xml" />
</junit>
<fail if="test.failed">
Esecuzione dell'operazione fallita a causa del fallimento dei test
</fail>
</target>
<target name="test-persistenza" depends="-prepare-test, compile-test" description="esegue i test sulla persistenza">
<junit haltonfailure="false"
errorProperty="test.failed"
failureProperty="test.failed"
fork="true">
<assertions>
<enable/>
</assertions>
<classpath refid="test.classpath" />
<batchtest todir="${test.report.dir}">
<fileset dir="${test.build.dir}">
<include name="**/persistenza/Test*.class" />
</fileset>
</batchtest>
<formatter type="plain" usefile="false" />
<formatter type="xml" />
</junit>
<fail if="test.failed">
Esecuzione dell'operazione fallita a causa del fallimento dei test
</fail>
</target>
<target name="test-funzionali" depends="-prepare-test, compile-test" description="esegue i test funzionali">
<junit haltonfailure="false"
errorProperty="test.failed"
failureProperty="test.failed"
fork="true">
<assertions>
<enable/>
</assertions>
<classpath refid="test.classpath" />
<batchtest todir="${test.report.dir}">
<fileset dir="${test.build.dir}">
<include name="**/funzionali/Test*.class" />
</fileset>
</batchtest>
<formatter type="plain" usefile="false" />
<formatter type="xml" />
</junit>
<fail if="test.failed">
Esecuzione dell'operazione fallita a causa del fallimento dei test
</fail>
</target>
<target name="test-single" depends="-prepare-test, compile-test">
<junit haltonfailure="true">
<classpath refid="test.classpath" />
<test todir="${test.report.dir}" name="${testcase}" if="testcase" />
<formatter type="plain" usefile="false" />
<formatter type="xml" />
</junit>
</target>
<!--
java -Djfcunit.xmlroot.record=true \
-Djfcunit.xmlroot.classname=demo.SwingSet\
-Djfcunit.xmlroot.testsuite=testcases.xml\
-classpath jfcunit.jar;SwingSet.jar;jarkarta-regexp-1.2.jar;junit.jar\
junit.swingui.TestRunner junit.extensions.jfcunit.tools.XMLRoot
-->
<target name="test-record" depends="compile, -prepare-test">
<java classname="junit.textui.TestRunner">
<classpath refid="test.classpath" />
<sysproperty key="jfcunit.xmlroot.record" value="true" />
<sysproperty key="jfcunit.xmlroot.classname" value="${main.class}" />
<sysproperty key="jfcunit.xmlroot.testsuite" value="test/dati/recordtest.xml" />
<arg value="junit.extensions.jfcunit.tools.XMLRoot" />
</java>
</target>
<!--
java -Djfcunit.xmlroot.classname=demo.SwingSet\
-Djfcunit.xmlroot.testsuite=testcases.xml\
-classpath jfcunit.jar;SwingSet.jar;jarkarta-regexp-1.2.jar;junit.jar\
junit.swingui.TestRunner junit.extensions.jfcunit.tools.XMLRoot
-->
<target name="replay-test" depends="compile, -prepare-test">
<java classname="junit.textui.TestRunner">
<classpath refid="test.classpath" />
<sysproperty key="jfcunit.xmlroot.classname" value="${main.class}" />
<sysproperty key="jfcunit.xmlroot.testsuite" value="test/dati/recordtest.xml" />
<arg value="junit.extensions.jfcunit.tools.XMLRoot" />
</java>
</target>
<!-- ***************************************************
Build
*************************************************** -->
<target name="build" depends="compile, test-modello" description="compila ed esegue i test">
</target>
<target name="rebuild" depends="clean, build, test" description="ripulisce e ricostruisce">
</target>
<!-- ***************************************************
Esecuzione dell'applicazione
*************************************************** -->
<target name="run" depends="compile" description="esegue l'applicazione">
<java classname="${main.class}" fork="true">
<classpath refid="run.classpath" />
<assertions>
<enable />
</assertions>
</java>
</target>
<!-- ***************************************************
Distribuzione
*************************************************** -->
<target name="-init-version" depends="init">
<buildnumber file="build.properties" />
<property file="build.properties" />
</target>
<target name="javadoc" depends="compile">
<javadoc destdir="${javadoc.dir}"
sourcepath="${src.dir}"
defaultexcludes="yes"
packagenames="it.unibas.*">
<classpath refid="compile.classpath" />
</javadoc>
</target>
<target name="-create-manifest" depends="init, -init-version">
<pathconvert property="run.jar.classpath.manifest" pathsep="" refid="run.jar.classpath">
<chainedmapper>
<flattenmapper/>
<globmapper from="*" to=" lib/*"/>
</chainedmapper>
</pathconvert>
<manifest file="${dist.dir}/MANIFEST.MF" >
<attribute name="Built-by" value="${user.name}" />
<attribute name="Implementation-Version" value="${major.version}.${minor.version}-build${build.number}" />
<attribute name="Main-Class" value="${main.class}" />
<attribute name="Class-Path" value="${run.jar.classpath.manifest}" />
</manifest>
</target>
<target name="jar" depends="rebuild, -init-version, -create-manifest" description="crea il jar">
<jar destfile="${dist.dir}/${ant.project.name}-${major.version}.${minor.version}-build${build.number}.jar"
manifest="${dist.dir}/MANIFEST.MF">
<fileset dir="${build.dir}">
<include name="**/*.*" />
</fileset>
</jar>
</target>
<target name="-init-build-files" depends="init">
<fileset id="build.file.templates" dir="..">
<include name="swing-template-build.xml" />
</fileset>
</target>
<target name="dist" depends="rebuild, -init-version, jar, javadoc, -init-build-files" description="crea lo zip distribuibile">
<zip zipfile="${dist.dir}/${ant.project.name}-java-${major.version}.${minor.version}-build${build.number}.zip">
<!-- jar -->
<zipfileset dir="${dist.dir}" prefix="${ant.project.name}-java" includes="*.jar" />
<zipfileset dir="${misc.dir}" prefix="${ant.project.name}-java" includes="*.bat" />
<!-- librerie -->
<zipfileset prefix="${ant.project.name}-java/lib" refid="run.jar.fileset" />
<!-- sorgenti -->
<zipfileset dir="${src.dir}" prefix="${ant.project.name}-java/src" />
<!-- test -->
<zipfileset dir="${test.src.dir}" prefix="${ant.project.name}-java/test" />
<!-- javadoc -->
<zipfileset dir="${javadoc.dir}" prefix="${ant.project.name}-java/javadoc" />
<!-- varie -->
<zipfileset dir="${misc.dir}" prefix="${ant.project.name}-java/varie" />
<!-- build -->
<zipfileset dir="." prefix="${ant.project.name}-java" includes="*.*" />
<zipfileset prefix="" refid="build.file.templates" />
</zip>
</target>
<!-- ***************************************************
Target particolari
*************************************************** -->
<target name="all" depends="dist">
</target>
<target name="debug" depends="init">
<echoproperties />
</target>
<target name="default" depends="build">
</target>
<!-- ***************************************************
Target per progetto FreeForm
*************************************************** -->
<target name="generate-freeform-properties" depends="init, prepare">
<pathconvert property="compile.classpath.property" dirsep="/" pathsep=";">
<path refid="compile.classpath"/>
</pathconvert>
<pathconvert property="run.classpath.property" dirsep="/" pathsep=";">
<path refid="run.classpath"/>
</pathconvert>
<pathconvert property="test.classpath.property" dirsep="/" pathsep=";">
<path refid="test.classpath"/>
</pathconvert>
<echo file="nbproject/nbproject.properties">
src.dir = src
build.top.dir = build
build.dir = build/classes
test.src.dir = test
test.build.dir = build/test/classes
dist.dir = dist
javadoc.dir = dist/javadoc
jar.file = dist/${ant.project.name}*.jar
compile.classpath = ${compile.classpath.property}
test.classpath = ${test.classpath.property}
run.classpath = ${run.classpath.property}
</echo>
</target>
</project>