Statistics
| Revision:

svn-gvsig-desktop / tags / v1_9_Build_1222 / applications / appgvSIG / build.xml @ 41290

History | View | Annotate | Download (17.3 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
                appgvSIG,
49
                libJCRS,
50
                extJCRS,
51
                libTopology,
52
                libDwg,
53
                extDwg,
54
                libCacheService,
55
                extSymbology,
56
                extRasterTools-SE,
57
                extAddEventTheme,
58
                appCatalogAndGazetteerClient,
59
                extCatalogAndGazetteer,
60
                extDataLocator,
61
                extJDBC,
62
                extCAD,
63
                extGeoProcessing,
64
                extGeoprocessingExtensions,
65
                extGeoreferencing,
66
                extTopology,
67
                extOracleSpatial,
68
                extSDE,
69
                extScripting,
70
                extAnnotations,
71
                extExpressionField,
72
                extWCS,
73
                extWFS2,
74
                extWMS,
75
                extCenterViewToPoint,
76
                libArcIMS,
77
                extArcims,
78
                extRemoteSensing,
79
                extGraph,
80
                extHelp,
81
                extIconThemeBase,
82
                lib3DMap,
83
                ext3Dgui,
84
                extSextanteGvsigBindings,
85
                binaries
86
        "/>
87

    
88
        <property name="mandatoryProjets" value="
89
                _fwAndami,
90
                libCorePlugin,
91
                libFMap,
92
                appgvSIG,
93
                extJCRS
94
        "/>
95

    
96
        <property name="global.installBaseDir" location="${andami}"/>
97

    
98
        <property name="JUnitProjectResults" value="JUnitProjectResults"/>
99
        <property name="JUnitProjectResultsFile" value="JUnitProjectResults.txt"/>
100
        <property name="JUnitGlobalResults" location="JUnitGlobalResults"/>
101
        <property name="JUnitGlobalResultsFile" location="JUnitGlobalResults.txt"/>
102
        <property name="JUnitSummaryFile" location="JUnitGlobalResults.txt"/>
103
        <property name="FlagTestError" location="JUnitFlagError"/>
104

    
105
        <!--
106
                ============================================
107
                Targets for build of the appgvSIG project
108
                ============================================
109
        -->
110

    
111
        <target name="init">
112
                <!-- Create the time stamp -->
113
                <tstamp/>
114
                <echo>
115
                        Compiling ${ant.project.name}...</echo>
116

    
117
                <property file="build.number"/>
118
                <!-- Creamos un fichero con el timeStamp para que lo lea el FPanelAbout -->
119
                <!-- <buildnumber/> -->
120
        </target>
121

    
122
        <target name="dist"
123
                                depends="init,create-jar,copy-libs,copy-data-files,move-to-andami"
124
                                description="Generate the distribution of the gvSIG plugin. To build just the appgvSIG project from Eclipse " >
125
                <!-- Create the distribution directory -->
126
        </target>
127

    
128
        <target name="compile" description="compile the source">
129
                <!-- Create the time stamp -->
130
                <tstamp/>
131
                <!-- Create the build directory structure used by compile -->
132
                <mkdir dir="${build}"/>
133
                <!-- Compile the Java code from ${src} to ${build} -->
134
                <loadEclipseClasspath project="${basedir}"/>
135
                <gvSIG-javac
136
                        classpath="${eclipseClasspath}"/>
137

    
138
        </target>
139

    
140
        <target name="create-jar" description="Creates the jar file">
141
                <mkdir dir="${dist}/lib"/>
142
                <jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}"/>
143
        </target>
144

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

    
159
        </target>
160

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

    
166
        <target name="copy-data-files">
167
        <copy todir="${dist}">
168
                <fileset dir="config" includes="*" />
169
        </copy>
170
                <copy file="build.number" todir="${dist}"/>
171
                <copy todir="${dist}/images">
172
                        <fileset dir="images/" includes="*"/>
173
                </copy>
174
                <copy todir="${dist}/northimages">
175
                        <fileset dir="northimages/" includes="*"/>
176
                </copy>
177
    </target>
178

    
179
        <target name="move-to-andami" description="Moves the build directory to andami">
180
                <move todir="${extensionDir}/${plugin}/">
181
                        <fileset dir="${dist}" includes="**/**"/>
182
                </move>
183
        </target>
184

    
185
        <target name="clean"
186
                        description="clean up" >
187
                <!-- Delete the ${build} and ${dist} directory trees -->
188
                <delete dir="${build}"/>
189
                <!--<delete dir="${dist}"/> -->
190
        </target>
191

    
192
        <target name="run-tests" depends="batch-build,compile-tests">
193
                <antcall target="generic-run-tests">
194
                        <param name="TestSuite.Name" value="com.iver.cit.gvsig.AllTests"/>
195
                </antcall>
196
        </target>
197

    
198
        <!--
199
                ============================================
200
                Targets for global build
201
                ============================================
202
        -->
203

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

    
220
        <target name="make-binary-distribution-JS1.5_JT1.4"
221
            description="
222
                        Prepare for do a binary distribution of the application.
223
                        This increments the build number and then makes a global build.
224
                        Source Java 1.5 and Target Java 1.4"
225
            depends="clean-all,buildNumber,build-all-JS1.5_JT1.4-DebugOff">
226
    </target>
227

    
228
        <target name="make-binary-distribution-test"
229
            description="
230
                        Prepare for a binary distribution of the application
231
                        without increments the global build number"
232
            depends="clean-all,build-all-DebugOff">
233
    </target>
234

    
235
        <target name="make-binary-distribution-JS1.5_JT1.4-test"
236
            description="
237
                        Prepare for a binary distribution of the application
238
                        without increments the global build number.
239
                        Source Java 1.5 and Target Java 1.4"
240
            depends="clean-all,build-all-JS1.5_JT1.4-DebugOff">
241
    </target>
242

    
243
    <target name="clean_andami_gvSIGdir"
244
            description="clean up the gvSIG andami deploy">
245
        <delete dir="${andami}/gvSIG" failonerror="false"/>
246
    </target>
247

    
248
        <target name="build-all"
249
                description="
250
                        Global build for the whole gvSIG.
251
                        Compiles all the sources and builds the application so that it's ready to execute
252
        ">
253
                <antcall target="build-all-projects">
254
                        <param name="debug" value="on"/>
255
                        <param name="debuglevel" value="lines, vars"/>
256
                </antcall>
257
        </target>
258

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

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

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

    
298

    
299
        <target name="build-all-projects"
300
                        description="Builds the application, excluding extensions">
301
                <property file="build.number"/>
302
                <foreach list="${gvSIG_projects}" trim="true" delimiter="," target="batch-build-project" param="bb-project.name"/>
303
        </target>
304

    
305
        <target name="clean-all"
306
                                depends="clean_andami_gvSIGdir,clean-all-projects"
307
                                description="clean up application and projets" />
308

    
309
        <target name="clean-all-projects"
310
                description="cleans the base components of gvSIG: appgvSIG + libs">
311
                <!-- Delete the ${build} and ${dist} directory trees -->
312
                <foreach list="${gvSIG_projects}"  trim="true" delimiter="," target="clean-project" param="c-project.name"/>
313
        </target>
314

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

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

    
324
        <target name="update-all-classpath-files"
325
                                description="Updates the timestamp of all projects.
326
                                        This force eclipse to update jar missing errors.">
327
                <foreach list="${gvSIG_projects}" trim="true"  delimiter="," target="update-proyect-classpath-file" param="u-cp-project.name"/>
328
        </target>
329

    
330

    
331

    
332
        <!-- utility targets -->
333

    
334

    
335
        <target name="buildNumber"
336
                                description="Generates the build.number for the application">
337
                <propertyfile
338
                                file="build.number"
339
                                comment="Build Number for ANT. Do not edit!">
340
                        <entry  key="build.number" default="0" type="int" operation="+" pattern="0000"/>
341
                </propertyfile>
342
        </target>
343

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

    
372

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

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

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

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

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

    
522
                <foreach         list="${gvSIG_projects}"
523
                                          trim="true"
524
                                        delimiter=","
525
                                        target="concat-test-output"
526
                                        param="target.project.name" />
527

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

    
560
</project>
561