Statistics
| Revision:

svn-gvsig-desktop / tags / v1_9_Build_1231 / applications / appgvSIG / build.xml @ 44678

History | View | Annotate | Download (17.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="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
                extDockingSkin,
41
                libProjection,
42
                libRaster,
43
                libDXF,
44
                libDriverManager,
45
                libRemoteServices,
46
                libGDBMS,
47
                libFMap,
48
                libGPE,
49
                libGPE-XML,
50
                libGPE-GML,
51
                libGPE-KML,
52
                appgvSIG,
53
                libJCRS,
54
                extJCRS,
55
                libTopology,
56
                libDwg,
57
                extDwg,
58
                libCacheService,
59
                extSymbology,
60
                extRasterTools-SE,
61
                extAddEventTheme,
62
                extGPE-gvSIG,
63
                appCatalogAndGazetteerClient,
64
                extCatalogAndGazetteer,
65
                extDataLocator,
66
                extJDBC,
67
                extCAD,
68
                extGeoProcessing,
69
                extGeoprocessingExtensions,
70
                extGeoreferencing,
71
                extTopology,
72
                extOracleSpatial,
73
                extSDE,
74
                extScripting,
75
                extAnnotations,
76
                extExpressionField,
77
                extWCS,
78
                extWFS2,
79
                extWMS,
80
                extCenterViewToPoint,
81
                libArcIMS,
82
                extArcims,
83
                extRemoteSensing,
84
                extGraph,
85
                extHelp,
86
                extIconThemeBase,
87
                lib3DMap,
88
                ext3Dgui,
89
                extSextanteGvsigBindings,
90
                extTableSummarize,
91
                extSelectionTools,
92
                extProjectBackup,
93
                extQuickInfo,
94
                extDerivedGeometries,
95
                extHyperlink,
96
                binaries
97
        "/>
98

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

    
107
        <property name="global.installBaseDir" location="${andami}"/>
108

    
109
        <property name="JUnitProjectResults" value="JUnitProjectResults"/>
110
        <property name="JUnitProjectResultsFile" value="JUnitProjectResults.txt"/>
111
        <property name="JUnitGlobalResults" location="JUnitGlobalResults"/>
112
        <property name="JUnitGlobalResultsFile" location="JUnitGlobalResults.txt"/>
113
        <property name="JUnitSummaryFile" location="JUnitGlobalResults.txt"/>
114
        <property name="FlagTestError" location="JUnitFlagError"/>
115

    
116
        <!--
117
                ============================================
118
                Targets for build of the appgvSIG project
119
                ============================================
120
        -->
121

    
122
        <target name="init">
123
                <!-- Create the time stamp -->
124
                <tstamp/>
125
                <echo>
126
                        Compiling ${ant.project.name}...</echo>
127

    
128
                <property file="build.number"/>
129
                <!-- Creamos un fichero con el timeStamp para que lo lea el FPanelAbout -->
130
                <!-- <buildnumber/> -->
131
        </target>
132

    
133
        <target name="dist"
134
                                depends="init,create-jar,copy-libs,copy-data-files,move-to-andami"
135
                                description="Generate the distribution of the gvSIG plugin. To build just the appgvSIG project from Eclipse " >
136
                <!-- Create the distribution directory -->
137
        </target>
138

    
139
        <target name="compile" description="compile the source">
140
                <!-- Create the time stamp -->
141
                <tstamp/>
142
                <!-- Create the build directory structure used by compile -->
143
                <mkdir dir="${build}"/>
144
                <!-- Compile the Java code from ${src} to ${build} -->
145
                <loadEclipseClasspath project="${basedir}"/>
146
                <gvSIG-javac
147
                        classpath="${eclipseClasspath}"/>
148

    
149
        </target>
150

    
151
        <target name="create-jar" description="Creates the jar file">
152
                <mkdir dir="${dist}/lib"/>
153
                <jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}"/>
154
        </target>
155

    
156
        <target name="copy-libs">
157
                <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
158
                <copy todir="${dist}/lib">
159
                        <fileset dir="./lib" includes="*.jar,*.zip"/>
160
                </copy>
161
                <ant dir="../libFMap" target="batch-build" inheritAll="false">
162
                        <property name="debug" value="${debug}"/>
163
                        <property name="debuglevel" value="${debuglevel}"/>
164
                        <property name="encoding" value="ISO_8859_1"/>
165
                </ant>
166
                <copy todir="${dist}/lib">
167
                        <fileset dir="${fmapdir}/dist/lib/" includes="*.jar,*.zip"/>
168
                </copy>
169

    
170
        </target>
171

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

    
177
        <target name="copy-data-files">
178
        <copy todir="${dist}">
179
                <fileset dir="config" includes="*" />
180
        </copy>
181
                <copy file="build.number" todir="${dist}"/>
182
                <copy todir="${dist}/images">
183
                        <fileset dir="images/" includes="*"/>
184
                </copy>
185
                <copy todir="${dist}/northimages">
186
                        <fileset dir="northimages/" includes="*"/>
187
                </copy>
188
    </target>
189

    
190
        <target name="move-to-andami" description="Moves the build directory to andami">
191
                <move todir="${extensionDir}/${plugin}/">
192
                        <fileset dir="${dist}" includes="**/**"/>
193
                </move>
194
        </target>
195

    
196
        <target name="clean"
197
                        description="clean up" >
198
                <!-- Delete the ${build} and ${dist} directory trees -->
199
                <delete dir="${build}"/>
200
                <!--<delete dir="${dist}"/> -->
201
        </target>
202

    
203
        <target name="run-tests" depends="batch-build,compile-tests">
204
                <antcall target="generic-run-tests">
205
                        <param name="TestSuite.Name" value="com.iver.cit.gvsig.AllTests"/>
206
                </antcall>
207
        </target>
208

    
209
        <!--
210
                ============================================
211
                Targets for global build
212
                ============================================
213
        -->
214

    
215
        <!-- Public Targets -->
216
        <!-- Comment to use it with debug on
217
        <target name="make-binary-distribution"
218
            description="
219
                                Prepare for do a binary distribution of the application.
220
                                This increments the build number and then makes a global build"
221
            depends="clean-all,buildNumber,build-all-DebugOff">
222
    </target>
223
    -->
224
        <target name="make-binary-distribution"
225
            description="
226
                                Prepare for do a binary distribution of the application.
227
                                This increments the build number and then makes a global build"
228
            depends="clean-all,buildNumber,build-all">
229
    </target>
230

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

    
239
        <target name="make-binary-distribution-test"
240
            description="
241
                        Prepare for a binary distribution of the application
242
                        without increments the global build number"
243
            depends="clean-all,build-all-DebugOff">
244
    </target>
245

    
246
        <target name="make-binary-distribution-JS1.5_JT1.4-test"
247
            description="
248
                        Prepare for a binary distribution of the application
249
                        without increments the global build number.
250
                        Source Java 1.5 and Target Java 1.4"
251
            depends="clean-all,build-all-JS1.5_JT1.4-DebugOff">
252
    </target>
253

    
254
    <target name="clean_andami_gvSIGdir"
255
            description="clean up the gvSIG andami deploy">
256
        <delete dir="${andami}/gvSIG" failonerror="false"/>
257
    </target>
258

    
259
        <target name="build-all"
260
                description="
261
                        Global build for the whole gvSIG.
262
                        Compiles all the sources and builds the application so that it's ready to execute
263
        ">
264
                <antcall target="build-all-projects">
265
                        <param name="debug" value="on"/>
266
                        <param name="debuglevel" value="lines, vars, source"/>
267
                </antcall>
268
        </target>
269

    
270
        <target name="build-all-DebugOff"
271
                description="
272
                        Global build for the whole gvSIG.
273
                        Compiles all the sources and builds the application so that it's ready to execute.
274
                        Do not generate debug info in complilation.
275
        ">
276
                <antcall target="build-all-projects">
277
                        <param name="debug" value="off"/>
278
                        <param name="debuglevel" value=""/>
279
                </antcall>
280
        </target>
281

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

    
294
        <target name="build-all-JS1.5_JT1.4-DebugOff"
295
                description="
296
                        Global build for the whole gvSIG.
297
                        Compiles all the sources and builds the application so that it's ready to execute.
298
                        Source Java 1.5 and Target Java 1.4.
299
                        Do not generate debug info in complilation.
300
        ">
301
                <antcall target="build-all-projects">
302
                        <param name="JavaSourceVersion" value="1.5"/>
303
                        <param name="JavaTargetVersion" value="jsr14"/>
304
                        <param name="debug" value="off"/>
305
                        <param name="debuglevel" value=""/>
306
                </antcall>
307
        </target>
308

    
309

    
310
        <target name="build-all-projects"
311
                        description="Builds the application, excluding extensions">
312
                <property file="build.number"/>
313
                <foreach list="${gvSIG_projects}" trim="true" delimiter="," target="batch-build-project" param="bb-project.name"/>
314
        </target>
315

    
316
        <target name="clean-all"
317
                                depends="clean_andami_gvSIGdir,clean-all-projects"
318
                                description="clean up application and projets" />
319

    
320
        <target name="clean-all-projects"
321
                description="cleans the base components of gvSIG: appgvSIG + libs">
322
                <!-- Delete the ${build} and ${dist} directory trees -->
323
                <foreach list="${gvSIG_projects}"  trim="true" delimiter="," target="clean-project" param="c-project.name"/>
324
        </target>
325

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

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

    
335
        <target name="update-all-classpath-files"
336
                                description="Updates the timestamp of all projects.
337
                                        This force eclipse to update jar missing errors.">
338
                <foreach list="${gvSIG_projects}" trim="true"  delimiter="," target="update-proyect-classpath-file" param="u-cp-project.name"/>
339
        </target>
340

    
341

    
342

    
343
        <!-- utility targets -->
344

    
345

    
346
        <target name="buildNumber"
347
                                description="Generates the build.number for the application">
348
                <propertyfile
349
                                file="build.number"
350
                                comment="Build Number for ANT. Do not edit!">
351
                        <entry  key="build.number" default="0" type="int" operation="+" pattern="0000"/>
352
                </propertyfile>
353
        </target>
354

    
355
        <target name="install-project">
356
                <property name="i-project.dir" location="../${i-project.name}"/>
357
                <if>
358
                        <available file="${i-project.dir}" type="dir"/>
359
                        <then>
360
                                <echo>
361
                                        Install ${i-project.name}
362
                                </echo>
363
                                <ant dir="${i-project.dir}" inheritAll="false">
364
                                        <property name="buildNumberFile" location="build.number"/>
365
                                </ant>
366
                        </then>
367
                        <else>
368
                                <if>
369
                                        <contains string="${mandatoryProjets}" substring="${i-project.name}"/>
370
                                        <then>
371
                                                <fail message="The required project is missing for Install: ${i-project.name}"/>
372
                                        </then>
373
                                        <else>
374
                                                <echo>
375
                                                        Skip ${i-project.name} project from Intall
376
                                                </echo>
377
                                        </else>
378
                                </if>
379
                        </else>
380
                </if>
381
        </target>
382

    
383

    
384
        <target name="clean-project">
385
                <property name="c-project.dir" location="../${c-project.name}"/>
386
                <if>
387
                        <available file="${c-project.dir}" type="dir"/>
388
                        <then>
389
                                <echo>
390
                                        Clean ${c-project.name}
391
                                </echo>
392
                                <ant dir="${c-project.dir}" target="clean" inheritAll="false"/>
393
                        </then>
394
                        <else>
395
                                <if>
396
                                        <contains string="${mandatoryProjets}" substring="${c-project.name}"/>
397
                                        <then>
398
                                                <fail message="The required project is missing for Clean: ${c-project.name}"/>
399
                                        </then>
400
                                        <else>
401
                                                <echo>
402
                                                        Skip ${c-project.name} project from Clean
403
                                                </echo>
404
                                        </else>
405
                                </if>
406
                        </else>
407
                </if>
408
        </target>
409

    
410
        <target name="batch-build-project">
411
                <property name="bb-project.dir" location="../${bb-project.name}"/>
412
                <if>
413
                        <available file="${bb-project.dir}" type="dir"/>
414
                        <then>
415
                                <echo>
416
                                        Batch-build ${bb-project.name}
417
                                </echo>
418
                                <ant dir="${bb-project.dir}" target="batch-build" inheritAll="false">
419
                                        <property name="debug" value="${debug}"/>
420
                                        <property name="debuglevel" value="${debuglevel}"/>
421
                                        <property name="encoding" value="${encoding}"/>
422
                                        <property name="JavaSourceVersion" value="${JavaSourceVersion}"/>
423
                                        <property name="JavaTargetVersion" value="${JavaTargetVersion}"/>
424
                                        <property name="buildNumberFile" location="build.number"/>
425
                                </ant>
426
                        </then>
427
                        <else>
428
                                <if>
429
                                        <contains string="${mandatoryProjets}" substring="${bb-project.name}"/>
430
                                        <then>
431
                                                <fail message="The required project is missing for Batch build: ${bb-extension.name}"/>
432
                                        </then>
433
                                        <else>
434
                                                <echo>
435
                                                        Skip ${bb-project.name} project from Batch build
436
                                                </echo>
437
                                        </else>
438
                                </if>
439
                        </else>
440
                </if>
441
        </target>
442

    
443
        <target name="update-proyect-classpath-file">
444
                <property name="u-cp-project.dir" location="../${u-cp-project.name}"/>
445
                <if>
446
                        <available file="${u-cp-project.dir}" type="dir"/>
447
                        <then>
448
                                <if>
449
                                        <available file="${u-cp-project.dir}/.classpath" type="file"/>
450
                                        <then>
451
                                                <touch file="${u-cp-project.dir}/.classpath"/>
452
                                                <echo>
453
                                                        Update classpath file of ${u-cp-project.name}
454
                                                </echo>
455
                                        </then>
456
                                </if>
457
                        </then>
458
                        <else>
459
                                <if>
460
                                        <contains string="${mandatoryProjets}" substring="${u-cp-project.name}"/>
461
                                        <then>
462
                                                <if>
463
                                                        <available file="${u-cp-project.dir}/.classpath" type="file"/>
464
                                                        <then>
465
                                                                <fail message="The required project is missing for Update classpath file: ${u-cp-project.name}"/>
466
                                                        </then>
467
                                                </if>
468
                                        </then>
469
                                        <else>
470
                                                <echo>
471
                                                        Skip ${u-cp-project.name} project from Update classpath file
472
                                                </echo>
473
                                        </else>
474
                                </if>
475
                        </else>
476
                </if>
477
        </target>
478

    
479
        <target name="run-one-test">
480
                <property name="target.project.dir" location="../${target.project.name}"/>
481
                <if>
482
                        <available file="${target.project.dir}" type="dir"/>
483
                        <then>
484
                                <echo>
485
                                        Running tests: ${target.project.dir}
486
                                </echo>
487
                                <trycatch property="AnErrorHappened">
488
                                        <try>
489
                                                <ant dir="${target.project.dir}"
490
                                                        target="run-tests"
491
                                                        inheritAll="false">
492
                                                        <property name="JUnitProjectResults" value="${JUnitProjectResults}"/>
493
                                                        <property name="JUnitProjectResultsFile" value="${JUnitProjectResultsFile}"/>
494
                                                        <property name="JUnitGlobalResults" value="${JUnitGlobalResults}"/>
495
                                                        <property name="JUnitGlobalResultsFile" value="${JUnitGlobalResultsFile}"/>
496
                                                        <property name="JUnitSummaryFile" value="${JUnitSummaryFile}"/>
497
                                                        <property name="buildNumberFile" location="${buildNumberFile}"/>
498
                                                </ant>
499
                                        </try>
500
                                        <catch>
501
                                                <echo        level="error"
502
                                                                append="true"
503
                                                                file="${FlagTestError}">${target.project.name}: ${AnErrorHappened}</echo>
504
                                                <echo level="error">${target.project.name}: ${AnErrorHappened}</echo>
505
                                                <echo append="true" file="${JUnitGlobalResultsFile}">JUnitTests for ${target.project.name}: FAILED.${line.separator}</echo>
506
                                                <echo append="true" file="${target.project.dir}/${JUnitProjectResultsFile}">${AnErrorHappened}</echo>
507
                                        </catch>
508
                                </trycatch>
509
                        </then>
510
                        <else>
511
                                <echo>
512
                                        Skip ${target.project.dir} project from RunTests
513
                                </echo>
514
                                <echo append="true" file="${JUnitGlobalResultsFile}">JUnitTests for ${target.project.name}: SKIPPED.${line.separator}</echo>
515
                        </else>
516
                </if>
517
        </target>
518

    
519
        <target name="run-all-tests">
520
                <delete file="${FlagTestError}" />
521
                <move         file="${JUnitGlobalResultsFile}"
522
                                tofile="${JUnitGlobalResults}.old"
523
                                failonerror="false" />
524
                <property name="buildNumberFile" location="build.number"/>
525
                <foreach        list="${gvSIG_projects}"
526
                                        delimiter=","
527
                                          trim="true"
528
                                        target="run-one-test"
529
                                        param="target.project.name">
530
                                        <param name="buildNumberFile" location="${buildNumberFile}"/>
531
                </foreach>
532

    
533
                <foreach         list="${gvSIG_projects}"
534
                                          trim="true"
535
                                        delimiter=","
536
                                        target="concat-test-output"
537
                                        param="target.project.name" />
538

    
539
                <if>
540
                        <available file="${FlagTestError}" type="file"/>
541
                        <then>
542
                                <echo file="${JUnitGlobalResultsFile}.tmp"> === Global JUnit Results: FAILURE.${line.separator}${line.separator}</echo>
543
                                <concat  destfile="${JUnitGlobalResultsFile}.tmp2"
544
                                                binary="true">
545
                                        <fileset file="${JUnitGlobalResultsFile}.tmp"/>
546
                                        <fileset file="${JUnitGlobalResultsFile}"/>
547
                                </concat>
548
                                <move file="${JUnitGlobalResultsFile}.tmp2" tofile="${JUnitGlobalResultsFile}"/>
549
                                <delete file="${JUnitGlobalResultsFile}.tmp"/>
550
                                <echo level="error">JUnitTests: FAILURE.
551
                                        See ${JUnitGlobalResultsFile} file for details.
552
                                </echo>
553
                        </then>
554
                        <else>
555
                                <echo file="${JUnitGlobalResultsFile}.tmp"> === Global JUnit Results: SUCCESS.${line.separator}${line.separator}</echo>
556
                                <concat  destfile="${JUnitGlobalResultsFile}.tmp2"
557
                                                binary="true">
558
                                        <fileset file="${JUnitGlobalResultsFile}.tmp"/>
559
                                        <fileset file="${JUnitGlobalResultsFile}"/>
560
                                </concat>
561
                                <move file="${JUnitGlobalResultsFile}.tmp2" tofile="${JUnitGlobalResultsFile}"/>
562
                                <delete file="${22JUnitGlobalResultsFile}.tmp"/>
563
                                <echo>JUnitTests: SUCCESS.
564
                                                See ${JUnitGlobalResultsFile} file for details.
565
                                </echo>
566
                        </else>
567
                </if>
568
                <delete file="${FlagTestError}" />
569
        </target>
570

    
571
</project>
572