Statistics
| Revision:

svn-gvsig-desktop / tags / v1_2_Build_1209 / applications / appgvSIG / build.xml @ 35988

History | View | Annotate | Download (17.2 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
                libProjection,
41
                libRaster,
42
                libDXF,
43
                libDriverManager,
44
                libRemoteServices,
45
                libGDBMS,
46
                libFMap,
47
                appgvSIG,
48
                libJCRS,
49
                extJCRS,
50
                libDwg,
51
                extDwg,
52
                libCacheService,
53
                extRasterTools-SE,
54
                extAddEventTheme,
55
                appCatalogAndGazetteerClient,
56
                extCatalogAndGazetteer,
57
                extDataLocator,
58
                extJDBC,
59
                extCAD,
60
                extGeoProcessing,
61
                extGeoprocessingExtensions,
62
                extGeoreferencing,
63
                extOracleSpatial,
64
                extSDE,
65
                extScripting,
66
                extAnnotations,
67
                extExpressionField,
68
                extWCS,
69
                extWFS2,
70
                extWMS,
71
                extCenterViewToPoint,
72
                libArcIMS,
73
                extArcims,
74
                extRemoteSensing,
75
                extGraph,
76
                extHelp,
77
                extIconThemeBase,
78
                lib3DMap,
79
                ext3Dgui,
80
                binaries
81
        "/>
82

    
83
        <property name="mandatoryProjets" value="
84
                _fwAndami,
85
                libCorePlugin,
86
                libFMap,
87
                appgvSIG,
88
                extJCRS
89
        "/>
90

    
91
        <property name="global.installBaseDir" location="${andami}"/>
92

    
93
        <property name="JUnitProjectResults" value="JUnitProjectResults"/>
94
        <property name="JUnitProjectResultsFile" value="JUnitProjectResults.txt"/>
95
        <property name="JUnitGlobalResults" location="JUnitGlobalResults"/>
96
        <property name="JUnitGlobalResultsFile" location="JUnitGlobalResults.txt"/>
97
        <property name="JUnitSummaryFile" location="JUnitGlobalResults.txt"/>
98
        <property name="FlagTestError" location="JUnitFlagError"/>
99

    
100
        <!--
101
                ============================================
102
                Targets for build of the appgvSIG project
103
                ============================================
104
        -->
105

    
106
        <target name="init">
107
                <!-- Create the time stamp -->
108
                <tstamp/>
109
                <echo>
110
                        Compiling ${ant.project.name}...</echo>
111

    
112
                <property file="build.number"/>
113
                <!-- Creamos un fichero con el timeStamp para que lo lea el FPanelAbout -->
114
                <!-- <buildnumber/> -->
115
        </target>
116

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

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

    
133
        </target>
134

    
135
        <target name="create-jar" description="Creates the jar file">
136
                <mkdir dir="${dist}/lib"/>
137
                <jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}"/>
138
        </target>
139

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

    
154
        </target>
155

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

    
161
        <target name="copy-data-files">
162
        <copy todir="${dist}">
163
                <fileset dir="config" includes="*" />
164
        </copy>
165
                <copy file="build.number" todir="${dist}"/>
166
                <copy todir="${dist}/images">
167
                        <fileset dir="images/" includes="*"/>
168
                </copy>
169
                <copy todir="${dist}/northimages">
170
                        <fileset dir="northimages/" includes="*"/>
171
                </copy>
172
    </target>
173

    
174
        <target name="move-to-andami" description="Moves the build directory to andami">
175
                <move todir="${extensionDir}/${plugin}/">
176
                        <fileset dir="${dist}" includes="**/**"/>
177
                </move>
178
        </target>
179

    
180
        <target name="clean"
181
                        description="clean up" >
182
                <!-- Delete the ${build} and ${dist} directory trees -->
183
                <delete dir="${build}"/>
184
                <!--<delete dir="${dist}"/> -->
185
        </target>
186

    
187
        <target name="run-tests" depends="batch-build,compile-tests">
188
                <antcall target="generic-run-tests">
189
                        <param name="TestSuite.Name" value="com.iver.cit.gvsig.AllTests"/>
190
                </antcall>
191
        </target>
192

    
193
        <!--
194
                ============================================
195
                Targets for global build
196
                ============================================
197
        -->
198

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

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

    
223
        <target name="make-binary-distribution-test"
224
            description="
225
                        Prepare for a binary distribution of the application
226
                        without increments the global build number"
227
            depends="clean-all,build-all-DebugOff">
228
    </target>
229

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

    
238
    <target name="clean_andami_gvSIGdir"
239
            description="clean up the gvSIG andami deploy">
240
        <delete dir="${andami}/gvSIG" failonerror="false"/>
241
    </target>
242

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

    
254
        <target name="build-all-DebugOff"
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
                        Do not generate debug info in complilation.
259
        ">
260
                <antcall target="build-all-projects">
261
                        <param name="debug" value="off"/>
262
                        <param name="debuglevel" value=""/>
263
                </antcall>
264
        </target>
265

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

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

    
293

    
294
        <target name="build-all-projects"
295
                        description="Builds the application, excluding extensions">
296
                <property file="build.number"/>
297
                <foreach list="${gvSIG_projects}" trim="true" delimiter="," target="batch-build-project" param="bb-project.name"/>
298
        </target>
299

    
300
        <target name="clean-all"
301
                                depends="clean_andami_gvSIGdir,clean-all-projects"
302
                                description="clean up application and projets" />
303

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

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

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

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

    
325

    
326

    
327
        <!-- utility targets -->
328

    
329

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

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

    
367

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

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

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

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

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

    
517
                <foreach         list="${gvSIG_projects}"
518
                                          trim="true"
519
                                        delimiter=","
520
                                        target="concat-test-output"
521
                                        param="target.project.name" />
522

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

    
555
</project>
556