-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
executable file
·485 lines (430 loc) · 18.1 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
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
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
<project basedir="." default="default" name="vimp" xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
<!-- -->
<property file="buildfiles/build.properties" />
<property environment="env"/>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: default # -->
<!-- ############################################################# -->
<!-- -->
<target name="default" description="verifica se eseguire il build per un solo environment specificato a linea di commando con -Dtarget=${target} o per tutti gli environment ">
<condition property="first-call" value="distribution">
<not>
<equals arg1="${target}" arg2="$${target}" />
</not>
</condition>
<!-- -->
<condition property="first-call" value="all-target">
<equals arg1="${target}" arg2="$${target}" />
</condition>
<!-- -->
<echo message="target: ${target}" />
<echo message="first-call: ${first-call}" />
<!-- -->
<antcall target="${first-call}" />
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: all-target # -->
<!-- ############################################################# -->
<!-- -->
<target name="all-target" description="Lancia il build per le varie distribuzioni in sequenza">
<antcall target="distribution">
<param name="target" value="dev" />
</antcall>
<antcall target="distribution">
<param name="target" value="tst" />
</antcall>
<antcall target="distribution">
<param name="target" value="coll" />
</antcall>
<antcall target="distribution">
<param name="target" value="prod" />
</antcall>
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # target: init # -->
<!-- ############################################################# -->
<!-- -->
<target name="init" description="Inizializza lo script Ant">
<tstamp>
<format property="ANNO-COPYRIGHT" pattern="yyyy" />
</tstamp>
<!-- -->
<property environment="env" />
<condition property="target" value="dev">
<equals arg1="${target}" arg2="$${target}" />
</condition>
<!-- -->
<echo message=" target: ${target}" />
<!-- -->
<loadproperties srcFile="buildfiles/${target}.properties" />
<loadproperties srcFile="buildfiles/build.properties" />
<!-- -->
<property name="dist-target" value="${dist}/${target}" />
<property name="archives-target" value="${archives}/${target}" />
<property name="temp-target" value="${temp}/${target}" />
<property name="conf-target" value="${temp-target}/conf" />
<!-- -->
<property name="classes" value="build/classes" />
<!-- -->
<!-- -->
<property name="manifest-dir" value="${temp-target}/manifests" />
<!-- -->
<property name="ear-manifest-dir" value="${manifest-dir}/ear" />
<property name="web-manifest-dir" value="${manifest-dir}/web" />
<path id="class.path">
<!--<fileset dir="${lib}" includesfile="${buildfiles}/classpath-libs.txt" />-->
<fileset dir="${build.lib}" />
</path>
<tstamp>
<format property="current.date" pattern="dd/MM/yyyy HH:mm:ss" locale="it"/>
</tstamp>
<echo message="current.date ${current.date}" />
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # target: _create-tree-structure # -->
<!-- ############################################################# -->
<!-- -->
<target name="_create-tree-structure" description="crea la struttura di cartelle necessarie al build" depends="init">
<mkdir dir="${dist-target}" />
<mkdir dir="${temp-target}" />
<mkdir dir="${classes}" />
<mkdir dir="${archives-target}" />
<mkdir dir="${lib}" />
<!--
<mkdir dir="${build}" />
<mkdir dir="${build-lib}" />
<mkdir dir="${cache}" />
<mkdir dir="${temp-target}/${libdir}" />
<mkdir dir="${conf-target}" />
-->
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # target: _check-source-uptodate # -->
<!-- ############################################################# -->
<!-- -->
<target name="_check-source-uptodate" description="verifica se sono stati modificati sorgenti">
<uptodate property="source.uptodate" targetfile="${temp-target}/src-timestamp-file.txt">
<srcfiles dir="${src-java}">
<include name="**/*.java" />
</srcfiles>
</uptodate>
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: compile-all # -->
<!-- ############################################################# -->
<!-- -->
<!--target name="compile-all" description="Compila tutti i sorgenti." depends="init, load-dependencies, _create-tree-structure, _check-source-uptodate" unless="source.uptodate"-->
<target name="compile-all" description="Compila tutti i sorgenti." depends="init, _create-tree-structure">
<touch file="${temp-target}/src-timestamp-file.txt" />
<!-- -->
<echo message="JAVA_HOME: ${env.JAVA_HOME}"/>
<delete verbose="true" failonerror="no">
<fileset dir="${classes}/spring" includes="*.properties"/>
</delete>
<javac debug="${flag-debug}" debuglevel="lines,vars,source" fork="true"
optimize="${flag-optimize}" destdir="${classes}" listfiles="yes"
verbose="true" srcdir="${src-java}" encoding="Cp1252" source="1.6" target="1.6">
<classpath>
<fileset dir="${build.lib}">
<include name="**/*.jar"/>
</fileset>
<pathelement path="src/main/resources" />
</classpath>
<compilerarg line="-processor org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor"/>
<compilerarg line="-AormXml=jpaorm/orm-OperationExecution.xml"/>
<compilerarg line="-AaddGeneratedAnnotation=true"/>
<compilerarg line="-AfullyAnnotationConfigured=false"/>
<compilerarg line="-Adebug=true"/>
<include name="it/csi/stackjee6sel/archtest/model/*"/>
<!-- <compilerarg value="-proc:only"/>
fork="yes" executable="${env.JAVA_HOME}/bin/javac" encoding="Cp1252" source="1.6" target="1.6">
-->
</javac>
<javac classpathref="class.path" debug="${flag-debug}" debuglevel="lines,vars,source"
optimize="${flag-optimize}" destdir="${classes}" listfiles="no"
fork="yes" executable="${env.JAVA_HOME}/bin/javac" encoding="Cp1252" source="1.6" target="1.6">
<src path="${src-java}" />
<classpath>
<!-- <fileset dir="target/lib"> -->
<!-- <include name="**/*.jar"/> -->
<!-- </fileset> -->
<pathelement path="${classes}" />
</classpath>
</javac>
<!-- -->
<copy todir="${classes}">
<fileset dir="${resources}"/>
</copy>
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: javadoc # -->
<!-- ############################################################# -->
<!-- -->
<target name="javadoc" description="genera la javadoc" depends="init">
<delete includeemptydirs="true" failonerror="false" quiet="true">
<fileset dir="${apidocs}">
<exclude name=".svn/**/*" />
<include name="**" />
</fileset>
</delete>
<!-- -->
<mkdir dir="${apidocs}" />
<!-- -->
<property name="JAVADOC-TITLE" value="${product-name}-${product-version}" />
<!-- -->
<javadoc destdir="${apidocs}" author="true" version="true" use="true" Splitindex="true" windowtitle="${JAVADOC-TITLE}">
<packageset dir="${src-java}">
<include name="it/csi/**/**" />
</packageset>
<classpath>
<pathelement path="${weblogic-classpath}" />
<fileset dir="${build.lib}" includes="**/*.*" />
</classpath>
<header>
<![CDATA[<h1>${JAVADOC-TITLE}</h1>]]></header>
<bottom>
<![CDATA[<i>Copyright © ${ANNO-COPYRIGHT} ${company-name}. All Rights Reserved.</i>]]></bottom>
</javadoc>
<!-- -->
<zip destfile="${docs}/${product-name}-${product-version}-api-javadoc.zip" compress="true">
<zipfileset dir="${docs}" includes="api/**/**" />
</zip>
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # target: _create-manifests # -->
<!-- ############################################################# -->
<!-- -->
<target name="_create-manifests" description="crea la lista nominativa dei JAR per la creazione dei manifest. La liste viene memorizzata dentro la property[classpath-manifest]" depends="init, compile-all">
<delete dir="${manifest-dir}" />
<!-- -->
<mkdir dir="${ear-manifest-dir}" />
<mkdir dir="${web-manifest-dir}" />
<copy file="${src-web}/META-INF/MANIFEST.MF" todir="${web-manifest-dir}" />
<!-- -->
<!-- ####################### -->
<!-- # PRODUZIONE MANIFEST # -->
<!-- ####################### -->
<manifest file="${ear-manifest-dir}/MANIFEST.MF" mode="update">
<section name="${company-name}">
<attribute name="Nome-Prodotto" value="${product-name}" />
<attribute name="Nome-Componente" value="${component-name}" />
<attribute name="Versione" value="${product-version}" />
<attribute name="Ambiente" value="${nome.ambiente}" />
</section>
</manifest>
<!-- -->
<manifest file="${web-manifest-dir}/MANIFEST.MF" mode="update">
<section name="${company-name}">
<attribute name="Nome-Prodotto" value="${product-name}" />
<attribute name="Nome-Componente" value="${component-name}" />
<attribute name="Versione" value="${product-version}" />
<attribute name="Modulo" value="${web-module-name}" />
<attribute name="Ambiente" value="${nome.ambiente}" />
</section>
</manifest>
<!-- -->
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: replace-placeholders # -->
<!-- ############################################################# -->
<!-- -->
<target name="replace-placeholders" description="Replace configuration placeholders">
<mkdir dir="${conf-target}"/>
<delete verbose="true" failonerror="no">
<fileset dir="${conf-target}" includes="**"/>
</delete>
<copy todir="${conf-target}">
<filterchain>
<expandproperties/>
</filterchain>
<fileset dir="${conf}" />
</copy>
<replace file="${classes}/spring/ambiente.properties" token="@@@VERSIONE@@@" value="${product-version}"/>
<replace file="${classes}/spring/ambiente.properties" token="@@@BUILD_DATE@@@" value="${current.date}"/>
</target>
<target name="package-war" description="costruisce il war della web app" depends="compile-all, _create-manifests, replace-placeholders">
<delete dir="${archives-target}/${web-module-name}.war" failonerror="false" />
<copy todir="${classes}/spring" file="${buildfiles}/${target}.properties"></copy>
<war basedir="${src-web}"
destfile="${archives-target}/${web-module-name}.war"
webxml="${src-web}/WEB-INF/web.xml"
manifest="${web-manifest-dir}/MANIFEST.MF"
compress="${flag-compress}" >
<classes dir="${classes}" />
<exclude name="vimp/**"/>
<lib dir="lib"/>
</war>
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: package-ear # -->
<!-- ############################################################# -->
<!-- -->
<target name="package-ear" description="costruisce l'ear" depends="init, compile-all, _create-manifests, package-war">
<delete file="${archives-target}/${ui-name-intranet}.ear"/>
<ear compress="${flag-compress}" destfile="${archives-target}/${ui-name-intranet}.ear"
appxml="${conf-target}/ear/META-INF/application.xml" manifest="${ear-manifest-dir}/MANIFEST.MF">
<fileset dir="${conf-target}/ear"/>
<fileset dir="${archives-target}">
<include name="${web-module-name}.war" />
</fileset>
</ear>
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: package-all # -->
<!-- ############################################################# -->
<!-- -->
<target name="package-all" depends="init" description="esegue il packaging di ogni componente del prodotto">
<antcall target="package-ear" />
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: distribution # -->
<!-- ############################################################# -->
<!-- -->
<target name="distribution" description="Costruisce il tar per la distribuzione." depends="package-all">
<delete failonerror="no" verbose="true">
<fileset dir="${dist-target}" includes="**" />
</delete>
<tar tarfile="${dist-target}/${tar-outfilename-intranet}" longfile="warn">
<tarfileset dir="${archives-target}">
<include name="${ui-name-intranet}.ear" />
</tarfileset>
<tarfileset dir="${conf-target}/tar">
<include name="*.xml"/>
</tarfileset>
</tar>
<tar tarfile="${dist-target}/${tar-outfilename-internet}" longfile="warn">
<tarfileset dir="${archives-target}">
<include name="${ui-name-internet}.ear" />
</tarfileset>
<tarfileset dir="${conf-target}/tar">
<include name="*.xml"/>
</tarfileset>
</tar>
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: clean-dist # -->
<!-- ############################################################# -->
<!-- -->
<target name="clean-dist" description="Rimuove la cartella delle distribuzioni.">
<delete dir="${dist}" />
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: clean-classes # -->
<!-- ############################################################# -->
<!-- -->
<target name="clean-classes" description="Rimuove la cartella dei sorgenti compilati.">
<delete dir="${build}/classes" />
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # target: _clean-lib # -->
<!-- ############################################################# -->
<!-- -->
<target name="clean-lib" description="cancella librerie e cache">
<delete dir="${cache}" />
<delete dir="${build.lib}" />
<delete dir="${lib}" />
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: clean-archives # -->
<!-- ############################################################# -->
<!-- -->
<target name="clean-archives" description="Rimuove la cartella degli archivi (war, ear, ...).">
<delete dir="${build}/archives" />
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: clean-temp # -->
<!-- ############################################################# -->
<!-- -->
<target name="clean-temp" description="Rimuove la cartella dei files temporanei di build.">
<delete dir="${temp}" />
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: clean-all # -->
<!-- ############################################################# -->
<!-- -->
<target name="clean-all" description="Rimuove tutte le cartelle temporanee." depends="clean-lib, clean-dist, clean-archives, clean-classes, clean-temp" />
<!-- -->
<!-- ############################################################# -->
<!-- # public target: show-vars # -->
<!-- ############################################################# -->
<!-- -->
<target name="show-vars" depends="init" description="Visualizza tutte le variabili impostate nei file di properties e/o da linea di comando">
<echo message="*****************************************" />
<echo message="******** ${product-name} environment *******" />
<echo message="*****************************************" />
<echo message="Runtime :" />
<echo message="JAVA_HOME = ${env.JAVA_HOME}" />
<echo message="JAVA_HOME_CLIENT = ${env.JAVA_HOME_CLIENT}" />
<echo message="JAVA_HOME_SERVER = ${env.JAVA_HOME_SERVER}" />
<echo message="ANT_HOME = ${env.ANT_HOME}" />
<echo message="IVY_VERSION = ${env.IVY_VERSION}" />
<echo message="" />
<echo message="Classpath :" />
<echo message="CLASS_PATH = ${classpath}" />
<echo message="" />
<echo message="" />
<echo message="Application :" />
<echo message="VERSION = ${product-version}" />
<echo message="" />
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: about # -->
<!-- ############################################################# -->
<!-- -->
<target name="about" description="Visualizza l'elenco dei target pubblici dello script.">
<loadproperties srcFile="buildfiles/build.properties" />
<loadfile property="about" srcFile="buildfiles/about.txt" />
<echo message=" ${about}" />
</target>
<!-- -->
<!-- ############################################################# -->
<!-- # public target: about-custom # -->
<!-- ############################################################# -->
<!-- -->
<target name="about-custom" description="Visualizza l'elenco di tutti i target, pubblici e privati (equivalente a 'ant -projecthelp')">
<loadproperties srcfile="buildfiles/build.properties" />
<loadfile property="about-custom" srcfile="buildfiles/about-custom.txt" />
<echo message="${about-custom}" />
<java classname="org.apache.tools.ant.Main">
<arg value="-projecthelp" />
</java>
</target>
<target name="package-batch" description="costruisce il pacchetto batch" depends="compile-all, _create-manifests, replace-placeholders">
<delete dir="${archives-target}/batch" failonerror="false" />
<jar destfile="${archives-target}/batch/${web-module-name}.jar" >
<fileset dir="${classes}"/>
<fileset dir="src/config_batch" excludes="*.sh *.bat"/>
<manifest>
<attribute name="Main-Class" value="it.interlogic.vimp.batch.BatchMain"/>
</manifest>
</jar>
<copy toDir="${archives-target}/batch">
<fileset dir="${lib}" />
</copy>
<copy toDir="${archives-target}/batch">
<fileset dir="src/config_batch" includes="*.sh *.bat"/>
</copy>
<copy toDir="${archives-target}/batch">
<fileset dir="jboss_module/com/microsoft/main" includes="*.jar"/>
</copy>
</target>
</project>