Statistics
| Revision:

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

History | View | Annotate | Download (17.9 KB)

1
<project name="appgvSIG" default="dist" basedir=".">
2
    <description>
3
        gvSIG Main build
4
    </description>
5

    
6
        <import file="../binaries/ant/utilities.xml"/>
7

    
8
        <!--
9
                ============================================
10
                Properties for build of the appgvSIG project
11
                ============================================
12
        -->
13
        <property name="version" value="1.2 ${eclipse.startTime}"/>
14
        <property name="src" location="src"/>
15
        <property name="build" location="bin"/>
16
        <property name="src-test" location="src-test"/>
17
        <property name="build-test" location="bin-test"/>
18
        <property name="dist"  location="dist"/>
19
        <property name="lib"   location="lib"/>
20
        <property name="plugin" value="com.iver.cit.gvsig"/>
21
        <property name="fmapdir" value="../libFMap"/>
22
        <property name="andami" location="../_fwAndami"/>
23
        <property name="extensionDir" location="${andami}/gvSIG/extensiones"/>
24
        <property name="andamiLibs" value="${andami}/lib"/>
25
        <property name="fmapLibs"   location="${fmapdir}/lib"/>
26
        <property name="andamiJar"  value="${andami}/andami.jar"/>
27

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

    
34
        <property name="gvSIG_projects" value="
35
                libExceptions,
36
                libInternationalization,
37
                libIverUtiles,
38
                libUIComponent,
39
                libGeoUtils,
40
                _fwAndami,
41
                libCorePlugin,
42
                libProjection,
43
                libRaster,
44
                libDXF,
45
                libDriverManager,
46
                libRemoteServices,
47
                libGDBMS,
48
                libFMap,
49
                libGPE,
50
                libGPE-XML,
51
                libGPE-GML,
52
                libGPE-KML,
53
                appgvSIG,
54
                libJCRS,
55
                extJCRS,
56
                libTopology,
57
                libDwg,
58
                extDwg,
59
                extSymbology,
60
                extRasterTools-SE,
61
                extAddEventTheme,
62
                extJDBC,
63
                extCAD,
64
                extGPE-gvSIG,
65
                appCatalogAndGazetteerClient,
66
                extCatalogAndGazetteer,
67
                extDataLocator,
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
                extSextanteGvsigBindings,
88
                extTableSummarize,
89
                extSelectionTools,
90
                extProjectBackup,
91
                extQuickInfo,
92
                extDerivedGeometries,
93
                extHyperlink,
94
                extI18n,
95
                extQuickPrint,
96
                extLayerLoadingOrder,
97
                extTableImport,
98
                extTableExport,
99
                org.gvsig.installer.app.extension,
100
                binaries
101
        "/>
102

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

    
112
        <property name="global.installBaseDir" location="${andami}"/>
113

    
114
        <property name="JUnitProjectResults" value="JUnitProjectResults"/>
115
        <property name="JUnitProjectResultsFile" value="JUnitProjectResults.txt"/>
116
        <property name="JUnitGlobalResults" location="JUnitGlobalResults"/>
117
        <property name="JUnitGlobalResultsFile" location="JUnitGlobalResults.txt"/>
118
        <property name="JUnitSummaryFile" location="JUnitGlobalResults.txt"/>
119
        <property name="FlagTestError" location="JUnitFlagError"/>
120

    
121
        <!--
122
                ============================================
123
                Targets for build of the appgvSIG project
124
                ============================================
125
        -->
126

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

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

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

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

    
154
        </target>
155

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

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

    
175
        </target>
176

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

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

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

    
203
                <move todir="${extensionDir}/${plugin}/">
204
                        <fileset dir="${dist}" includes="**/**"/>
205
                </move>
206
        </target>
207

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

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

    
221
        <!--
222
                ============================================
223
                Targets for global build
224
                ============================================
225
        -->
226

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

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

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

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

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

    
271
        <target name="build-all"
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
        ">
276
                <antcall target="build-all-projects">
277
                        <param name="debug" value="on"/>
278
                        <param name="debuglevel" value="lines, vars, source"/>
279
                </antcall>
280
        </target>
281

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

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

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

    
321

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

    
328
        <target name="clean-all"
329
                                depends="clean_andami_gvSIGdir,clean-all-projects"
330
                                description="clean up application and projets" />
331

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

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

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

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

    
353

    
354

    
355
        <!-- utility targets -->
356

    
357

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

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

    
395

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

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

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

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

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

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

    
551
                <if>
552
                        <available file="${FlagTestError}" type="file"/>
553
                        <then>
554
                                <echo file="${JUnitGlobalResultsFile}.tmp"> === Global JUnit Results: FAILURE.${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="${JUnitGlobalResultsFile}.tmp"/>
562
                                <echo level="error">JUnitTests: FAILURE.
563
                                        See ${JUnitGlobalResultsFile} file for details.
564
                                </echo>
565
                        </then>
566
                        <else>
567
                                <echo file="${JUnitGlobalResultsFile}.tmp"> === Global JUnit Results: SUCCESS.${line.separator}${line.separator}</echo>
568
                                <concat  destfile="${JUnitGlobalResultsFile}.tmp2"
569
                                                binary="true">
570
                                        <fileset file="${JUnitGlobalResultsFile}.tmp"/>
571
                                        <fileset file="${JUnitGlobalResultsFile}"/>
572
                                </concat>
573
                                <move file="${JUnitGlobalResultsFile}.tmp2" tofile="${JUnitGlobalResultsFile}"/>
574
                                <delete file="${22JUnitGlobalResultsFile}.tmp"/>
575
                                <echo>JUnitTests: SUCCESS.
576
                                                See ${JUnitGlobalResultsFile} file for details.
577
                                </echo>
578
                        </else>
579
                </if>
580
                <delete file="${FlagTestError}" />
581
        </target>
582

    
583
</project>
584