Statistics
| Revision:

root / trunk / applications / appgvSIG / build.xml @ 20903

History | View | Annotate | Download (17.2 KB)

1
<project name="appgvSIG" default="dist" basedir=".">
2
    <description>
3
        gvSIG Main build
4
    </description>
5

    
6
        <import file="../binaries/ant/utilities.xml"/>
7

    
8
        <!--
9
                ============================================
10
                Properties for build of the appgvSIG project
11
                ============================================
12
        -->
13
        <property name="version" value="1.2 ${eclipse.startTime}"/>
14
        <property name="src" location="src"/>
15
        <property name="build" location="bin"/>
16
        <property name="src-test" location="src-test"/>
17
        <property name="build-test" location="bin-test"/>
18
        <property name="dist"  location="dist"/>
19
        <property name="lib"   location="lib"/>
20
        <property name="plugin" value="com.iver.cit.gvsig"/>
21
        <property name="fmapdir" value="../libFMap"/>
22
        <property name="extensionDir" location="../_fwAndami/gvSIG/extensiones"/>
23
        <property name="andamiLibs" location="../_fwAndami/lib"/>
24
        <property name="fmapLibs"   location="../libFMap/lib"/>
25
        <property name="andamiJar"  location="../_fwAndami/andami.jar"/>
26

    
27
        <!--
28
                ============================================
29
                Properties for global build
30
                ============================================
31
        -->
32

    
33
        <property name="gvSIG_projects" value="
34
                libExceptions,
35
                libInternationalization,
36
                libIverUtiles,
37
                libUIComponent,
38
                _fwAndami,
39
                libCorePlugin,
40
                libProjection,
41
                libRaster,
42
                libDXF,
43
                libDriverManager,
44
                libRemoteServices,
45
                libGDBMS,
46
                libFMap,
47
                appgvSIG,
48
                libJCRS,
49
                extJCRS,
50
                libDwg,
51
                extDwg,
52
                libCacheService,
53
                extSymbology,
54
                extRasterTools-SE,
55
                extAddEventTheme,
56
                appCatalogAndGazetteerClient,
57
                extCatalogAndGazetteer,
58
                extDataLocator,
59
                extJDBC,
60
                extCAD,
61
                extGeoProcessing,
62
                extGeoprocessingExtensions,
63
                extGeoreferencing,
64
                extOracleSpatial,
65
                extSDE,
66
                extScripting,
67
                extAnnotations,
68
                extExpressionField,
69
                extWCS,
70
                extWFS2,
71
                extWMS,
72
                extCenterViewToPoint,
73
                libArcIMS,
74
                extArcims,
75
                extRemoteSensing,
76
                extGraph,
77
                extHelp,
78
                extIconThemeBase,
79
                lib3DMap,
80
                ext3Dgui,
81
                binaries
82
        "/>
83

    
84
        <property name="mandatoryProjets" value="
85
                _fwAndami,
86
                libCorePlugin,
87
                libFMap,
88
                appgvSIG,
89
                extJCRS
90
        "/>
91

    
92
        <property name="global.installBaseDir" location="${andami}"/>
93

    
94
        <property name="JUnitProjectResults" value="JUnitProjectResults"/>
95
        <property name="JUnitProjectResultsFile" value="JUnitProjectResults.txt"/>
96
        <property name="JUnitGlobalResults" location="JUnitGlobalResults"/>
97
        <property name="JUnitGlobalResultsFile" location="JUnitGlobalResults.txt"/>
98
        <property name="JUnitSummaryFile" location="JUnitGlobalResults.txt"/>
99
        <property name="FlagTestError" location="JUnitFlagError"/>
100

    
101
        <!--
102
                ============================================
103
                Targets for build of the appgvSIG project
104
                ============================================
105
        -->
106

    
107
        <target name="init">
108
                <!-- Create the time stamp -->
109
                <tstamp/>
110
                <echo>
111
                        Compiling ${ant.project.name}...</echo>
112

    
113
                <property file="build.number"/>
114
                <!-- Creamos un fichero con el timeStamp para que lo lea el FPanelAbout -->
115
                <!-- <buildnumber/> -->
116
        </target>
117

    
118
        <target name="dist"
119
                                depends="init,create-jar,copy-libs,copy-data-files,move-to-andami"
120
                                description="Generate the distribution of the gvSIG plugin. To build just the appgvSIG project from Eclipse " >
121
                <!-- Create the distribution directory -->
122
        </target>
123

    
124
        <target name="compile" description="compile the source">
125
                <!-- Create the time stamp -->
126
                <tstamp/>
127
                <!-- Create the build directory structure used by compile -->
128
                <mkdir dir="${build}"/>
129
                <!-- Compile the Java code from ${src} to ${build} -->
130
                <loadEclipseClasspath project="${basedir}"/>
131
                <gvSIG-javac
132
                        classpath="${eclipseClasspath}"/>
133

    
134
        </target>
135

    
136
        <target name="create-jar" description="Creates the jar file">
137
                <mkdir dir="${dist}/lib"/>
138
                <jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}"/>
139
        </target>
140

    
141
        <target name="copy-libs">
142
                <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
143
                <copy todir="${dist}/lib">
144
                        <fileset dir="./lib" includes="*.jar,*.zip"/>
145
                </copy>
146
                <ant dir="../libFMap" target="batch-build" inheritAll="false">
147
                        <property name="debug" value="${debug}"/>
148
                        <property name="debuglevel" value="${debuglevel}"/>
149
                        <property name="encoding" value="ISO_8859_1"/>
150
                </ant>
151
                <copy todir="${dist}/lib">
152
                        <fileset dir="${fmapdir}/dist/lib/" includes="*.jar,*.zip"/>
153
                </copy>
154

    
155
        </target>
156

    
157
        <target name="batch-build"
158
                        description="Global build for the whole gvSIG + extensions. Compiles all the sources and builds the application so that it's ready to execute"
159
                        depends="init,compile,create-jar,copy-libs,copy-data-files,move-to-andami">
160
        </target>
161

    
162
        <target name="copy-data-files">
163
        <copy todir="${dist}">
164
                <fileset dir="config" includes="*" />
165
        </copy>
166
                <copy file="build.number" todir="${dist}"/>
167
                <copy todir="${dist}/images">
168
                        <fileset dir="images/" includes="*"/>
169
                </copy>
170
                <copy todir="${dist}/northimages">
171
                        <fileset dir="northimages/" includes="*"/>
172
                </copy>
173
    </target>
174

    
175
        <target name="move-to-andami" description="Moves the build directory to andami">
176
                <move todir="${extensionDir}/${plugin}/">
177
                        <fileset dir="${dist}" includes="**/**"/>
178
                </move>
179
        </target>
180

    
181
        <target name="clean"
182
                        description="clean up" >
183
                <!-- Delete the ${build} and ${dist} directory trees -->
184
                <delete dir="${build}"/>
185
                <!--<delete dir="${dist}"/> -->
186
        </target>
187

    
188
        <target name="run-tests" depends="batch-build,compile-tests">
189
                <antcall target="generic-run-tests">
190
                        <param name="TestSuite.Name" value="com.iver.cit.gvsig.AllTests"/>
191
                </antcall>
192
        </target>
193

    
194
        <!--
195
                ============================================
196
                Targets for global build
197
                ============================================
198
        -->
199

    
200
        <!-- Public Targets -->
201
        <!-- Comment to use it with debug on
202
        <target name="make-binary-distribution"
203
            description="
204
                                Prepare for do a binary distribution of the application.
205
                                This increments the build number and then makes a global build"
206
            depends="clean-all,buildNumber,build-all-DebugOff">
207
    </target>
208
    -->
209
        <target name="make-binary-distribution"
210
            description="
211
                                Prepare for do a binary distribution of the application.
212
                                This increments the build number and then makes a global build"
213
            depends="clean-all,buildNumber,build-all">
214
    </target>
215

    
216
        <target name="make-binary-distribution-JS1.5_JT1.4"
217
            description="
218
                        Prepare for do a binary distribution of the application.
219
                        This increments the build number and then makes a global build.
220
                        Source Java 1.5 and Target Java 1.4"
221
            depends="clean-all,buildNumber,build-all-JS1.5_JT1.4-DebugOff">
222
    </target>
223

    
224
        <target name="make-binary-distribution-test"
225
            description="
226
                        Prepare for a binary distribution of the application
227
                        without increments the global build number"
228
            depends="clean-all,build-all-DebugOff">
229
    </target>
230

    
231
        <target name="make-binary-distribution-JS1.5_JT1.4-test"
232
            description="
233
                        Prepare for a binary distribution of the application
234
                        without increments the global build number.
235
                        Source Java 1.5 and Target Java 1.4"
236
            depends="clean-all,build-all-JS1.5_JT1.4-DebugOff">
237
    </target>
238

    
239
    <target name="clean_andami_gvSIGdir"
240
            description="clean up the gvSIG andami deploy">
241
        <delete dir="${andami}/gvSIG" failonerror="false"/>
242
    </target>
243

    
244
        <target name="build-all"
245
                description="
246
                        Global build for the whole gvSIG.
247
                        Compiles all the sources and builds the application so that it's ready to execute
248
        ">
249
                <antcall target="build-all-projects">
250
                        <param name="debug" value="on"/>
251
                        <param name="debuglevel" value="lines, vars"/>
252
                </antcall>
253
        </target>
254

    
255
        <target name="build-all-DebugOff"
256
                description="
257
                        Global build for the whole gvSIG.
258
                        Compiles all the sources and builds the application so that it's ready to execute.
259
                        Do not generate debug info in complilation.
260
        ">
261
                <antcall target="build-all-projects">
262
                        <param name="debug" value="off"/>
263
                        <param name="debuglevel" value=""/>
264
                </antcall>
265
        </target>
266

    
267
        <target name="build-all-JS1.5_JT1.4"
268
                description="
269
                        Global build for the whole gvSIG.
270
                        Compiles all the sources and builds the application so that it's ready to execute.
271
                        Source Java 1.5 and Target Java 1.4
272
        ">
273
                <antcall target="build-all-projects">
274
                        <param name="JavaSourceVersion" value="1.5"/>
275
                        <param name="JavaTargetVersion" value="jsr14"/>
276
                </antcall>
277
        </target>
278

    
279
        <target name="build-all-JS1.5_JT1.4-DebugOff"
280
                description="
281
                        Global build for the whole gvSIG.
282
                        Compiles all the sources and builds the application so that it's ready to execute.
283
                        Source Java 1.5 and Target Java 1.4.
284
                        Do not generate debug info in complilation.
285
        ">
286
                <antcall target="build-all-projects">
287
                        <param name="JavaSourceVersion" value="1.5"/>
288
                        <param name="JavaTargetVersion" value="jsr14"/>
289
                        <param name="debug" value="off"/>
290
                        <param name="debuglevel" value=""/>
291
                </antcall>
292
        </target>
293

    
294

    
295
        <target name="build-all-projects"
296
                        description="Builds the application, excluding extensions">
297
                <property file="build.number"/>
298
                <foreach list="${gvSIG_projects}" trim="true" delimiter="," target="batch-build-project" param="bb-project.name"/>
299
        </target>
300

    
301
        <target name="clean-all"
302
                                depends="clean_andami_gvSIGdir,clean-all-projects"
303
                                description="clean up application and projets" />
304

    
305
        <target name="clean-all-projects"
306
                description="cleans the base components of gvSIG: appgvSIG + libs">
307
                <!-- Delete the ${build} and ${dist} directory trees -->
308
                <foreach list="${gvSIG_projects}"  trim="true" delimiter="," target="clean-project" param="c-project.name"/>
309
        </target>
310

    
311
        <target name="install-all"
312
                                        depends="install-all-projects"
313
                                        description="Generate jars and copy files to Andami for the whole application (gvSIG+libs+extensions). Compilation is supposed to be automatically done by Eclipse" />
314

    
315
        <target name="install-all-projects"
316
                                description="Generate jars and copy files to Andami for the application (gvSIG+libs). Compilation is supposed to be automatically done by Eclipse" >
317
                <foreach list="${gvSIG_projects}" trim="true"  delimiter="," target="install-project" param="i-project.name"/>
318
        </target>
319

    
320
        <target name="update-all-classpath-files"
321
                                description="Updates the timestamp of all projects.
322
                                        This force eclipse to update jar missing errors.">
323
                <foreach list="${gvSIG_projects}" trim="true"  delimiter="," target="update-proyect-classpath-file" param="u-cp-project.name"/>
324
        </target>
325

    
326

    
327

    
328
        <!-- utility targets -->
329

    
330

    
331
        <target name="buildNumber"
332
                                description="Generates the build.number for the application">
333
                <propertyfile
334
                                file="build.number"
335
                                comment="Build Number for ANT. Do not edit!">
336
                        <entry  key="build.number" default="0" type="int" operation="+" pattern="0000"/>
337
                </propertyfile>
338
        </target>
339

    
340
        <target name="install-project">
341
                <property name="i-project.dir" location="../${i-project.name}"/>
342
                <if>
343
                        <available file="${i-project.dir}" type="dir"/>
344
                        <then>
345
                                <echo>
346
                                        Install ${i-project.name}
347
                                </echo>
348
                                <ant dir="${i-project.dir}" inheritAll="false">
349
                                        <property name="buildNumberFile" location="build.number"/>
350
                                </ant>
351
                        </then>
352
                        <else>
353
                                <if>
354
                                        <contains string="${mandatoryProjets}" substring="${i-project.name}"/>
355
                                        <then>
356
                                                <fail message="The required project is missing for Install: ${i-project.name}"/>
357
                                        </then>
358
                                        <else>
359
                                                <echo>
360
                                                        Skip ${i-project.name} project from Intall
361
                                                </echo>
362
                                        </else>
363
                                </if>
364
                        </else>
365
                </if>
366
        </target>
367

    
368

    
369
        <target name="clean-project">
370
                <property name="c-project.dir" location="../${c-project.name}"/>
371
                <if>
372
                        <available file="${c-project.dir}" type="dir"/>
373
                        <then>
374
                                <echo>
375
                                        Clean ${c-project.name}
376
                                </echo>
377
                                <ant dir="${c-project.dir}" target="clean" inheritAll="false"/>
378
                        </then>
379
                        <else>
380
                                <if>
381
                                        <contains string="${mandatoryProjets}" substring="${c-project.name}"/>
382
                                        <then>
383
                                                <fail message="The required project is missing for Clean: ${c-project.name}"/>
384
                                        </then>
385
                                        <else>
386
                                                <echo>
387
                                                        Skip ${c-project.name} project from Clean
388
                                                </echo>
389
                                        </else>
390
                                </if>
391
                        </else>
392
                </if>
393
        </target>
394

    
395
        <target name="batch-build-project">
396
                <property name="bb-project.dir" location="../${bb-project.name}"/>
397
                <if>
398
                        <available file="${bb-project.dir}" type="dir"/>
399
                        <then>
400
                                <echo>
401
                                        Batch-build ${bb-project.name}
402
                                </echo>
403
                                <ant dir="${bb-project.dir}" target="batch-build" inheritAll="false">
404
                                        <property name="debug" value="${debug}"/>
405
                                        <property name="debuglevel" value="${debuglevel}"/>
406
                                        <property name="encoding" value="${encoding}"/>
407
                                        <property name="JavaSourceVersion" value="${JavaSourceVersion}"/>
408
                                        <property name="JavaTargetVersion" value="${JavaTargetVersion}"/>
409
                                        <property name="buildNumberFile" location="build.number"/>
410
                                </ant>
411
                        </then>
412
                        <else>
413
                                <if>
414
                                        <contains string="${mandatoryProjets}" substring="${bb-project.name}"/>
415
                                        <then>
416
                                                <fail message="The required project is missing for Batch build: ${bb-extension.name}"/>
417
                                        </then>
418
                                        <else>
419
                                                <echo>
420
                                                        Skip ${bb-project.name} project from Batch build
421
                                                </echo>
422
                                        </else>
423
                                </if>
424
                        </else>
425
                </if>
426
        </target>
427

    
428
        <target name="update-proyect-classpath-file">
429
                <property name="u-cp-project.dir" location="../${u-cp-project.name}"/>
430
                <if>
431
                        <available file="${u-cp-project.dir}" type="dir"/>
432
                        <then>
433
                                <if>
434
                                        <available file="${u-cp-project.dir}/.classpath" type="file"/>
435
                                        <then>
436
                                                <touch file="${u-cp-project.dir}/.classpath"/>
437
                                                <echo>
438
                                                        Update classpath file of ${u-cp-project.name}
439
                                                </echo>
440
                                        </then>
441
                                </if>
442
                        </then>
443
                        <else>
444
                                <if>
445
                                        <contains string="${mandatoryProjets}" substring="${u-cp-project.name}"/>
446
                                        <then>
447
                                                <if>
448
                                                        <available file="${u-cp-project.dir}/.classpath" type="file"/>
449
                                                        <then>
450
                                                                <fail message="The required project is missing for Update classpath file: ${u-cp-project.name}"/>
451
                                                        </then>
452
                                                </if>
453
                                        </then>
454
                                        <else>
455
                                                <echo>
456
                                                        Skip ${u-cp-project.name} project from Update classpath file
457
                                                </echo>
458
                                        </else>
459
                                </if>
460
                        </else>
461
                </if>
462
        </target>
463

    
464
        <target name="run-one-test">
465
                <property name="target.project.dir" location="../${target.project.name}"/>
466
                <if>
467
                        <available file="${target.project.dir}" type="dir"/>
468
                        <then>
469
                                <echo>
470
                                        Running tests: ${target.project.dir}
471
                                </echo>
472
                                <trycatch property="AnErrorHappened">
473
                                        <try>
474
                                                <ant dir="${target.project.dir}"
475
                                                        target="run-tests"
476
                                                        inheritAll="false">
477
                                                        <property name="JUnitProjectResults" value="${JUnitProjectResults}"/>
478
                                                        <property name="JUnitProjectResultsFile" value="${JUnitProjectResultsFile}"/>
479
                                                        <property name="JUnitGlobalResults" value="${JUnitGlobalResults}"/>
480
                                                        <property name="JUnitGlobalResultsFile" value="${JUnitGlobalResultsFile}"/>
481
                                                        <property name="JUnitSummaryFile" value="${JUnitSummaryFile}"/>
482
                                                        <property name="buildNumberFile" location="${buildNumberFile}"/>
483
                                                </ant>
484
                                        </try>
485
                                        <catch>
486
                                                <echo        level="error"
487
                                                                append="true"
488
                                                                file="${FlagTestError}">${target.project.name}: ${AnErrorHappened}</echo>
489
                                                <echo level="error">${target.project.name}: ${AnErrorHappened}</echo>
490
                                                <echo append="true" file="${JUnitGlobalResultsFile}">JUnitTests for ${target.project.name}: FAILED.${line.separator}</echo>
491
                                                <echo append="true" file="${target.project.dir}/${JUnitProjectResultsFile}">${AnErrorHappened}</echo>
492
                                        </catch>
493
                                </trycatch>
494
                        </then>
495
                        <else>
496
                                <echo>
497
                                        Skip ${target.project.dir} project from RunTests
498
                                </echo>
499
                                <echo append="true" file="${JUnitGlobalResultsFile}">JUnitTests for ${target.project.name}: SKIPPED.${line.separator}</echo>
500
                        </else>
501
                </if>
502
        </target>
503

    
504
        <target name="run-all-tests">
505
                <delete file="${FlagTestError}" />
506
                <move         file="${JUnitGlobalResultsFile}"
507
                                tofile="${JUnitGlobalResults}.old"
508
                                failonerror="false" />
509
                <property name="buildNumberFile" location="build.number"/>
510
                <foreach        list="${gvSIG_projects}"
511
                                        delimiter=","
512
                                          trim="true"
513
                                        target="run-one-test"
514
                                        param="target.project.name">
515
                                        <param name="buildNumberFile" location="${buildNumberFile}"/>
516
                </foreach>
517

    
518
                <foreach         list="${gvSIG_projects}"
519
                                          trim="true"
520
                                        delimiter=","
521
                                        target="concat-test-output"
522
                                        param="target.project.name" />
523

    
524
                <if>
525
                        <available file="${FlagTestError}" type="file"/>
526
                        <then>
527
                                <echo file="${JUnitGlobalResultsFile}.tmp"> === Global JUnit Results: FAILURE.${line.separator}${line.separator}</echo>
528
                                <concat  destfile="${JUnitGlobalResultsFile}.tmp2"
529
                                                binary="true">
530
                                        <fileset file="${JUnitGlobalResultsFile}.tmp"/>
531
                                        <fileset file="${JUnitGlobalResultsFile}"/>
532
                                </concat>
533
                                <move file="${JUnitGlobalResultsFile}.tmp2" tofile="${JUnitGlobalResultsFile}"/>
534
                                <delete file="${JUnitGlobalResultsFile}.tmp"/>
535
                                <echo level="error">JUnitTests: FAILURE.
536
                                        See ${JUnitGlobalResultsFile} file for details.
537
                                </echo>
538
                        </then>
539
                        <else>
540
                                <echo file="${JUnitGlobalResultsFile}.tmp"> === Global JUnit Results: SUCCESS.${line.separator}${line.separator}</echo>
541
                                <concat  destfile="${JUnitGlobalResultsFile}.tmp2"
542
                                                binary="true">
543
                                        <fileset file="${JUnitGlobalResultsFile}.tmp"/>
544
                                        <fileset file="${JUnitGlobalResultsFile}"/>
545
                                </concat>
546
                                <move file="${JUnitGlobalResultsFile}.tmp2" tofile="${JUnitGlobalResultsFile}"/>
547
                                <delete file="${22JUnitGlobalResultsFile}.tmp"/>
548
                                <echo>JUnitTests: SUCCESS.
549
                                                See ${JUnitGlobalResultsFile} file for details.
550
                                </echo>
551
                        </else>
552
                </if>
553
                <delete file="${FlagTestError}" />
554
        </target>
555

    
556
</project>
557