Project

General

Profile

Download (19.9 KB) Statistics
| Branch: | Revision:

git_sitools_idoc / flarecast / workspace / sitools-build / build.xml @ master

1 d2a8c3fd Marc NICOLAS
<?xml version="1.0" encoding="UTF-8"?>
2
<!-- =================================== == Copyright 2010-2014 CNES - CENTRE 
3
        NATIONAL d'ETUDES SPATIALES == == This file is part of SITools2. == == SITools2 
4
        is free software: you can redistribute it and/or modify == it under the terms 
5
        of the GNU General Public License as published by == the Free Software Foundation, 
6
        either version 3 of the License, or == (at your option) any later version. 
7
        == == SITools2 is distributed in the hope that it will be useful, == but 
8
        WITHOUT ANY WARRANTY; without even the implied warranty of == MERCHANTABILITY 
9
        or FITNESS FOR A PARTICULAR PURPOSE. See the == GNU General Public License 
10
        for more details. == == You should have received a copy of the GNU General 
11
        Public License == along with SITools2. If not, see <http://www.gnu.org/licenses/>. 
12
        ==================================== -->
13
<!--
14
==============================================================================
15
=== Build file to allow ant (http://jakarta.apache.org/ant/) to be used
16
=== to build the Sitools project.
17
===
18
=== Author : AKKA Technologies
19
===
20
=== name    : nom du projet
21
===        default : tache ant executee par defaut
22
===        basedir : repertoire courant lors de l'execution des taches ant
23
===
24
==============================================================================
25
-->
26
<project name="fr.cnes.sitools.build" default="build-git" basedir=".">
27
28
29
        <!-- Chargement du build.properties ( contient le HOST ) -->
30
        <property file="build.properties" prefix="sitools" />
31
        <property name="repos.new.tag" value="${sitools.Version.tag}"/>
32
        <property name="repos.ref.tag" value="${sitools.Version.reference}"/>
33
        <property name="repos.new.revision" value="${sitools.Revision.current}"/>
34
        <property name="repos.ref.revision" value="${sitools.Revision.reference}"/>
35
36
        <property name="workspace.dir" value=".."/>
37
        <property name="fr.cnes.sitools.core.dir" value="${workspace.dir}/fr.cnes.sitools.core"/>
38
        <property name="conf.dir" value="${fr.cnes.sitools.core.dir}/conf"/>
39
40
        <!-- Initialization of SVN-ant libraries -->
41
42
        <!-- Creating distribution folder from tag -->
43
        <property name="distribution.dir" value="DISTRIBUTION-${sitools.project.tag}"/>
44
45
        <!-- Creating distribution folder from tag -->
46
        <property name="distribution.sources.dir" value="${distribution.dir}/sources"/>
47
48
        <!-- Creating distribution folder from tag for astronomy -->
49
        <property name="distribution.astro.dir" value="DISTRIBUTION-ASTRO-${sitools.project.tag}"/>
50
51
        <!-- Creating distribution folder from tag for astronomy -->
52
        <property name="distribution.earthObservation.dir" value="DISTRIBUTION-earthObservation-${sitools.project.tag}"/>
53
54
55
56
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
57
                        MAIN Target 
58
                +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
59
        <target name="build-git" depends="init-git-core, export-git-core, izpack, javadoc, file-list-git-core, tar-gz-core, checksum-core" description="Création d'une distribution" />
60
61
        <target name="build-git-ext-astro" depends="init-git-astro, export-git-astro, file-list-git-astro, tar-gz-astro, checksum-astro" description="Création d'une distribution" />
62
63
        <target name="build-git-ext-earthObservation" depends="init-git-earthObservation, export-git-earthObservation, file-list-git-earthObservation, tar-gz-earthObservation, checksum-earthObservation" description="Création d'une distribution" />
64
65
66
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
67
                Target for init before export
68
        +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
69
        <target name="init" description="Initiatialisation de la creation de la distribution" >
70
                <echo message="preparing folders ..."/>
71
                <delete dir="${distribution.dir}"/>
72
                <mkdir dir="${distribution.dir}"/>
73
                <mkdir dir="${distribution.sources.dir}"/>
74
                <mkdir dir="${distribution.sources.dir}/cots"/>
75
                <mkdir dir="${distribution.sources.dir}/data"/>
76
                <mkdir dir="${distribution.sources.dir}/database"/>
77
                <mkdir dir="${distribution.sources.dir}/workspace"/>
78
        </target>
79
        
80
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
81
                                Target for init before export
82
        +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
83
        <target name="init-git" description="Initiatialisation de la creation de la distribution">
84
                <echo message="preparing folders ..." />
85
                <delete dir="${distribution.dir}" />
86
        </target>
87
88
        <target name="init-git-core" description="Initiatialisation de la creation de la distribution">
89
                <antcall target="init-git">
90
                        <param name="dir" value="${distribution.dir}" />
91
                </antcall>
92
        </target>
93
        <target name="init-git-astro" description="Initiatialisation de la creation de la distribution">
94
                <antcall target="init-git">
95
                        <param name="dir" value="${distribution.astro.dir}" />
96
                </antcall>
97
        </target>
98
        <target name="init-git-earthObservation" description="Initiatialisation de la creation de la distribution">
99
                <antcall target="init-git">
100
                        <param name="dir" value="${distribution.earthObservation.dir}" />
101
                </antcall>
102
        </target>
103
104
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
105
                Target for init before import/ Basicaly remove some files that we don't want to be commited
106
        +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
107
        <target name="export-git" description="Tache GIT d'export de la version actuelle">
108
                <exec executable="scripts/clone-tag.bat" osfamily="windows" failonerror="true">
109
                        <arg value="${url}"/>
110
                        <arg value="${distribution.sources.dir}"/>
111
                        <arg value="${tag}"/>
112
                </exec>
113
114
                <exec executable="scripts/clone-tag.sh" osfamily="unix" failonerror="true">
115
                        <arg value="${url}"/>
116
                        <arg value="${distribution.sources.dir}"/>
117
                        <arg value="${tag}"/>
118
                </exec>
119
120
        </target>
121
122
        <target name="export-git-core" description="Tache GIT d'export de la version actuelle">
123
                <antcall target="export-git">
124
                        <param name="url" value="${sitools.git.repository.url}"/>
125
                        <param name="dir" value="${distribution.dir}"/>
126
                        <param name="tag" value="${repos.new.tag}"/>
127
                </antcall>
128
        </target>
129
130
        <target name="export-git-astro" description="Tache GIT d'export de la version actuelle de l'extension astronomy">
131
                <antcall target="export-git">
132
                        <param name="url" value="${sitools.git.repository.astro.url}" />
133
                        <param name="dir" value="${distribution.astro.dir}" />
134
                        <param name="tag" value="${repos.new.tag}" />
135
                </antcall>
136
        </target>
137
138
        <target name="export-git-earthObservation" description="Tache GIT d'export de la version actuelle de l'extension observation de la Terre">
139
                <antcall target="export-git">
140
                        <param name="url" value="${sitools.git.repository.earthObservation.url}" />
141
                        <param name="dir" value="${distribution.earthObservation.dir}" />
142
                        <param name="tag" value="${repos.new.tag}" />
143
                </antcall>
144
        </target>
145
146
147
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
148
                Targets for IzPack 
149
        +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
150
    <target name="izpack" depends="izpack-init, izpack-compile-core, izpack-compile-extension, izpack-compile, izpack-finish" description="Generate izpack"/>
151
152
        <target name="izpack-init" description="Generate izpack file : prepare">
153
        <!-- Creating temporary folder for compilation -->
154
        <delete dir="tmp"/>
155
        <mkdir dir="tmp/cots"/>
156
        <mkdir dir="tmp/data"/>
157
        <mkdir dir="tmp/database"/>
158
        <mkdir dir="tmp/workspace"/>
159
        <!-- Copying needed projects and resources -->
160
        <copy todir="tmp/cots">
161
            <fileset dir="${distribution.sources.dir}/cots"/>
162
        </copy>
163
        <copy todir="tmp/data">
164
            <fileset dir="${distribution.sources.dir}/data"/>
165
        </copy>
166
        <copy todir="tmp/database">
167
            <fileset dir="${distribution.sources.dir}/database"/>
168
        </copy>
169
        <copy todir="tmp/workspace">
170
            <fileset 
171
                dir="${distribution.sources.dir}/workspace" 
172
                excludes="**/fr.cnes.sitools.s*/** **/sitools-build/** **/sitools-t*/** **/tools/**"/>
173
        </copy>
174
        
175
        <chmod file="tmp/workspace/sitools-install-izpack/conf/scripts/minifyjs.sh" perm="a+x"/>
176
    </target>
177
178
    <target name="izpack-compile-core" description="Generate izpack file : compile core">
179
        <subant target="build" buildpath="./tmp/workspace/fr.cnes.sitools.core/">
180
            <property name="ROOT_DIRECTORY" value="${sitools.ROOT_DIRECTORY}/workspace/sitools-build/tmp"/>
181
        </subant>
182
    </target>
183
            
184
    <target name="izpack-compile-extension" description="Generate izpack file : compile extension">
185
        <subant target="build-extensions" buildpath="./tmp/workspace/fr.cnes.sitools.extensions/">
186
            <property name="ROOT_DIRECTORY" value="${sitools.ROOT_DIRECTORY}/workspace/sitools-build/tmp"/>
187
        </subant>
188
    </target>
189
190
    <target name="izpack-compile" description="Generate izpack file : compile">
191
        <subant  target="build" buildpath="./tmp/workspace/sitools-install-izpack/">
192
            <property name="ROOT_DIRECTORY_LOCAL" value="${sitools.ROOT_DIRECTORY}/workspace/sitools-build/tmp"/>
193
            <property name="properties.Starter.VERSION" value="${sitools.project.tag}"/>
194
        </subant>
195
    </target>
196
197
    <target name="izpack-finish" description="Generate izpack file : copy">
198
        <copy todir="${distribution.dir}">
199
            <fileset dir="./tmp/workspace/sitools-install-izpack/">
200
                <include name="*.jar"/>
201
            </fileset>
202
        </copy>
203
        <delete dir="bin"/>
204
    </target>
205
206
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
207
                Target for file lists and README.txt 
208
        +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
209
        <target name="file-list-git" description="Genere la liste des fichiers, le README et la liste des fichiers A/M/D">
210
                <exec executable="scripts/diff-files.bat" osfamily="windows" failonerror="true">
211
                        <arg value="${reference}"/>
212
                        <arg value="${tag}"/>
213
                        <arg value="${dir}"/>
214
                </exec>
215
                
216
                <exec executable="scripts/diff-files.sh" osfamily="unix" failonerror="true">
217
                        <arg value="${reference}"/>
218
                        <arg value="${tag}"/>
219
                        <arg value="${dir}"/>
220
                </exec>
221
222
                <path id="list.files">
223
                        <fileset dir="${dir}">
224
                                <include name="**/*.*"/>
225
                                <exclude name=".git/**"/>
226
                        </fileset>
227
                </path>
228
                <property name="files" refid="list.files"/>
229
                <pathconvert property="list" refid="list.files" pathsep="&#x0A;">
230
                        <mapper>
231
                                <globmapper from='${sitools.ROOT_DIRECTORY}/workspace/sitools-build/${dir}/*' to="*" handledirsep="true"/>
232
                        </mapper>
233
                </pathconvert>
234
                <echo message="Files : &#x0A;${list}" append="true" file="${dir}/list-file.txt"/>
235
        </target>
236
237
238
        <target name="file-list-git-core" description="Genere la liste des fichiers, le README et la liste des fichiers A/M/D">
239
                <antcall target="file-list-git">
240
                        <param name="reference" value="${sitools.Version.reference}" />
241
                        <param name="tag" value="${sitools.Version.tag}" />
242
                        <param name="dir" value="${distribution.sources.dir}" />
243
                </antcall>
244
                
245
                <move todir="${distribution.dir}">
246
                    <fileset dir="${distribution.sources.dir}" includes="*.txt"/>
247
                </move>
248
        </target>
249
250
        <target name="file-list-git-astro" description="Genere la liste des fichiers, le README et la liste des fichiers A/M/D">
251
                <antcall target="file-list-git">
252
                        <param name="reference" value="${sitools.Version.reference}" />
253
                        <param name="tag" value="${sitools.Version.tag}" />
254
                        <param name="dir" value="${distribution.astro.dir}" />
255
                </antcall>
256
        </target>
257
258
        <target name="file-list-git-earthObservation" description="Genere la liste des fichiers, le README et la liste des fichiers A/M/D">
259
                <antcall target="file-list-git">
260
                        <param name="reference" value="${sitools.Version.reference}" />
261
                        <param name="dir" value="${distribution.earthObservation.dir}" />
262
                        <param name="version" value="${sitools.Version.tag}" />
263
                </antcall>
264
        </target>
265
266
267
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
268
                Target for archive creation
269
        +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
270
        <target name="tar-gz" description="Genere l archive">
271
                <!-- Creating archive -->
272
                <property name="archive.path" value="${dir}/${title}-${version}.tar.gz"/>
273
                <echo message="generating archive ${archive.path}"/>
274
                <tar destfile="${archive.path}" compression="gzip">
275
                        <fileset dir="${dir}/sources">
276
                                <exclude name="**/documentation/javadoc/**"/>
277
                                <exclude name=".git/**"/>
278
                        </fileset>
279
                </tar>
280
        </target>
281
282
        <target name="tar-gz-core" description="Genere l archive">
283
284
                <antcall target="tar-gz">
285
                        <param name="title" value="${sitools.project.title}" />
286
                        <param name="dir" value="${distribution.dir}" />
287
                        <param name="version" value="${sitools.project.tag}" />
288
                </antcall>
289
        </target>
290
291
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
292
                        Target for archive creation
293
                +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
294
        <target name="tar-gz-astro" description="Genere l archive">
295
296
                <antcall target="tar-gz">
297
                        <param name="title" value="${sitools.project.astro.title}" />
298
                        <param name="dir" value="${distribution.astro.dir}" />
299
                        <param name="version" value="${sitools.project.tag}" />
300
                </antcall>
301
        </target>
302
303
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
304
                                Target for archive creation
305
                        +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
306
        <target name="tar-gz-earthObservation" description="Genere l archive">
307
                <antcall target="tar-gz">
308
                        <param name="title" value="${sitools.project.earthObservation.title}" />
309
                        <param name="dir" value="${distribution.earthObservation.dir}" />
310
                        <param name="version" value="${sitools.project.tag}" />
311
                </antcall>
312
        </target>
313
314
315
316
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
317
                Target for MD5
318
        +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
319
        <target name="checksum" description="Genere le MD5 de l archive">
320
321
                <!-- Generating MD5 checksum -->
322
                <echo message="generating MD5 ..."/>
323
                <checksum forceOverwrite="yes" algorithm="MD5" todir="${dir}">
324
                        <fileset dir="${dir}">
325
                                <include name="${title}-${version}.tar.gz"/>
326
                        </fileset>
327
                </checksum>
328
329
                <!-- Check MD5 generated -->
330
                <echo message="verifying MD5 ..."/>
331
                <checksum algorithm="MD5" todir="${dir}" verifyProperty="isMD5ok">
332
                        <fileset dir="${dir}">
333
                                <include name="${title}-${version}.tar.gz"/>
334
                        </fileset>
335
                </checksum>
336
        </target>
337
338
339
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
340
                        Target for MD5
341
                +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
342
        <target name="checksum-core" description="Genere le MD5 de l archive">
343
                <antcall target="checksum">
344
                        <param name="title" value="${sitools.project.title}"/>
345
                        <param name="dir" value="${distribution.dir}"/>
346
                        <param name="version" value="${sitools.project.tag}"/>
347
                </antcall>
348
        </target>
349
350
        <target name="checksum-astro" description="Genere le MD5 de l archive">
351
                <antcall target="checksum">
352
                        <param name="title" value="${sitools.project.astro.title}"/>
353
                        <param name="dir" value="${distribution.astro.dir}"/>
354
                        <param name="version" value="${sitools.project.tag}"/>
355
                </antcall>
356
        </target>
357
358
        <target name="checksum-earthObservation" description="Genere le MD5 de l archive">
359
                <antcall target="checksum">
360
                        <param name="title" value="${sitools.project.earthObservation.title}"/>
361
                        <param name="dir" value="${distribution.earthObservation.dir}"/>
362
                        <param name="version" value="${sitools.project.tag}"/>
363
                </antcall>
364
        </target>
365
366
367
368
369
370
        <path id="javadoc">
371
                <pathelement location="${distribution.sources.dir}/workspace/fr.cnes.sitools.core/src"/>
372
                <pathelement location="${distribution.sources.dir}/workspace/fr.cnes.sitools.extensions/src"/>
373
                <pathelement location="${distribution.sources.dir}/workspace/libraries/javax.measure_0.9.5/src"/>
374
        </path>
375
376
        <!-- Target for Javadoc -->
377
        <target name="javadoc" description="Target to create javadoc">
378
                <mkdir dir="${distribution.dir}/documentation"/>
379
                <mkdir dir="${distribution.dir}/documentation/javadoc"/>
380
                <javadoc 
381
                        destdir="${distribution.dir}/documentation/javadoc"
382
                        packagenames="fr.cnes.sitools.*"
383
                        sourcepathref="javadoc"
384
                        author="true"
385
                        public="true"
386
                        version="true" use="true" windowtitle="${project.fullname} ${project.version}"
387
                        doctitle="${project.fullname} ${project.version}"
388
                        bottom="Copyright &amp;copy; ${year} ${owner}. All Rights Reserved.">
389
                        <classpath>
390
                                <path>
391
                                        <fileset dir="${distribution.sources.dir}/cots/restlet-2.0.5-patched">
392
                                                <include name="**/*.jar"/>
393
                                        </fileset>
394
                                </path>
395
                                <path>
396
                                        <fileset dir="${distribution.sources.dir}/workspace/libraries">
397
                                                <include name="**/*.jar"/>
398
                                                <exclude name="org.apache.solr_3.1.0/*.jar"/>
399
                                        </fileset>
400
                                </path>
401
                                <path>
402
                                        <fileset dir="${distribution.sources.dir}/workspace/org.restlet.ext.solr">
403
                                                <include name="**/*.jar"/>
404
                                        </fileset>
405
                                </path>
406
                        </classpath>
407
                </javadoc>
408
        </target>
409
410
        <target name="changeVersion" description="Change the version in all the Sitools files">
411
                <echo message="Replace ${sitools.project.tag.old} with ${sitools.project.tag}">
412
                </echo>
413
                <replace 
414
                    dir="../.."
415
                    value="${sitools.project.tag}"
416
                    failOnNoReplacements="true"
417
                    includesfile="list_files_for_version.properties"                            
418
                    summary="true"
419
                    encoding="ISO-8859-1">
420
                        <!-- exemple : Starter.VERSION=0.9.1RC -->
421
                        <replacefilter 
422
                            token="Starter.VERSION=${sitools.project.tag.old}"
423
                            value="Starter.VERSION=${sitools.project.tag}"/>
424
                        <!-- exemple : <property name="project.tag"         value="0.9.1RC" />        -->
425
                        <replacefilter 
426
                            token="&lt;property name=&quot;project.version&quot;         value=&quot;${sitools.project.tag.old}&quot;/&gt;"
427
                            value="&lt;property name=&quot;project.version&quot;         value=&quot;${sitools.project.tag}&quot;/&gt;"/>
428
                        <!-- exemple : <property name="project.tag" value="0.9.1RC" />        (with only one space)-->
429
                        <replacefilter 
430
                                   token="&lt;property name=&quot;project.version&quot; value=&quot;${sitools.project.tag.old}&quot;/&gt;"
431
                            value="&lt;property name=&quot;project.version&quot; value=&quot;${sitools.project.tag}&quot;/&gt;"/>
432
                        <!-- exemple : <appversion>0.9.1RC</appversion> -->
433
                        <replacefilter 
434
                            token="&lt;appversion&gt;${sitools.project.tag.old}&lt;/appversion&gt;"
435
                            value="&lt;appversion&gt;${sitools.project.tag}&lt;/appversion&gt;"/>
436
                        <!-- exemple : sonar.projectVersion=0.9.5 -->
437
                        <replacefilter 
438
                            token="sonar.projectVersion=${sitools.project.tag.old}"
439
                            value="sonar.projectVersion=${sitools.project.tag}"/>
440
                </replace>
441
        </target>
442
        
443
        
444
        <!-- Ajoute le texte de licence au début de chaque fichier -->
445
        <target name="replace_headers">
446
                <echo message="changing all files header in directory : ${workspace.dir}"/> 
447
                <loadfile property="javaheader" srcFile="${conf.dir}/licences/header_GPLv3.txt" />
448
                <replaceregexp match="(/\*.*\*/.*)??^package " flags="sm"
449
                        replace="${javaheader}${line.separator}package ">
450
                        <fileset dir="${workspace.dir}">
451
                                <include name="**/*.java" />
452
                        </fileset>                        
453
                </replaceregexp>
454
        </target>
455
        
456
        <!-- Supprime le texte de licence au début de chaque fichier -->
457
        <target name="remove_headers">
458
                <replaceregexp match="(/\*.*\*/.*)??^package " flags="sm"
459
                        replace="package ">
460
                        <fileset dir="src">
461
                                <include name="**/*.java" />
462
                        </fileset>
463
                </replaceregexp>
464
        </target>
465
        
466
        <!-- Supprime le texte de licence au début de chaque fichier -->
467
        <target name="change_copyright" description="Change the copyright year values in all the files of the workspace">
468
                <echo message="Replace 'Copyright 2010-2014 CNES' with 'Copyright 2010-2014 CNES'"></echo>
469
                        <replace 
470
                            value="Copyright 2010-2014 CNES"
471
                                token="Copyright 2010-2014 CNES"
472
                            failOnNoReplacements="true"
473
                            summary="true"
474
                            encoding="ISO-8859-1">
475
                                <fileset dir="../..">
476
                                        <include name="**/*.java" />
477
                                        <include name="**/*.js" />
478
                                        <include name="**/*.css" />
479
                                        <include name="**/*.xml" />
480
                                        <include name="**/*.properties" />
481
                                </fileset>
482
                        </replace>
483
        </target>
484
        
485
486
</project>