Statistics
| Revision:

svn-gvsig-desktop / tags / v1_9_Build_1230 / applications / appgvSIG / build.xml @ 39398

History | View | Annotate | Download (17.4 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
                binaries
92
        "/>
93

    
94
        <property name="mandatoryProjets" value="
95
                _fwAndami,
96
                libCorePlugin,
97
                libFMap,
98
                appgvSIG,
99
                extJCRS
100
        "/>
101

    
102
        <property name="global.installBaseDir" location="${andami}"/>
103

    
104
        <property name="JUnitProjectResults" value="JUnitProjectResults"/>
105
        <property name="JUnitProjectResultsFile" value="JUnitProjectResults.txt"/>
106
        <property name="JUnitGlobalResults" location="JUnitGlobalResults"/>
107
        <property name="JUnitGlobalResultsFile" location="JUnitGlobalResults.txt"/>
108
        <property name="JUnitSummaryFile" location="JUnitGlobalResults.txt"/>
109
        <property name="FlagTestError" location="JUnitFlagError"/>
110

    
111
        <!--
112
                ============================================
113
                Targets for build of the appgvSIG project
114
                ============================================
115
        -->
116

    
117
        <target name="init">
118
                <!-- Create the time stamp -->
119
                <tstamp/>
120
                <echo>
121
                        Compiling ${ant.project.name}...</echo>
122

    
123
                <property file="build.number"/>
124
                <!-- Creamos un fichero con el timeStamp para que lo lea el FPanelAbout -->
125
                <!-- <buildnumber/> -->
126
        </target>
127

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

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

    
144
        </target>
145

    
146
        <target name="create-jar" description="Creates the jar file">
147
                <mkdir dir="${dist}/lib"/>
148
                <jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}"/>
149
        </target>
150

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

    
165
        </target>
166

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

    
172
        <target name="copy-data-files">
173
        <copy todir="${dist}">
174
                <fileset dir="config" includes="*" />
175
        </copy>
176
                <copy file="build.number" todir="${dist}"/>
177
                <copy todir="${dist}/images">
178
                        <fileset dir="images/" includes="*"/>
179
                </copy>
180
                <copy todir="${dist}/northimages">
181
                        <fileset dir="northimages/" includes="*"/>
182
                </copy>
183
    </target>
184

    
185
        <target name="move-to-andami" description="Moves the build directory to andami">
186
                <move todir="${extensionDir}/${plugin}/">
187
                        <fileset dir="${dist}" includes="**/**"/>
188
                </move>
189
        </target>
190

    
191
        <target name="clean"
192
                        description="clean up" >
193
                <!-- Delete the ${build} and ${dist} directory trees -->
194
                <delete dir="${build}"/>
195
                <!--<delete dir="${dist}"/> -->
196
        </target>
197

    
198
        <target name="run-tests" depends="batch-build,compile-tests">
199
                <antcall target="generic-run-tests">
200
                        <param name="TestSuite.Name" value="com.iver.cit.gvsig.AllTests"/>
201
                </antcall>
202
        </target>
203

    
204
        <!--
205
                ============================================
206
                Targets for global build
207
                ============================================
208
        -->
209

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

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

    
234
        <target name="make-binary-distribution-test"
235
            description="
236
                        Prepare for a binary distribution of the application
237
                        without increments the global build number"
238
            depends="clean-all,build-all-DebugOff">
239
    </target>
240

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

    
249
    <target name="clean_andami_gvSIGdir"
250
            description="clean up the gvSIG andami deploy">
251
        <delete dir="${andami}/gvSIG" failonerror="false"/>
252
    </target>
253

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

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

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

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

    
304

    
305
        <target name="build-all-projects"
306
                        description="Builds the application, excluding extensions">
307
                <property file="build.number"/>
308
                <foreach list="${gvSIG_projects}" trim="true" delimiter="," target="batch-build-project" param="bb-project.name"/>
309
        </target>
310

    
311
        <target name="clean-all"
312
                                depends="clean_andami_gvSIGdir,clean-all-projects"
313
                                description="clean up application and projets" />
314

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

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

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

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

    
336

    
337

    
338
        <!-- utility targets -->
339

    
340

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

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

    
378

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

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

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

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

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

    
528
                <foreach         list="${gvSIG_projects}"
529
                                          trim="true"
530
                                        delimiter=","
531
                                        target="concat-test-output"
532
                                        param="target.project.name" />
533

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

    
566
</project>
567