Statistics
| Revision:

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

History | View | Annotate | Download (17.1 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
                libInternationalization,
35
                libIverUtiles,
36
                libUIComponent,
37
                libExceptions,
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
        </target>
250

    
251
        <target name="build-all-DebugOff"
252
                description="
253
                        Global build for the whole gvSIG.
254
                        Compiles all the sources and builds the application so that it's ready to execute.
255
                        Do not generate debug info in complilation.
256
        ">
257
                <antcall target="build-all-projects">
258
                        <param name="debug" value="off"/>
259
                        <param name="debuglevel" value=""/>
260
                </antcall>
261
        </target>
262

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

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

    
290

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

    
297
        <target name="clean-all"
298
                                depends="clean_andami_gvSIGdir,clean-all-projects"
299
                                description="clean up application and projets" />
300

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

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

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

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

    
322

    
323

    
324
        <!-- utility targets -->
325

    
326

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

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

    
364

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

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

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

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

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

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

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

    
552
</project>
553