Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / build.xml @ 34522

History | View | Annotate | Download (17.9 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="andami" location="../_fwAndami"/>
23
        <property name="extensionDir" location="${andami}/gvSIG/extensiones"/>
24
        <property name="andamiLibs" value="${andami}/lib"/>
25
        <property name="fmapLibs"   location="${fmapdir}/lib"/>
26
        <property name="andamiJar"  value="${andami}/andami.jar"/>
27

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

    
34
        <property name="gvSIG_projects" value="
35
                libExceptions,
36
                libInternationalization,
37
                libIverUtiles,
38
                libUIComponent,
39
                _fwAndami,
40
                libCorePlugin,
41
                extDockingSkin,
42
                libProjection,
43
                libRaster,
44
                libDXF,
45
                libDriverManager,
46
                libRemoteServices,
47
                libGDBMS,
48
                libFMap,
49
                libGPE,
50
                libGPE-XML,
51
                libGPE-GML,
52
                libGPE-KML,
53
                appgvSIG,
54
                libJCRS,
55
                extJCRS,
56
                libTopology,
57
                libDwg,
58
                extDwg,
59
                libCacheService,
60
                extSymbology,
61
                extRasterTools-SE,
62
                extAddEventTheme,
63
                extJDBC,
64
                extCAD,
65
                extGPE-gvSIG,
66
                appCatalogAndGazetteerClient,
67
                extCatalogAndGazetteer,
68
                extDataLocator,
69
                extGeoProcessing,
70
                extGeoprocessingExtensions,
71
                extGeoreferencing,
72
                extTopology,
73
                extOracleSpatial,
74
                extSDE,
75
                extScripting,
76
                extAnnotations,
77
                extExpressionField,
78
                extWCS,
79
                extWFS2,
80
                extWMS,
81
                extCenterViewToPoint,
82
                libArcIMS,
83
                extArcims,
84
                extRemoteSensing,
85
                extGraph,
86
                extHelp,
87
                extIconThemeBase,
88
                lib3DMap,
89
                ext3Dgui,
90
                extSextanteGvsigBindings,
91
                extTableSummarize,
92
                extSelectionTools,
93
                extProjectBackup,
94
                extQuickInfo,
95
                extDerivedGeometries,
96
                extHyperlink,
97
                extI18n,
98
                extQuickPrint,
99
                extLayerLoadingOrder,
100
                extTableImport,
101
                extTableExport,
102
                org.gvsig.installer.app.extension,
103
                binaries
104
        "/>
105

    
106
        <property name="mandatoryProjets" value="
107
                _fwAndami,
108
                libCorePlugin,
109
                libFMap,
110
                appgvSIG,
111
                extJCRS,
112
                org.gvsig.installer.app.extension
113
        "/>
114

    
115
        <property name="global.installBaseDir" location="${andami}"/>
116

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

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

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

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

    
141
        <target name="dist"
142
                                depends="init,create-jar,copy-libs,copy-data-files,move-to-andami"
143
                                description="Generate the distribution of the gvSIG plugin. To build just the appgvSIG project from Eclipse " >
144
                <!-- Create the distribution directory -->
145
        </target>
146

    
147
        <target name="compile" description="compile the source">
148
                <!-- Create the time stamp -->
149
                <tstamp/>
150
                <!-- Create the build directory structure used by compile -->
151
                <mkdir dir="${build}"/>
152
                <!-- Compile the Java code from ${src} to ${build} -->
153
                <loadEclipseClasspath project="${basedir}"/>
154
                <gvSIG-javac
155
                        classpath="${eclipseClasspath}"/>
156

    
157
        </target>
158

    
159
        <target name="create-jar" description="Creates the jar file">
160
                <mkdir dir="${dist}/lib"/>
161
                <jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}"/>
162
        </target>
163

    
164
        <target name="copy-libs">
165
                <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
166
                <copy todir="${dist}/lib">
167
                        <fileset dir="./lib" includes="*.jar,*.zip"/>
168
                </copy>
169
                <ant dir="../libFMap" target="batch-build" inheritAll="false">
170
                        <property name="debug" value="${debug}"/>
171
                        <property name="debuglevel" value="${debuglevel}"/>
172
                        <property name="encoding" value="ISO_8859_1"/>
173
                </ant>
174
                <copy todir="${dist}/lib">
175
                        <fileset dir="${fmapdir}/dist/lib/" includes="*.jar,*.zip"/>
176
                </copy>
177

    
178
        </target>
179

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

    
185
        <target name="copy-data-files">
186
        <copy todir="${dist}">
187
                <fileset dir="config" includes="*" />
188
        </copy>
189
                <copy file="build.number" todir="${dist}"/>
190
                <copy file="package.info" todir="${dist}"/>
191
                <copy todir="${dist}/images">
192
                        <fileset dir="images/" includes="*"/>
193
                </copy>
194
                <copy todir="${dist}/northimages">
195
                        <fileset dir="northimages/" includes="*"/>
196
                </copy>
197
    </target>
198

    
199
        <target name="move-to-andami" description="Moves the build directory to andami">
200
                <property file="build.number"/>
201
                <propertyfile file="package.info">
202
                        <entry  key="build" value="${build.number}"/>
203
                        <entry  key="buildNumber" value="${build.number}"/>
204
                </propertyfile>
205

    
206
                <move todir="${extensionDir}/${plugin}/">
207
                        <fileset dir="${dist}" includes="**/**"/>
208
                </move>
209
        </target>
210

    
211
        <target name="clean"
212
                        description="clean up" >
213
                <!-- Delete the ${build} and ${dist} directory trees -->
214
                <delete dir="${build}"/>
215
                <!--<delete dir="${dist}"/> -->
216
        </target>
217

    
218
        <target name="run-tests" depends="batch-build,compile-tests">
219
                <antcall target="generic-run-tests">
220
                        <param name="TestSuite.Name" value="com.iver.cit.gvsig.AllTests"/>
221
                </antcall>
222
        </target>
223

    
224
        <!--
225
                ============================================
226
                Targets for global build
227
                ============================================
228
        -->
229

    
230
        <!-- Public Targets -->
231
        <!-- Comment to use it with debug on
232
        <target name="make-binary-distribution"
233
            description="
234
                                Prepare for do a binary distribution of the application.
235
                                This increments the build number and then makes a global build"
236
            depends="clean-all,buildNumber,build-all-DebugOff">
237
    </target>
238
    -->
239
        <target name="make-binary-distribution"
240
            description="
241
                                Prepare for do a binary distribution of the application.
242
                                This increments the build number and then makes a global build"
243
            depends="clean-all,buildNumber,build-all">
244
    </target>
245

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

    
254
        <target name="make-binary-distribution-test"
255
            description="
256
                        Prepare for a binary distribution of the application
257
                        without increments the global build number"
258
            depends="clean-all,build-all-DebugOff">
259
    </target>
260

    
261
        <target name="make-binary-distribution-JS1.5_JT1.4-test"
262
            description="
263
                        Prepare for a binary distribution of the application
264
                        without increments the global build number.
265
                        Source Java 1.5 and Target Java 1.4"
266
            depends="clean-all,build-all-JS1.5_JT1.4-DebugOff">
267
    </target>
268

    
269
    <target name="clean_andami_gvSIGdir"
270
            description="clean up the gvSIG andami deploy">
271
        <delete dir="${andami}/gvSIG" failonerror="false"/>
272
    </target>
273

    
274
        <target name="build-all"
275
                description="
276
                        Global build for the whole gvSIG.
277
                        Compiles all the sources and builds the application so that it's ready to execute
278
        ">
279
                <antcall target="build-all-projects">
280
                        <param name="debug" value="on"/>
281
                        <param name="debuglevel" value="lines, vars, source"/>
282
                </antcall>
283
        </target>
284

    
285
        <target name="build-all-DebugOff"
286
                description="
287
                        Global build for the whole gvSIG.
288
                        Compiles all the sources and builds the application so that it's ready to execute.
289
                        Do not generate debug info in complilation.
290
        ">
291
                <antcall target="build-all-projects">
292
                        <param name="debug" value="off"/>
293
                        <param name="debuglevel" value=""/>
294
                </antcall>
295
        </target>
296

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

    
309
        <target name="build-all-JS1.5_JT1.4-DebugOff"
310
                description="
311
                        Global build for the whole gvSIG.
312
                        Compiles all the sources and builds the application so that it's ready to execute.
313
                        Source Java 1.5 and Target Java 1.4.
314
                        Do not generate debug info in complilation.
315
        ">
316
                <antcall target="build-all-projects">
317
                        <param name="JavaSourceVersion" value="1.5"/>
318
                        <param name="JavaTargetVersion" value="jsr14"/>
319
                        <param name="debug" value="off"/>
320
                        <param name="debuglevel" value=""/>
321
                </antcall>
322
        </target>
323

    
324

    
325
        <target name="build-all-projects"
326
                        description="Builds the application, excluding extensions">
327
                <property file="build.number"/>
328
                <foreach list="${gvSIG_projects}" trim="true" delimiter="," target="batch-build-project" param="bb-project.name"/>
329
        </target>
330

    
331
        <target name="clean-all"
332
                                depends="clean_andami_gvSIGdir,clean-all-projects"
333
                                description="clean up application and projets" />
334

    
335
        <target name="clean-all-projects"
336
                description="cleans the base components of gvSIG: appgvSIG + libs">
337
                <!-- Delete the ${build} and ${dist} directory trees -->
338
                <foreach list="${gvSIG_projects}"  trim="true" delimiter="," target="clean-project" param="c-project.name"/>
339
        </target>
340

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

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

    
350
        <target name="update-all-classpath-files"
351
                                description="Updates the timestamp of all projects.
352
                                        This force eclipse to update jar missing errors.">
353
                <foreach list="${gvSIG_projects}" trim="true"  delimiter="," target="update-proyect-classpath-file" param="u-cp-project.name"/>
354
        </target>
355

    
356

    
357

    
358
        <!-- utility targets -->
359

    
360

    
361
        <target name="buildNumber"
362
                                description="Generates the build.number for the application">
363
                <propertyfile
364
                                file="build.number"
365
                                comment="Build Number for ANT. Do not edit!">
366
                        <entry  key="build.number" default="0" type="int" operation="+" pattern="0000"/>
367
                </propertyfile>
368
        </target>
369

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

    
398

    
399
        <target name="clean-project">
400
                <property name="c-project.dir" location="../${c-project.name}"/>
401
                <if>
402
                        <available file="${c-project.dir}" type="dir"/>
403
                        <then>
404
                                <echo>
405
                                        Clean ${c-project.name}
406
                                </echo>
407
                                <ant dir="${c-project.dir}" target="clean" inheritAll="false"/>
408
                        </then>
409
                        <else>
410
                                <if>
411
                                        <contains string="${mandatoryProjets}" substring="${c-project.name}"/>
412
                                        <then>
413
                                                <fail message="The required project is missing for Clean: ${c-project.name}"/>
414
                                        </then>
415
                                        <else>
416
                                                <echo>
417
                                                        Skip ${c-project.name} project from Clean
418
                                                </echo>
419
                                        </else>
420
                                </if>
421
                        </else>
422
                </if>
423
        </target>
424

    
425
        <target name="batch-build-project">
426
                <property name="bb-project.dir" location="../${bb-project.name}"/>
427
                <if>
428
                        <available file="${bb-project.dir}" type="dir"/>
429
                        <then>
430
                                <echo>
431
                                        Batch-build ${bb-project.name}
432
                                </echo>
433
                                <ant dir="${bb-project.dir}" target="batch-build" inheritAll="false">
434
                                        <property name="debug" value="${debug}"/>
435
                                        <property name="debuglevel" value="${debuglevel}"/>
436
                                        <property name="encoding" value="${encoding}"/>
437
                                        <property name="JavaSourceVersion" value="${JavaSourceVersion}"/>
438
                                        <property name="JavaTargetVersion" value="${JavaTargetVersion}"/>
439
                                        <property name="buildNumberFile" location="build.number"/>
440
                                </ant>
441
                        </then>
442
                        <else>
443
                                <if>
444
                                        <contains string="${mandatoryProjets}" substring="${bb-project.name}"/>
445
                                        <then>
446
                                                <fail message="The required project is missing for Batch build: ${bb-extension.name}"/>
447
                                        </then>
448
                                        <else>
449
                                                <echo>
450
                                                        Skip ${bb-project.name} project from Batch build
451
                                                </echo>
452
                                        </else>
453
                                </if>
454
                        </else>
455
                </if>
456
        </target>
457

    
458
        <target name="update-proyect-classpath-file">
459
                <property name="u-cp-project.dir" location="../${u-cp-project.name}"/>
460
                <if>
461
                        <available file="${u-cp-project.dir}" type="dir"/>
462
                        <then>
463
                                <if>
464
                                        <available file="${u-cp-project.dir}/.classpath" type="file"/>
465
                                        <then>
466
                                                <touch file="${u-cp-project.dir}/.classpath"/>
467
                                                <echo>
468
                                                        Update classpath file of ${u-cp-project.name}
469
                                                </echo>
470
                                        </then>
471
                                </if>
472
                        </then>
473
                        <else>
474
                                <if>
475
                                        <contains string="${mandatoryProjets}" substring="${u-cp-project.name}"/>
476
                                        <then>
477
                                                <if>
478
                                                        <available file="${u-cp-project.dir}/.classpath" type="file"/>
479
                                                        <then>
480
                                                                <fail message="The required project is missing for Update classpath file: ${u-cp-project.name}"/>
481
                                                        </then>
482
                                                </if>
483
                                        </then>
484
                                        <else>
485
                                                <echo>
486
                                                        Skip ${u-cp-project.name} project from Update classpath file
487
                                                </echo>
488
                                        </else>
489
                                </if>
490
                        </else>
491
                </if>
492
        </target>
493

    
494
        <target name="run-one-test">
495
                <property name="target.project.dir" location="../${target.project.name}"/>
496
                <if>
497
                        <available file="${target.project.dir}" type="dir"/>
498
                        <then>
499
                                <echo>
500
                                        Running tests: ${target.project.dir}
501
                                </echo>
502
                                <trycatch property="AnErrorHappened">
503
                                        <try>
504
                                                <ant dir="${target.project.dir}"
505
                                                        target="run-tests"
506
                                                        inheritAll="false">
507
                                                        <property name="JUnitProjectResults" value="${JUnitProjectResults}"/>
508
                                                        <property name="JUnitProjectResultsFile" value="${JUnitProjectResultsFile}"/>
509
                                                        <property name="JUnitGlobalResults" value="${JUnitGlobalResults}"/>
510
                                                        <property name="JUnitGlobalResultsFile" value="${JUnitGlobalResultsFile}"/>
511
                                                        <property name="JUnitSummaryFile" value="${JUnitSummaryFile}"/>
512
                                                        <property name="buildNumberFile" location="${buildNumberFile}"/>
513
                                                </ant>
514
                                        </try>
515
                                        <catch>
516
                                                <echo        level="error"
517
                                                                append="true"
518
                                                                file="${FlagTestError}">${target.project.name}: ${AnErrorHappened}</echo>
519
                                                <echo level="error">${target.project.name}: ${AnErrorHappened}</echo>
520
                                                <echo append="true" file="${JUnitGlobalResultsFile}">JUnitTests for ${target.project.name}: FAILED.${line.separator}</echo>
521
                                                <echo append="true" file="${target.project.dir}/${JUnitProjectResultsFile}">${AnErrorHappened}</echo>
522
                                        </catch>
523
                                </trycatch>
524
                        </then>
525
                        <else>
526
                                <echo>
527
                                        Skip ${target.project.dir} project from RunTests
528
                                </echo>
529
                                <echo append="true" file="${JUnitGlobalResultsFile}">JUnitTests for ${target.project.name}: SKIPPED.${line.separator}</echo>
530
                        </else>
531
                </if>
532
        </target>
533

    
534
        <target name="run-all-tests">
535
                <delete file="${FlagTestError}" />
536
                <move         file="${JUnitGlobalResultsFile}"
537
                                tofile="${JUnitGlobalResults}.old"
538
                                failonerror="false" />
539
                <property name="buildNumberFile" location="build.number"/>
540
                <foreach        list="${gvSIG_projects}"
541
                                        delimiter=","
542
                                          trim="true"
543
                                        target="run-one-test"
544
                                        param="target.project.name">
545
                                        <param name="buildNumberFile" location="${buildNumberFile}"/>
546
                </foreach>
547

    
548
                <foreach         list="${gvSIG_projects}"
549
                                          trim="true"
550
                                        delimiter=","
551
                                        target="concat-test-output"
552
                                        param="target.project.name" />
553

    
554
                <if>
555
                        <available file="${FlagTestError}" type="file"/>
556
                        <then>
557
                                <echo file="${JUnitGlobalResultsFile}.tmp"> === Global JUnit Results: FAILURE.${line.separator}${line.separator}</echo>
558
                                <concat  destfile="${JUnitGlobalResultsFile}.tmp2"
559
                                                binary="true">
560
                                        <fileset file="${JUnitGlobalResultsFile}.tmp"/>
561
                                        <fileset file="${JUnitGlobalResultsFile}"/>
562
                                </concat>
563
                                <move file="${JUnitGlobalResultsFile}.tmp2" tofile="${JUnitGlobalResultsFile}"/>
564
                                <delete file="${JUnitGlobalResultsFile}.tmp"/>
565
                                <echo level="error">JUnitTests: FAILURE.
566
                                        See ${JUnitGlobalResultsFile} file for details.
567
                                </echo>
568
                        </then>
569
                        <else>
570
                                <echo file="${JUnitGlobalResultsFile}.tmp"> === Global JUnit Results: SUCCESS.${line.separator}${line.separator}</echo>
571
                                <concat  destfile="${JUnitGlobalResultsFile}.tmp2"
572
                                                binary="true">
573
                                        <fileset file="${JUnitGlobalResultsFile}.tmp"/>
574
                                        <fileset file="${JUnitGlobalResultsFile}"/>
575
                                </concat>
576
                                <move file="${JUnitGlobalResultsFile}.tmp2" tofile="${JUnitGlobalResultsFile}"/>
577
                                <delete file="${22JUnitGlobalResultsFile}.tmp"/>
578
                                <echo>JUnitTests: SUCCESS.
579
                                                See ${JUnitGlobalResultsFile} file for details.
580
                                </echo>
581
                        </else>
582
                </if>
583
                <delete file="${FlagTestError}" />
584
        </target>
585

    
586
</project>
587