forked from donatellosantoro/Llunatic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lunatic-template-build.xml
executable file
·374 lines (326 loc) · 15.1 KB
/
lunatic-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
<?xml version="1.0" encoding="UTF-8"?>
<project name="lunatic-template">
<!-- ***************************************************
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.report.dir" location="${test.dir}/results" />
<property name="test.data.dir" location="${test.src.dir}/testdata" />
<property name="dist.dir" location="./dist" />
<property name="javadoc.dir" location="./dist/javadoc" />
<property name="misc.dir" location="./misc" />
<property name="resources.dir" location="${misc.dir}/resources" />
<property name="build.resources.dir" location="${build.dir}/resources" />
<property name="conf.dir" location="${src.dir}/conf" />
<property name="test.conf.dir" location="${test.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>
<condition property="test.conf.dir.present">
<available file="${test.conf.dir}" type="dir" />
</condition>
</target>
<target name="-init-classpath" depends="-init-folders">
<property name="build.sysclasspath" value="ignore" />
<path id="compile.classpath">
<pathelement location="${build.dir}" />
</path>
<path id="test.classpath">
<path refid="compile.classpath" />
<pathelement location="${test.build.dir}" />
<pathelement location="${lib.dir}/junit.jar" />
</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="">
<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">
</target>
<!-- ***************************************************
Clean
*************************************************** -->
<target name="clean" depends="init" description="ripulisce le cartelle riproducibili">
<delete dir="${build.dir}" />
<delete dir="${test.dir}" />
</target>
<!-- ***************************************************
Preparazione
*************************************************** -->
<target name="-create-misc-dir" depends="init">
<mkdir dir="${misc.dir}" />
</target>
<target name="-create-test-data-dir" depends="init" unless="test.data.dir.present">
<mkdir dir="${test.data.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.resources.dir}">
<fileset dir="${resources.dir}" />
</copy>
</target>
<target name="-prepare-conf" depends="prepare" if="conf.dir.present">
<copy todir="${build.dir}">
<fileset dir="${conf.dir}" includes="*.*" />
</copy>
<copy todir="${build.dir}">
<fileset dir="${src.dir}" includes="**/*.properties" />
</copy>
</target>
<target name="prepare" depends="-update-dependencies, -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="-prepare-test-conf" depends="prepare" if="test.conf.dir.present">
<copy todir="${test.build.dir}">
<fileset dir="${test.conf.dir}" includes="*.*" />
</copy>
</target>
<target name="-prepare-test" depends="prepare,-create-test-data-dir, -prepare-test-conf">
<copy todir="${test.build.dir}/testdata">
<fileset dir="${test.data.dir}" />
</copy>
</target>
<target name="-update-dependencies">
</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}">
<compilerarg value="-Xlint:unchecked" />
</javac>
</target>
<!-- ***************************************************
Esecuzione dei test
*************************************************** -->
<target name="test" depends="-prepare-test, build" description="esegue i test">
<junit haltonfailure="false"
errorProperty="test.failed"
failureProperty="test.failed"
fork="true"
showoutput="true"
maxmemory="${junit.maxmemory}">
<assertions>
<enable/>
</assertions>
<classpath refid="test.classpath" />
<batchtest todir="${test.report.dir}">
<fileset dir="${test.build.dir}">
<include name="**/Test*.class" />
<exclude name="**/ded/**" />
</fileset>
</batchtest>
<formatter type="brief" 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, build">
<echo>Executing test ${testcase} with max-memory ${junit.maxmemory}</echo>
<junit haltonfailure="true"
fork="true"
showoutput="true"
maxmemory="${junit.maxmemory}">
<assertions>
<enable/>
</assertions>
<classpath refid="test.classpath" />
<jvmarg value="-Djava.util.logging.config.class=it.unibas.lunatic.utility.JavaUtilLoggingConfig"/>
<test todir="${test.report.dir}" name="${testcase}" if="testcase" />
<formatter type="brief" usefile="false" />
<formatter type="xml" />
</junit>
</target>
<!-- ***************************************************
Build
*************************************************** -->
<target name="build" depends="compile, compile-test" description="compila ed esegue i test">
</target>
<target name="rebuild" depends="clean, build" description="ripulisce e ricostruisce">
</target>
<!-- ***************************************************
Build
*************************************************** -->
<target name="run" depends="compile" description="esegue l'applicazione">
<java classname="${main.class}" fork="yes" maxmemory="${run.maxmemory}">
<classpath refid="compile.classpath" />
<jvmarg value="-Djava.util.logging.config.class=it.unibas.lunatic.utility.JavaUtilLoggingConfig"/>
<arg value="${arg0}"/>
<!-- <arg value="${arg1}"/> -->
</java>
</target>
<!-- ***************************************************
Distribuzione
*************************************************** -->
<target name="-clean-dist-dir" depends="init">
<delete dir="${dist.dir}" />
</target>
<target name="javadoc" depends="compile">
<javadoc destdir="${javadoc.dir}"
sourcepath="${src.dir}"
defaultexcludes="yes"
packagenames="*">
<classpath refid="compile.classpath" />
</javadoc>
</target>
<!-- light deploy -->
<target name="-light-init-version" depends="init">
<property file="build.properties" />
</target>
<target name="-check-manifest" depends="init">
<condition property="manifest.present">
<available file="${dist.dir}/MANIFEST.MF" type="file" />
</condition>
</target>
<target name="-light-create-manifest" depends="init, -light-init-version, -check-manifest" unless="manifest.present" >
<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}" />
</manifest>
</target>
<target name="light-jar" depends="-light-init-version, build, -check-manifest, -light-create-manifest" description="crea il jar">
<jar destfile="${dist.dir}/${ant.project.name}-${major.version}.${minor.version}.jar"
manifest="${dist.dir}/MANIFEST.MF">
<fileset dir="${build.dir}">
<include name="**/*.*" />
<exclude name="**/conf/**" />
<exclude name="**/resources/**" />
<exclude name="logback.xml" />
</fileset>
</jar>
</target>
<target name="light-deploy" depends="light-jar" description="copia il jar sul classpath">
<copy todir="${lib.dir}">
<fileset dir="${dist.dir}">
<include name="${ant.project.name}-*.jar" />
</fileset>
</copy>
</target>
<!-- deploy -->
<target name="-init-version" depends="init">
<buildnumber file="build.properties" />
<property file="build.properties" />
</target>
<target name="-create-manifest" depends="init, -init-version">
<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}" />
</manifest>
</target>
<target name="jar" depends="-clean-dist-dir, -init-version, rebuild, -create-manifest" description="crea il jar">
<jar destfile="${dist.dir}/${ant.project.name}-${major.version}.${minor.version}.jar"
manifest="${dist.dir}/MANIFEST.MF">
<fileset dir="${build.dir}">
<include name="**/*.*" />
<exclude name="**/conf/**" />
<exclude name="**/resources/**" />
<exclude name="logback.xml" />
</fileset>
</jar>
</target>
<target name="deploy" depends="jar" description="copia il jar sul classpath">
<copy todir="${lib.dir}">
<fileset dir="${dist.dir}">
<include name="${ant.project.name}-*.jar" />
</fileset>
</copy>
</target>
<target name="dist" depends="-clean-dist-dir, rebuild, -init-version, jar, javadoc" 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" />
<!-- jar -->
<zipfileset refid="compile.jar.fileset" prefix="${ant.project.name}-java/lib" />
<!-- 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="*.*" />
</zip>
</target>
<!-- ***************************************************
Target particolari
*************************************************** -->
<target name="all" depends="deploy">
</target>
<target name="debug" depends="init">
<echoproperties />
</target>
<target name="default" depends="build">
</target>
<!-- ***************************************************
Target per progetto FreeForm
*************************************************** -->
<target name="gfp" depends="generate-freeform-properties"/>
<target name="generate-freeform-properties" depends="init, prepare">
<pathconvert property="compile.classpath.property" dirsep="/" pathsep=";">
<path refid="compile.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
resources.dir = misc/resources
speedy.dir = ${speedy.dir}
experiments.dir = misc/experiments
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 = ${compile.classpath.property}
</echo>
</target>
</project>