Statistics
| Revision:

root / tags / tmp_build / applications / appgvSIG / build.xml @ 24222

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
                extSymbology,
54
                extRasterTools-SE,
55
                extAddEventTheme,
56
                appCatalogAndGazetteerClient,
57
                extCatalogAndGazetteer,
58
                extDataLocator,
59
                extJDBC,
60
                extCAD,
61
                extGeoProcessing,
62
                extGeoprocessingExtensions,
63
                extGeoreferencing,
64
                extOracleSpatial,
65
                extSDE,
66
                extScripting,
67
                extAnnotations,
68
                extExpressionField,
69
                extWCS,
70
                extWFS2,
71
                extWMS,
72
                extCenterViewToPoint,
73
                extRemoteSensing,
74
                extHelp,
75
                extIconThemeBase,
76
                lib3DMap,
77
                ext3Dgui,
78
                binaries
79
        "/>
80

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

    
89
        <property name="global.installBaseDir" location="${andami}"/>
90

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

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

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

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

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

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

    
131
        </target>
132

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

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

    
152
        </target>
153

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

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

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

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

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

    
191
        <!--
192
                ============================================
193
                Targets for global build
194
                ============================================
195
        -->
196

    
197
        <!-- Public Targets -->
198
        <!-- Comment to use it with debug on
199
        <target name="make-binary-distribution"
200
            description="
201
                                Prepare for do a binary distribution of the application.
202
                                This increments the build number and then makes a global build"
203
            depends="clean-all,buildNumber,build-all-DebugOff">
204
    </target>
205
    -->
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">
211
    </target>
212

    
213
        <target name="make-binary-distribution-JS1.5_JT1.4"
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
                        Source Java 1.5 and Target Java 1.4"
218
            depends="clean-all,buildNumber,build-all-JS1.5_JT1.4-DebugOff">
219
    </target>
220

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

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

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

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

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

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

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

    
291

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

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

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

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

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

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

    
323

    
324

    
325
        <!-- utility targets -->
326

    
327

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

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

    
365

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

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

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

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

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

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

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

    
553
</project>
554