builder.xml
13.2 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="help" name="Custom builder">
<!-- Build.xml - versione 2.0.0 -->
<property name="project.name" value="FileProxyServer" />
<tstamp>
<format property="today" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<property environment="env"/>
<target name="help">
<echo message="Help.." />
</target>
<!-- File di configurazione 1 -->
<target name="sub-environment" >
<!-- description="Routine di configurazione variabili d'ambiente" -->
<echo message="Set environment...." />
<property name="project.src" value="${basedir}/src" />
<property name="project.build" value="${basedir}/build/classes" />
<property name="project.lib" value="${basedir}/lib" />
<condition property="project.dist" value="${basedir}/dist/${config.cliente}" else="${basedir}/dist">
<isset property="config.cliente"/>
</condition>
<!--property name="project.conf" value="${basedir}/conf" / -->
<property name="project.conf" value="conf" />
<!-- Nome del progetto a cui sono legati i file di configurazione - FIXME -->
<property name="application.name" value="fproxy" />
<!-- Nome base del file war a cui saranno concatenati versione e release -->
<property name="project.warfile" value="${application.name}" />
<!-- Cartella in cui deve essere copiato il file di versione -->
<property name="version.package" value="it/softecspa/portal" />
</target>
<!-- File di configurazione 2 -->
<target name="sub-configuration" depends="sub-environment" >
<!-- description="Routine di configurazione variabili d'ambiente" -->
<echo message="Load configuration...." />
<property name="project.version.file" value="${project.conf}/version.properties" />
<property file="${project.version.file}" />
<antcallback target="sub-version" return="real.version.number"/>
<!-- Estrazione della versione -->
<echo message="Versione ${real.version.number} ${version.release}" />
<echo message="Build ${build.number}" />
</target>
<!-- Gestisce il numero di versione -->
<target name="sub-version" >
<!-- description="Calcolo versione e progressivo compilazione" -->
<echo message="Update library version file" />
<propertyfile file="${project.version.file}" comment="Versionamento">
<entry key="version.number" default="0.0.1"/>
<entry key="version.release" default="beta"/>
<entry key="build.number" default="0"/>
<entry key="build.date" type="date" value="now" pattern="dd/MM/yyyy HH:mm"/>
</propertyfile>
<!-- Richiesta di conferma -->
<input message="Building ${project.name} with version:"
addproperty="input.version"
defaultvalue="${version.number}"/>
<if>
<not>
<equals arg1="${version.number}" arg2="${input.version}" />
</not>
<then>
<!-- Richiesta di conferma -->
<input message="Confermi il cambio di versione (old '${version.number}' vs new '${input.version}')?"
validargs="S,n"
addproperty="input.response"
defaultvalue="S"/>
<condition property="do.abort">
<not>
<equals arg1="S" arg2="${input.response}" />
</not>
</condition>
<fail if="do.abort">Operazione annullata dall'utente</fail>
<!-- Aggiornamento versione -->
<echo message="New version number, update file ${project.version.file}" />
<propertyfile file="${project.version.file}" comment="Versionamento">
<entry key="version.number" value="${input.version}" />
</propertyfile>
<property name="real.version.number" value="${input.version}" />
</then>
<else>
<property name="real.version.number" value="${version.number}" />
</else>
</if>
<!-- Incrementa il numero di compilazione -->
<buildnumber file="${project.version.file}"/>
</target>
<!-- Gestisce il numero di versione -->
<target name="sub-version-XML2">
<!-- description="Gestione file info.xml" -->
<property name="infoxml.name" value="version.xml" />
<property name="infoxml.source" value="${project.conf}/${infoxml.name}" />
<property name="infoxml.target" value="${project.build}/${infoxml.package}/${infoxml.name}" />
<echo message="Updating file ${infoxml.name}" />
<copy file="${infoxml.source}" tofile="${infoxml.target}" overwrite="true" />
<condition property="installation" value="${config.cliente}/${config.dir}" else="${config.dir}">
<isset property="config.cliente"/>
</condition>
<replace file="${infoxml.target}" value="Value not found in version.properties" propertyFile="${project.version.file}">
<replacefilter token="@version.number@" value="${real.version.number}"/>
<replacefilter token="@version.release@" value="${version.release}"/>
<replacefilter token="@build.number@" value="${build.number}"/>
<replacefilter token="@build.date@" property="build.date"/>
<replacefilter token="@build.installation@" value="${installation}"/>
</replace>
<!-- Aggiungo una copia del file di versione nella cartella di configurazione -->
<copy file="${infoxml.target}" tofile="${project.conf}/${installation}/${infoxml.name}" overwrite="true" />
<!-- Aggiorno gli stessi dati nel WEB.XML -->
<property name="webxml.name" value="web.xml" />
<property name="webxml.source" value="${project.conf}/web.xml" />
<property name="webxml.target" value="${project.conf}/${installation}/WEB-INF/web.xml" />
<echo message="Updating file ${webxml.name}" />
<copy file="${webxml.source}" tofile="${webxml.target}" overwrite="true" />
<replace file="${webxml.target}" value="Value not found in version.properties" propertyFile="${project.version.file}">
<replacefilter token="@version.number@" value="${real.version.number}"/>
<replacefilter token="@version.release@" value="${version.release}"/>
<replacefilter token="@build.number@" value="${build.number}"/>
<replacefilter token="@build.date@" property="build.date"/>
<replacefilter token="@build.installation@" value="${installation}"/>
<!-- Varaibile custom per app New Relic-->
<replacefilter token="@new.relic@" value="${new.relic}"/>
</replace>
</target>
<!-- Funzione di servizio, pulisce la cartella dove viene creata la distribuzione -->
<target name="cleardist" if="file.includes" depends="sub-environment">
<!-- description="Pulisce la cartella dove viene creata la distribuzione" -->
<property name="todelete" value="${file.includes}*.*.*_*.war" />
<echo message="Clearing dist folder for file '${todelete}'" />
<delete failonerror="false" verbose="true">
<fileset dir="${project.dist}" includes="${todelete}"/>
</delete>
</target>
<!-- Routine generale di generazione del pacchetto -->
<target name="dist" if="config.dir" depends="sub-configuration" >
<condition property="project.warfile.standardaname" value="${project.warfile}_${config.cliente}_${config.prefix}" else="${project.warfile}_${config.prefix}">
<isset property="config.cliente"/>
</condition>
<echo message="Deleting and creating dist dir ${project.dist}" />
<antcall target="cleardist">
<param name="file.includes" value="${project.warfile.standardaname}" />
</antcall>
<mkdir dir="${project.dist}"/>
<!-- Ricostruisco i JAR per le librerie nazca -->
<!-- <antcall target="subBuild"><param name="SubProject" value="${nazca 3.0.0.location}"/></antcall> -->
<!-- <antcall target="subBuild"><param name="SubProject" value="${nazca 3.0.0 web.location}"/></antcall> -->
<!-- Creazione file informazioni distribuzione -->
<antcall target="sub-version-XML2">
<param name="infoxml.package" value="${version.package}"/>
</antcall>
<!-- Valorizzazione del nome del file WAR -->
<mkdir dir="lib"/>
<property name="warfile.name" value="${project.warfile.standardaname}${real.version.number}_${build.number}.war" />
<!-- Escludo le pagine jsp di test per tutte le installazioni eccetto che per "develop"
<condition property="test.dir" value="test/**" else="cartella_inesistente">
<not>
<equals arg1="${config.dir}" arg2="develop" casesensitive="false"/>
</not>
</condition>
-->
<echo message="Exporting project in '${warfile.name}'" />
<condition property="installation" value="${config.cliente}/${config.dir}" else="${config.dir}">
<isset property="config.cliente"/>
</condition>
<war destfile="${project.dist}/${warfile.name}" webxml="${project.conf}/${installation}/WEB-INF/web.xml">
<manifest>
<attribute name="Release" value="${installation}"/>
<attribute name="Release-Date" value="${today}"/>
<attribute name="Release-Version" value="${real.version.number} ${version.release}"/>
<attribute name="Release-Build" value="${build.number}"/>
<attribute name="Release-User" value="${env.USERNAME}"/>
<attribute name="Release-Host" value="${env.COMPUTERNAME}"/>
</manifest>
<!-- PERSONALIZZAZIONE - INIZIO -->
<fileset dir="WebContent">
<include name="**"/>
<!-- Lista di esclusione -->
<!-- <exclude name="${test.dir}"/> -->
<exclude name="WEB-INF/web.xml"/>
<exclude name="META-INF/context.xml"/>
<exclude name="META-INF/**.txt"/>
<exclude name="image-pack/**"/>
<exclude name="Thumbs.db"/>
</fileset>
<fileset dir="${project.conf}/${installation}/">
<include name="META-INF/context.xml"/>
<!-- <include name="image-pack/**"/> -->
<!-- <include name="config.local/version.txt"/> -->
</fileset>
<!-- COMMON -->
<lib dir="${project.lib}/common" >
<exclude name="indexer/**"/>
<exclude name="analyzer**"/>
<exclude name="local/**"/>
</lib>
<!-- COMMON - LOCAL -->
<lib dir="${project.lib}/common/local" >
</lib>
<!-- JACKSON -->
<lib dir="${project.lib}/jackson" >
</lib>
<!-- UPLOADBEAN -->
<lib dir="${project.lib}/uploadbean" >
<exclude name="fileupload.jar"/>
</lib>
<!-- JAVA APNS -->
<lib dir="${project.lib}/java-apns" >
<include name="apns-0.1.5-jar-with-dependencies.jar"/>
</lib>
<!-- GCM (Google) -->
<lib dir="${project.lib}/gcm" >
</lib>
<!-- Amazon S3 -->
<lib dir="${project.lib}/amazon.s3">
<include name="aws-java-sdk-1.0.11.jar"/>
</lib>
<lib dir="${project.lib}/amazon.s3/lib.required">
<include name="jackson-core-asl-1.4.3.jar"/>
<include name="stax-1.2.0.jar"/>
<include name="stax-api-1.0.1.jar"/>
</lib>
<!-- C3P0, escluso perchè già presente nella commonlib, ma non i produzione! -->
<lib dir="${project.lib}/c3p0">
<exclude name="**.zip"/>
</lib>
<!-- DBCP
<lib dir="${project.lib}/dbcp">
<exclude name="commons-dbcp-1.2.2-src.zip"/>
<exclude name="commons-pool-1.4-src.zip"/>
</lib> -->
<!-- Classes, sono esclusi i file di configurazione -->
<classes dir="${project.build}">
<include name="**"/>
<exclude name="conf/log4j.xml" />
<exclude name="conf/portal_settings.xml"/>
<exclude name="conf/sso**.xml" />
</classes>
<!-- Sono inclusi i file di configurazione specifici -->
<classes dir="${project.conf}/${installation}">
<include name="conf/log4j.xml" />
<include name="conf/portal_settings.xml"/>
<include name="conf/sso**.xml" />
</classes>
<!-- PERSONALIZZAZIONE - FINE -->
</war>
<antcall target="refresh" />
</target>
<target name="refresh" depends="sub-include-AntContrib">
<trycatch reference="exception_ref">
<try>
<echo>Eclipse refresh in progress...</echo>
<!-- Refresh del progetto
Per funzionare deve essere impostato il seguente flag in "External tool configuration"
JRE > Run in the same JRE as the workspace
-->
<eclipse.refreshLocal resource="${project.name}" depth="infinite"/>
<echo>Eclipse refreshed!</echo>
</try>
<catch>
<echo>Per funzionare deve essere impostato il seguente flag in "External tool configuration"
JRE > Run in the same JRE as the workspace</echo>
</catch>
<finally>
<!-- <echo>Finally</echo> -->
</finally>
</trycatch>
</target>
<target name="sub-include-AntContrib">
<!-- description="Include le librerie (JAR) per gestire il TRY/CATCH/FINALLY" -->
<echo>Include ANT-contrib jar</echo>
<!-- Include le librerie ant-contrib-0.6.jar
http://ant-contrib.sourceforge.net/ -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/lib/ant/ant-contrib-0.6.jar"/>
</classpath>
</taskdef>
</target>
<target name="sub-include-JSCH">
<echo>Include JSCH jar</echo>
<!--
<taskdef name="scp" classname="org.apache.tools.ant.taskdefs.optional.ssh.Scp" >
<classpath>
<pathelement location="${basedir}/lib/ant/ant-jsch-1.9.2.jar" />
<pathelement location="${basedir}/lib/ant/jsch-0.1.50.jar" />
</classpath>
</taskdef>
<taskdef name="sshexec" classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHExec" >
<classpath>
<pathelement location="${basedir}/lib/ant/ant-jsch-1.9.2.jar" />
<pathelement location="${basedir}/lib/ant/jsch-0.1.50.jar" />
</classpath>
</taskdef>
-->
</target>
</project>