Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / applications / appgvSIG / build.xml @ 23294

History | View | Annotate | Download (22.5 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="lib-references"   location="lib-references"/>
21
        <property name="plugin" value="com.iver.cit.gvsig"/>
22
        <property name="fmapdir" value="../libFMap"/>
23
        <property name="extensionDir" location="../_fwAndami/gvSIG/extensiones"/>
24
        <property name="andamiLibs" location="../_fwAndami/lib"/>
25
        <property name="fmapData"   location="../libFMap_data/lib"/>
26
        <property name="fmapDataDB"   location="../libFMap_dataDB/lib"/>
27
        <property name="fmapDataFile"   location="../libFMap_dataFile/lib"/>
28
        <property name="fmapGeometries"   location="../libFMap_geometries/lib"/>
29
        <property name="fmapMapContext"   location="../libFMap_mapcontext/lib"/>
30
        <property name="fmapMapControl"   location="../libFMap_mapcontrol/lib"/>
31
        <property name="andamiJar"  location="../_fwAndami/andami.jar"/>
32

    
33
        <!--
34
                ============================================
35
                Properties for global build
36
                ============================================
37
        -->
38

    
39
        <property name="gvSIG_projects" value="
40
                libExceptions,
41
                libTools,
42
                libInternationalization,
43
                libIverUtiles,
44
                libUIComponent,
45
                libMetadata,
46
                _fwAndami,
47
                libCorePlugin,
48
                libProjection,
49
                libRaster,
50
                libDXF,
51
                libRemoteServices,
52
                libFMap_geometries,
53
                libFMap_data,
54
                libFMap_data_eval_SQLJEP,
55
                libFMap_dataFile,
56
                libFMap_dataDB,
57
                libFMap_spatialindex,
58
                libFMap_mapcontext,
59
                libFMap_mapcontrol,
60
                appgvSIG,
61
                libJCRS,
62
                extJCRS,
63
                libDwg,
64
                libFMap_data_dwg,
65
                extDwg,
66
                libCacheService,
67
                extSymbology,
68
                extRasterTools-SE,
69
                extAddEventTheme,
70
                appCatalogAndGazetteerClient,
71
                extCatalogAndGazetteer,
72
                extDataLocator,
73
                extJDBC,
74
                extCAD,
75
                extGeoProcessing,
76
                extGeoprocessingExtensions,
77
                extGeoreferencing,
78
                extOracleSpatial,
79
                extSDE,
80
                extScripting,
81
                extAnnotations,
82
                extExpressionField,
83
                extWCS,
84
                extWFS2,
85
                extWMS,
86
                extCenterViewToPoint,
87
                libArcIMS,
88
                extArcims,
89
                extRemoteSensing,
90
                extGraph,
91
                extHelp,
92
                extIconThemeBase,
93
                lib3DMap,
94
                ext3Dgui,
95
                binaries
96
        "/>
97

    
98
        <property name="mandatoryProjets" value="
99
                _fwAndami,
100
                libCorePlugin,
101
                libFMap,
102
                appgvSIG
103
        "/>
104

    
105
        <!--
106
        <property name="mandatoryProjets" value="
107
                _fwAndami,
108
                libCorePlugin,
109
                libFMap,
110
                appgvSIG,
111
                extJCRS
112
        "/>
113
        -->
114
        <property name="global.installBaseDir" location="${andami}"/>
115

    
116
        <property name="JUnitProjectResults" value="JUnitProjectResults"/>
117
        <property name="JUnitProjectResultsFile" value="JUnitProjectResults.txt"/>
118
        <property name="JUnitGlobalResults" location="JUnitGlobalResults"/>
119
        <property name="JUnitGlobalResultsFile" location="JUnitGlobalResults.txt"/>
120
        <property name="JUnitSummaryFile" location="JUnitGlobalResults.txt"/>
121
        <property name="FlagTestError" location="JUnitFlagError"/>
122

    
123
        <!--
124
                ============================================
125
                Targets for build of the appgvSIG project
126
                ============================================
127
        -->
128

    
129
        <target name="init">
130
                <!-- Create the time stamp -->
131
                <echo>
132
                        Compiling ${ant.project.name}...</echo>
133

    
134
                <property file="build.number"/>
135
                <!-- Creamos un fichero con el timeStamp para que lo lea el FPanelAbout -->
136
                <!-- <buildnumber/> -->
137
        </target>
138

    
139
        <target name="update-referenced-libraries">
140
                <copy todir="${lib}" failonerror="false">
141
                        <fileset dir="${workspaceDir}/libFMap_mapcontrol/dist" includes="*.jar,*.zip"/>
142
                </copy>
143
                <copy todir="${lib-references}" failonerror="false">
144
                        <fileset dir="${workspaceDir}/libFMap_mapcontrol/lib" includes="*.jar,*.zip"/>
145
                        <fileset dir="${workspaceDir}/libFMap_mapcontrol/lib-references" includes="*.jar,*.zip"/>
146
                </copy>
147

    
148
                <copy todir="${lib}" failonerror="false">
149
                        <fileset dir="${workspaceDir}/libFMap_mapcontext/dist" includes="*.jar,*.zip"/>
150
                </copy>
151
                <copy todir="${lib-references}" failonerror="false">
152
                        <fileset dir="${workspaceDir}/libFMap_mapcontext/lib" includes="*.jar,*.zip"/>
153
                        <fileset dir="${workspaceDir}/libFMap_mapcontext/lib-references" includes="*.jar,*.zip"/>
154
                </copy>
155

    
156

    
157
                <copy todir="${lib}" failonerror="false">
158
                        <fileset dir="${workspaceDir}/libFMap_geometries/dist" includes="*.jar,*.zip"/>
159
                </copy>
160
                <copy todir="${lib-references}" failonerror="false">
161
                        <fileset dir="${workspaceDir}/libFMap_geometries/lib" includes="*.jar,*.zip"/>
162
                        <fileset dir="${workspaceDir}/libFMap_geometries/lib-references" includes="*.jar,*.zip"/>
163
                </copy>
164

    
165
                <copy todir="${lib}" failonerror="false">
166
                        <fileset dir="${workspaceDir}/libFMap_data/dist" includes="*.jar,*.zip"/>
167
                </copy>
168
                <copy todir="${lib-references}" failonerror="false">
169
                        <fileset dir="${workspaceDir}/libFMap_data/lib" includes="*.jar,*.zip"/>
170
                        <fileset dir="${workspaceDir}/libFMap_data/lib-references" includes="*.jar,*.zip"/>
171
                </copy>
172

    
173
                <copy todir="${lib}" failonerror="false">
174
                        <fileset dir="${workspaceDir}/libFMap_dataFile/dist" includes="*.jar,*.zip"/>
175
                </copy>
176
                <copy todir="${lib-references}" failonerror="false">
177
                        <fileset dir="${workspaceDir}/libFMap_dataFile/lib" includes="*.jar,*.zip"/>
178
                        <fileset dir="${workspaceDir}/libFMap_dataFile/lib-references" includes="*.jar,*.zip"/>
179
                </copy>
180

    
181
                <copy todir="${lib}" failonerror="false">
182
                        <fileset dir="${workspaceDir}/libFMap_dataDB/dist" includes="*.jar,*.zip"/>
183
                </copy>
184
                <copy todir="${lib-references}" failonerror="false">
185
                        <fileset dir="${workspaceDir}/libFMap_dataDB/lib" includes="*.jar,*.zip"/>
186
                        <fileset dir="${workspaceDir}/libFMap_dataDB/lib-references" includes="*.jar,*.zip"/>
187
                </copy>
188

    
189
                <copy todir="${lib}" failonerror="false">
190
                        <fileset dir="${workspaceDir}/libFMap_data_eval_SQLJEP/dist" includes="*.jar,*.zip"/>
191
                </copy>
192
                <copy todir="${lib-references}" failonerror="false">
193
                        <fileset dir="${workspaceDir}/libFMap_data_eval_SQLJEP/lib" includes="*.jar,*.zip"/>
194
                </copy>
195
                <copy todir="${lib}" failonerror="false">
196
                        <fileset dir="${workspaceDir}/libTools/dist" includes="*.jar,*.zip"/>
197
                </copy>
198

    
199

    
200

    
201
                <copy todir="${lib}" failonerror="false">
202
                        <fileset dir="${workspaceDir}/libFMap_spatialindex/dist" includes="*.jar,*.zip"/>
203
                </copy>
204
                <copy todir="${lib-references}" failonerror="false">
205
                        <fileset dir="${workspaceDir}/libFMap_spatialindex/lib" includes="*.jar,*.zip"/>
206
                </copy>
207

    
208
        </target>
209

    
210

    
211
        <target name="dist"
212
                                depends="init,update-referenced-libraries,create-jar,copy-libs,copy-data-files,move-to-andami"
213
                                description="Generate the distribution of the gvSIG plugin. To build just the appgvSIG project from Eclipse " >
214
                <!-- Create the distribution directory -->
215
        </target>
216

    
217
        <target name="compile" description="compile the source" depends="update-referenced-libraries">
218
                <!-- Create the build directory structure used by compile -->
219
                <mkdir dir="${build}"/>
220
                <mkdir dir="${build-test}"/>
221
                <!-- Compile the Java code from ${src} to ${build} -->
222
                <loadEclipseClasspath project="${basedir}"/>
223
                <gvSIG-javac
224
                        classpath="${eclipseClasspath}"/>
225
                <gvSIG-javac
226
                        classpath="${eclipseClasspath}"
227
                        srcdir="${src-test}"
228
                        destdir="${build-test}"/>
229

    
230
        </target>
231

    
232
        <target name="create-jar" description="Creates the jar file">
233
                <mkdir dir="${dist}/lib"/>
234
                <jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}"/>
235
        </target>
236

    
237
        <target name="copy-libs">
238
                <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
239
                <copy todir="${dist}/lib">
240
                        <fileset dir="./lib" includes="*.jar,*.zip"/>
241
                </copy>
242

    
243
                <copy todir="${dist}/lib">
244
                        <fileset dir="${lib-references}" includes="*.jar,*.zip"/>
245
                </copy>
246

    
247
                <!--ant dir="../libFMap" target="batch-build" inheritAll="false">
248
                        <property name="debug" value="${debug}"/>
249
                        <property name="debuglevel" value="${debuglevel}"/>
250
                        <property name="encoding" value="ISO_8859_1"/>
251
                </ant-->
252
                <!--copy todir="${dist}/lib">
253
                        <fileset dir="${fmapdir}/dist/lib/" includes="*.jar,*.zip"/>
254
                </copy-->
255

    
256
        </target>
257

    
258
        <target name="batch-build"
259
                        description="Global build for the whole gvSIG + extensions. Compiles all the sources and builds the application so that it's ready to execute"
260
                        depends="init,update-referenced-libraries,compile,create-jar,copy-libs,copy-data-files,move-to-andami">
261
        </target>
262

    
263
        <target name="copy-data-files">
264
        <copy todir="${dist}">
265
                <fileset dir="config" includes="*" />
266
        </copy>
267
                <copy file="build.number" todir="${dist}"/>
268
                <copy todir="${dist}/images">
269
                        <fileset dir="images/" includes="*"/>
270
                </copy>
271
                <copy todir="${dist}/northimages">
272
                        <fileset dir="northimages/" includes="*"/>
273
                </copy>
274
    </target>
275

    
276
        <target name="move-to-andami" description="Moves the build directory to andami">
277
                <move todir="${extensionDir}/${plugin}/">
278
                        <fileset dir="${dist}" includes="**/**"/>
279
                </move>
280
        </target>
281

    
282
        <target name="clean"
283
                        description="clean up" >
284
                <!-- Delete the ${build} and ${dist} directory trees -->
285
                <delete dir="${build}"/>
286
                <!--<delete dir="${dist}"/> -->
287
        </target>
288

    
289
        <target name="run-tests" depends="batch-build,compile-tests">
290
                <antcall target="generic-run-tests">
291
                        <param name="TestSuite.Name" value="com.iver.cit.gvsig.AllTests"/>
292
                </antcall>
293
        </target>
294

    
295
        <!--
296
                ============================================
297
                Targets for global build
298
                ============================================
299
        -->
300

    
301
        <!-- Public Targets -->
302
        <!-- Comment to use it with debug on
303
        <target name="make-binary-distribution"
304
            description="
305
                                Prepare for do a binary distribution of the application.
306
                                This increments the build number and then makes a global build"
307
            depends="clean-all,buildNumber,build-all-DebugOff">
308
    </target>
309
    -->
310
        <target name="make-binary-distribution"
311
            description="
312
                                Prepare for do a binary distribution of the application.
313
                                This increments the build number and then makes a global build"
314
            depends="clean-all,buildNumber,build-all">
315
    </target>
316

    
317
        <target name="make-binary-distribution-JS1.5_JT1.4"
318
            description="
319
                        Prepare for do a binary distribution of the application.
320
                        This increments the build number and then makes a global build.
321
                        Source Java 1.5 and Target Java 1.4"
322
            depends="clean-all,buildNumber,build-all-JS1.5_JT1.4-DebugOff">
323
    </target>
324

    
325
        <target name="make-binary-distribution-test"
326
            description="
327
                        Prepare for a binary distribution of the application
328
                        without increments the global build number"
329
            depends="clean-all,build-all-DebugOff">
330
    </target>
331

    
332
        <target name="make-binary-distribution-JS1.5_JT1.4-test"
333
            description="
334
                        Prepare for a binary distribution of the application
335
                        without increments the global build number.
336
                        Source Java 1.5 and Target Java 1.4"
337
            depends="clean-all,build-all-JS1.5_JT1.4-DebugOff">
338
    </target>
339

    
340
        <target name="make-zip-snapshot-test"
341
            description="
342
                        Prepare a zip binary distribution of the application
343
                        with a snapshot of current state">
344

    
345

    
346
                <delete dir="./dist-temp" failonerror="false"/>
347
                <mkdir dir="./dist-temp/gvSIG_test"/>
348
                <copy todir="./dist-temp/gvSIG_test">
349
                        <fileset dir="${workspaceDir}/_fwAndami" includes="**/**"
350
                                excludes="*.bat,*.sh,src/,src-test/,bin-test/,*.xml,andami.jar,**/.svn,docs/,.*,.*/,config/,schemas/"/>
351
                </copy>
352
                <copy todir="./dist-temp/gvSIG_test">
353
                        <fileset dir="./dist_resources" includes="*.sh,*.bat"/>
354
                </copy>
355
                <loadEclipseClasspath project="${workspaceDir}/_fwAndami" property="andami_classpath"/>
356
                <replace file="./dist-temp/gvSIG_test/gvSIG.bat" token="##Andami_classpath##" value="${andami_classpath}"/>
357
                <replace file="./dist-temp/gvSIG_test/gvSIG.bat" token=":${workspaceDir}/_fwAndami" value=";."/>
358
                <replace file="./dist-temp/gvSIG_test/gvSIG.bat" token="${workspaceDir}/_fwAndami" value="."/>
359

    
360
                <tstamp>
361
                   <format property="BUILD-Date" pattern="yyyyMMddhhmm"/>
362
                </tstamp>
363

    
364
                <zip destfile="gvSIG-snapshot-${BUILD-Date}.zip">
365
                        <zipfileset dir="./dist-temp/gvSIG_test" prefix="gvSIG_test_${BUILD-Date}" includes="**/**" excludes="*.sh"/>
366
                        <zipfileset dir="./dist-temp/gvSIG_test" prefix="gvSIG_test_${BUILD-Date}" includes="*.sh" filemode="755"/>
367
                </zip>
368

    
369
                <delete dir="./dist-temp" failonerror="false"/>
370
    </target>
371

    
372
    <target name="clean_andami_gvSIGdir"
373
            description="clean up the gvSIG andami deploy">
374
        <delete dir="${andami}/gvSIG" failonerror="false"/>
375
    </target>
376

    
377
        <target name="build-all"
378
                description="
379
                        Global build for the whole gvSIG.
380
                        Compiles all the sources and builds the application so that it's ready to execute
381
        ">
382
                <antcall target="build-all-projects">
383
                        <param name="debug" value="on"/>
384
                        <param name="debuglevel" value="lines, vars"/>
385
                </antcall>
386
        </target>
387

    
388
        <target name="build-all-DebugOff"
389
                description="
390
                        Global build for the whole gvSIG.
391
                        Compiles all the sources and builds the application so that it's ready to execute.
392
                        Do not generate debug info in complilation.
393
        ">
394
                <antcall target="build-all-projects">
395
                        <param name="debug" value="off"/>
396
                        <param name="debuglevel" value=""/>
397
                </antcall>
398
        </target>
399

    
400
        <target name="build-all-JS1.5_JT1.4"
401
                description="
402
                        Global build for the whole gvSIG.
403
                        Compiles all the sources and builds the application so that it's ready to execute.
404
                        Source Java 1.5 and Target Java 1.4
405
        ">
406
                <antcall target="build-all-projects">
407
                        <param name="JavaSourceVersion" value="1.5"/>
408
                        <param name="JavaTargetVersion" value="jsr14"/>
409
                </antcall>
410
        </target>
411

    
412
        <target name="build-all-JS1.5_JT1.4-DebugOff"
413
                description="
414
                        Global build for the whole gvSIG.
415
                        Compiles all the sources and builds the application so that it's ready to execute.
416
                        Source Java 1.5 and Target Java 1.4.
417
                        Do not generate debug info in complilation.
418
        ">
419
                <antcall target="build-all-projects">
420
                        <param name="JavaSourceVersion" value="1.5"/>
421
                        <param name="JavaTargetVersion" value="jsr14"/>
422
                        <param name="debug" value="off"/>
423
                        <param name="debuglevel" value=""/>
424
                </antcall>
425
        </target>
426

    
427

    
428
        <target name="build-all-projects"
429
                        description="Builds the application, excluding extensions">
430
                <property file="build.number"/>
431
                <foreach list="${gvSIG_projects}" trim="true" delimiter="," target="batch-build-project" param="bb-project.name"/>
432
        </target>
433

    
434
        <target name="clean-all"
435
                                depends="clean_andami_gvSIGdir,clean-all-projects"
436
                                description="clean up application and projets" />
437

    
438
        <target name="clean-all-projects"
439
                description="cleans the base components of gvSIG: appgvSIG + libs">
440
                <!-- Delete the ${build} and ${dist} directory trees -->
441
                <foreach list="${gvSIG_projects}"  trim="true" delimiter="," target="clean-project" param="c-project.name"/>
442
        </target>
443

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

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

    
453
        <target name="update-all-classpath-files"
454
                                description="Updates the timestamp of all projects.
455
                                        This force eclipse to update jar missing errors.">
456
                <foreach list="${gvSIG_projects}" trim="true"  delimiter="," target="update-proyect-classpath-file" param="u-cp-project.name"/>
457
        </target>
458

    
459

    
460

    
461
        <!-- utility targets -->
462

    
463

    
464
        <target name="buildNumber"
465
                                description="Generates the build.number for the application">
466
                <propertyfile
467
                                file="build.number"
468
                                comment="Build Number for ANT. Do not edit!">
469
                        <entry  key="build.number" default="0" type="int" operation="+" pattern="0000"/>
470
                </propertyfile>
471
        </target>
472

    
473
        <target name="install-project">
474
                <property name="i-project.dir" location="../${i-project.name}"/>
475
                <if>
476
                        <available file="${i-project.dir}" type="dir"/>
477
                        <then>
478
                                <echo>
479
                                        Install ${i-project.name}
480
                                </echo>
481
                                <ant dir="${i-project.dir}" inheritAll="false">
482
                                        <property name="buildNumberFile" location="build.number"/>
483
                                </ant>
484
                        </then>
485
                        <else>
486
                                <if>
487
                                        <contains string="${mandatoryProjets}" substring="${i-project.name}"/>
488
                                        <then>
489
                                                <fail message="The required project is missing for Install: ${i-project.name}"/>
490
                                        </then>
491
                                        <else>
492
                                                <echo>
493
                                                        Skip ${i-project.name} project from Intall
494
                                                </echo>
495
                                        </else>
496
                                </if>
497
                        </else>
498
                </if>
499
        </target>
500

    
501

    
502
        <target name="clean-project">
503
                <property name="c-project.dir" location="../${c-project.name}"/>
504
                <if>
505
                        <available file="${c-project.dir}" type="dir"/>
506
                        <then>
507
                                <echo>
508
                                        Clean ${c-project.name}
509
                                </echo>
510
                                <ant dir="${c-project.dir}" target="clean" inheritAll="false"/>
511
                        </then>
512
                        <else>
513
                                <if>
514
                                        <contains string="${mandatoryProjets}" substring="${c-project.name}"/>
515
                                        <then>
516
                                                <fail message="The required project is missing for Clean: ${c-project.name}"/>
517
                                        </then>
518
                                        <else>
519
                                                <echo>
520
                                                        Skip ${c-project.name} project from Clean
521
                                                </echo>
522
                                        </else>
523
                                </if>
524
                        </else>
525
                </if>
526
        </target>
527

    
528
        <target name="batch-build-project">
529
                <property name="bb-project.dir" location="../${bb-project.name}"/>
530
                <if>
531
                        <available file="${bb-project.dir}" type="dir"/>
532
                        <then>
533
                                <echo>
534
                                        Batch-build ${bb-project.name}
535
                                </echo>
536
                                <ant dir="${bb-project.dir}" target="batch-build" inheritAll="false">
537
                                        <property name="debug" value="${debug}"/>
538
                                        <property name="debuglevel" value="${debuglevel}"/>
539
                                        <property name="encoding" value="${encoding}"/>
540
                                        <property name="JavaSourceVersion" value="${JavaSourceVersion}"/>
541
                                        <property name="JavaTargetVersion" value="${JavaTargetVersion}"/>
542
                                        <property name="buildNumberFile" location="build.number"/>
543
                                </ant>
544
                        </then>
545
                        <else>
546
                                <if>
547
                                        <contains string="${mandatoryProjets}" substring="${bb-project.name}"/>
548
                                        <then>
549
                                                <fail message="The required project is missing for Batch build: ${bb-extension.name}"/>
550
                                        </then>
551
                                        <else>
552
                                                <echo>
553
                                                        Skip ${bb-project.name} project from Batch build
554
                                                </echo>
555
                                        </else>
556
                                </if>
557
                        </else>
558
                </if>
559
        </target>
560

    
561
        <target name="update-proyect-classpath-file">
562
                <property name="u-cp-project.dir" location="../${u-cp-project.name}"/>
563
                <if>
564
                        <available file="${u-cp-project.dir}" type="dir"/>
565
                        <then>
566
                                <if>
567
                                        <available file="${u-cp-project.dir}/.classpath" type="file"/>
568
                                        <then>
569
                                                <touch file="${u-cp-project.dir}/.classpath"/>
570
                                                <echo>
571
                                                        Update classpath file of ${u-cp-project.name}
572
                                                </echo>
573
                                        </then>
574
                                </if>
575
                        </then>
576
                        <else>
577
                                <if>
578
                                        <contains string="${mandatoryProjets}" substring="${u-cp-project.name}"/>
579
                                        <then>
580
                                                <if>
581
                                                        <available file="${u-cp-project.dir}/.classpath" type="file"/>
582
                                                        <then>
583
                                                                <fail message="The required project is missing for Update classpath file: ${u-cp-project.name}"/>
584
                                                        </then>
585
                                                </if>
586
                                        </then>
587
                                        <else>
588
                                                <echo>
589
                                                        Skip ${u-cp-project.name} project from Update classpath file
590
                                                </echo>
591
                                        </else>
592
                                </if>
593
                        </else>
594
                </if>
595
        </target>
596

    
597
        <target name="run-one-test">
598
                <property name="target.project.dir" location="../${target.project.name}"/>
599
                <if>
600
                        <available file="${target.project.dir}" type="dir"/>
601
                        <then>
602
                                <echo>
603
                                        Running tests: ${target.project.dir}
604
                                </echo>
605
                                <trycatch property="AnErrorHappened">
606
                                        <try>
607
                                                <ant dir="${target.project.dir}"
608
                                                        target="run-tests"
609
                                                        inheritAll="false">
610
                                                        <property name="JUnitProjectResults" value="${JUnitProjectResults}"/>
611
                                                        <property name="JUnitProjectResultsFile" value="${JUnitProjectResultsFile}"/>
612
                                                        <property name="JUnitGlobalResults" value="${JUnitGlobalResults}"/>
613
                                                        <property name="JUnitGlobalResultsFile" value="${JUnitGlobalResultsFile}"/>
614
                                                        <property name="JUnitSummaryFile" value="${JUnitSummaryFile}"/>
615
                                                        <property name="buildNumberFile" location="${buildNumberFile}"/>
616
                                                </ant>
617
                                        </try>
618
                                        <catch>
619
                                                <echo        level="error"
620
                                                                append="true"
621
                                                                file="${FlagTestError}">${target.project.name}: ${AnErrorHappened}</echo>
622
                                                <echo level="error">${target.project.name}: ${AnErrorHappened}</echo>
623
                                                <echo append="true" file="${JUnitGlobalResultsFile}">JUnitTests for ${target.project.name}: FAILED.${line.separator}</echo>
624
                                                <echo append="true" file="${target.project.dir}/${JUnitProjectResultsFile}">${AnErrorHappened}</echo>
625
                                        </catch>
626
                                </trycatch>
627
                        </then>
628
                        <else>
629
                                <echo>
630
                                        Skip ${target.project.dir} project from RunTests
631
                                </echo>
632
                                <echo append="true" file="${JUnitGlobalResultsFile}">JUnitTests for ${target.project.name}: SKIPPED.${line.separator}</echo>
633
                        </else>
634
                </if>
635
        </target>
636

    
637
        <target name="run-all-tests">
638
                <delete file="${FlagTestError}" />
639
                <move         file="${JUnitGlobalResultsFile}"
640
                                tofile="${JUnitGlobalResults}.old"
641
                                failonerror="false" />
642
                <property name="buildNumberFile" location="build.number"/>
643
                <foreach        list="${gvSIG_projects}"
644
                                        delimiter=","
645
                                          trim="true"
646
                                        target="run-one-test"
647
                                        param="target.project.name">
648
                                        <param name="buildNumberFile" location="${buildNumberFile}"/>
649
                </foreach>
650

    
651
                <foreach         list="${gvSIG_projects}"
652
                                          trim="true"
653
                                        delimiter=","
654
                                        target="concat-test-output"
655
                                        param="target.project.name" />
656

    
657
                <if>
658
                        <available file="${FlagTestError}" type="file"/>
659
                        <then>
660
                                <echo file="${JUnitGlobalResultsFile}.tmp"> === Global JUnit Results: FAILURE.${line.separator}${line.separator}</echo>
661
                                <concat  destfile="${JUnitGlobalResultsFile}.tmp2"
662
                                                binary="true">
663
                                        <fileset file="${JUnitGlobalResultsFile}.tmp"/>
664
                                        <fileset file="${JUnitGlobalResultsFile}"/>
665
                                </concat>
666
                                <move file="${JUnitGlobalResultsFile}.tmp2" tofile="${JUnitGlobalResultsFile}"/>
667
                                <delete file="${JUnitGlobalResultsFile}.tmp"/>
668
                                <echo level="error">JUnitTests: FAILURE.
669
                                        See ${JUnitGlobalResultsFile} file for details.
670
                                </echo>
671
                        </then>
672
                        <else>
673
                                <echo file="${JUnitGlobalResultsFile}.tmp"> === Global JUnit Results: SUCCESS.${line.separator}${line.separator}</echo>
674
                                <concat  destfile="${JUnitGlobalResultsFile}.tmp2"
675
                                                binary="true">
676
                                        <fileset file="${JUnitGlobalResultsFile}.tmp"/>
677
                                        <fileset file="${JUnitGlobalResultsFile}"/>
678
                                </concat>
679
                                <move file="${JUnitGlobalResultsFile}.tmp2" tofile="${JUnitGlobalResultsFile}"/>
680
                                <delete file="${22JUnitGlobalResultsFile}.tmp"/>
681
                                <echo>JUnitTests: SUCCESS.
682
                                                See ${JUnitGlobalResultsFile} file for details.
683
                                </echo>
684
                        </else>
685
                </if>
686
                <delete file="${FlagTestError}" />
687
        </target>
688

    
689
</project>
690