Statistics
| Revision:

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

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
                binaries
96
        "/>
97

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

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

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

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

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

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

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

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

    
148
        </target>
149

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

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

    
169
        </target>
170

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
308

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

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

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

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

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

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

    
340

    
341

    
342
        <!-- utility targets -->
343

    
344

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

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

    
382

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

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

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

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

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

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

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

    
570
</project>
571