Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / build.xml @ 15946

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

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

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

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

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

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

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

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

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

    
130
        </target>
131

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

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

    
151
        </target>
152

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

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

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

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

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

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

    
196
        <!-- Public Targets -->
197
        <target name="make-binary-distribution"
198
            description="
199
                                Prepare for do a binary distribution of the application.
200
                                This increments the build number and then makes a global build"
201
            depends="clean-all,buildNumber,build-all-DebugOff">
202
    </target>
203

    
204
        <target name="make-binary-distribution-JS1.5_JT1.4"
205
            description="
206
                        Prepare for do a binary distribution of the application.
207
                        This increments the build number and then makes a global build.
208
                        Source Java 1.5 and Target Java 1.4"
209
            depends="clean-all,buildNumber,build-all-JS1.5_JT1.4-DebugOff">
210
    </target>
211

    
212
        <target name="make-binary-distribution-test"
213
            description="
214
                        Prepare for a binary distribution of the application
215
                        without increments the global build number"
216
            depends="clean-all,build-all-DebugOff">
217
    </target>
218

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

    
227
    <target name="clean_andami_gvSIGdir"
228
            description="clean up the gvSIG andami deploy">
229
        <delete dir="${andami}/gvSIG" failonerror="false"/>
230
    </target>
231

    
232
        <target name="build-all"
233
                description="
234
                        Global build for the whole gvSIG.
235
                        Compiles all the sources and builds the application so that it's ready to execute
236
        ">
237
                <antcall target="build-all-projects"/>
238
        </target>
239

    
240
        <target name="build-all-DebugOff"
241
                description="
242
                        Global build for the whole gvSIG.
243
                        Compiles all the sources and builds the application so that it's ready to execute.
244
                        Do not generate debug info in complilation.
245
        ">
246
                <antcall target="build-all-projects">
247
                        <param name="debug" value="off"/>
248
                        <param name="debuglevel" value=""/>
249
                </antcall>
250
        </target>
251

    
252
        <target name="build-all-JS1.5_JT1.4"
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
                        Source Java 1.5 and Target Java 1.4
257
        ">
258
                <antcall target="build-all-projects">
259
                        <param name="JavaSourceVersion" value="1.5"/>
260
                        <param name="JavaTargetVersion" value="jsr14"/>
261
                </antcall>
262
        </target>
263

    
264
        <target name="build-all-JS1.5_JT1.4-DebugOff"
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
                        Do not generate debug info in complilation.
270
        ">
271
                <antcall target="build-all-projects">
272
                        <param name="JavaSourceVersion" value="1.5"/>
273
                        <param name="JavaTargetVersion" value="jsr14"/>
274
                        <param name="debug" value="off"/>
275
                        <param name="debuglevel" value=""/>
276
                </antcall>
277
        </target>
278

    
279

    
280
        <target name="build-all-projects"
281
                        description="Builds the application, excluding extensions">
282
                <property file="build.number"/>
283
                <foreach list="${gvSIG_projects}" trim="true" delimiter="," target="batch-build-project" param="bb-project.name"/>
284
        </target>
285

    
286
        <target name="clean-all"
287
                                depends="clean_andami_gvSIGdir,clean-all-projects"
288
                                description="clean up application and projets" />
289

    
290
        <target name="clean-all-projects"
291
                description="cleans the base components of gvSIG: appgvSIG + libs">
292
                <!-- Delete the ${build} and ${dist} directory trees -->
293
                <foreach list="${gvSIG_projects}"  trim="true" delimiter="," target="clean-project" param="c-project.name"/>
294
        </target>
295

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

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

    
305
        <target name="update-all-classpath-files"
306
                                description="Updates the timestamp of all projects.
307
                                        This force eclipse to update jar missing errors.">
308
                <foreach list="${gvSIG_projects}" trim="true"  delimiter="," target="update-proyect-classpath-file" param="u-cp-project.name"/>
309
        </target>
310

    
311

    
312

    
313
        <!-- utility targets -->
314

    
315

    
316
        <target name="buildNumber"
317
                                description="Generates the build.number for the application">
318
                <propertyfile
319
                                file="build.number"
320
                                comment="Build Number for ANT. Do not edit!">
321
                        <entry  key="build.number" default="0" type="int" operation="+" pattern="0000"/>
322
                </propertyfile>
323
        </target>
324

    
325
        <target name="install-project">
326
                <property name="i-project.dir" location="../${i-project.name}"/>
327
                <if>
328
                        <available file="${i-project.dir}" type="dir"/>
329
                        <then>
330
                                <echo>
331
                                        Install ${i-project.name}
332
                                </echo>
333
                                <ant dir="${i-project.dir}" inheritAll="false">
334
                                        <property name="buildNumberFile" location="build.number"/>
335
                                </ant>
336
                        </then>
337
                        <else>
338
                                <if>
339
                                        <contains string="${mandatoryProjets}" substring="${i-project.name}"/>
340
                                        <then>
341
                                                <fail message="The required project is missing for Install: ${i-project.name}"/>
342
                                        </then>
343
                                        <else>
344
                                                <echo>
345
                                                        Skip ${i-project.name} project from Intall
346
                                                </echo>
347
                                        </else>
348
                                </if>
349
                        </else>
350
                </if>
351
        </target>
352

    
353

    
354
        <target name="clean-project">
355
                <property name="c-project.dir" location="../${c-project.name}"/>
356
                <if>
357
                        <available file="${c-project.dir}" type="dir"/>
358
                        <then>
359
                                <echo>
360
                                        Clean ${c-project.name}
361
                                </echo>
362
                                <ant dir="${c-project.dir}" target="clean" inheritAll="false"/>
363
                        </then>
364
                        <else>
365
                                <if>
366
                                        <contains string="${mandatoryProjets}" substring="${c-project.name}"/>
367
                                        <then>
368
                                                <fail message="The required project is missing for Clean: ${c-project.name}"/>
369
                                        </then>
370
                                        <else>
371
                                                <echo>
372
                                                        Skip ${c-project.name} project from Clean
373
                                                </echo>
374
                                        </else>
375
                                </if>
376
                        </else>
377
                </if>
378
        </target>
379

    
380
        <target name="batch-build-project">
381
                <property name="bb-project.dir" location="../${bb-project.name}"/>
382
                <if>
383
                        <available file="${bb-project.dir}" type="dir"/>
384
                        <then>
385
                                <echo>
386
                                        Batch-build ${bb-project.name}
387
                                </echo>
388
                                <ant dir="${bb-project.dir}" target="batch-build" inheritAll="false">
389
                                        <property name="debug" value="${debug}"/>
390
                                        <property name="debuglevel" value="${debuglevel}"/>
391
                                        <property name="encoding" value="${encoding}"/>
392
                                        <property name="JavaSourceVersion" value="${JavaSourceVersion}"/>
393
                                        <property name="JavaTargetVersion" value="${JavaTargetVersion}"/>
394
                                        <property name="buildNumberFile" location="build.number"/>
395
                                </ant>
396
                        </then>
397
                        <else>
398
                                <if>
399
                                        <contains string="${mandatoryProjets}" substring="${bb-project.name}"/>
400
                                        <then>
401
                                                <fail message="The required project is missing for Batch build: ${bb-extension.name}"/>
402
                                        </then>
403
                                        <else>
404
                                                <echo>
405
                                                        Skip ${bb-project.name} project from Batch build
406
                                                </echo>
407
                                        </else>
408
                                </if>
409
                        </else>
410
                </if>
411
        </target>
412

    
413
        <target name="update-proyect-classpath-file">
414
                <property name="u-cp-project.dir" location="../${u-cp-project.name}"/>
415
                <if>
416
                        <available file="${u-cp-project.dir}" type="dir"/>
417
                        <then>
418
                                <if>
419
                                        <available file="${u-cp-project.dir}/.classpath" type="file"/>
420
                                        <then>
421
                                                <touch file="${u-cp-project.dir}/.classpath"/>
422
                                                <echo>
423
                                                        Update classpath file of ${u-cp-project.name}
424
                                                </echo>
425
                                        </then>
426
                                </if>
427
                        </then>
428
                        <else>
429
                                <if>
430
                                        <contains string="${mandatoryProjets}" substring="${u-cp-project.name}"/>
431
                                        <then>
432
                                                <if>
433
                                                        <available file="${u-cp-project.dir}/.classpath" type="file"/>
434
                                                        <then>
435
                                                                <fail message="The required project is missing for Update classpath file: ${u-cp-project.name}"/>
436
                                                        </then>
437
                                                </if>
438
                                        </then>
439
                                        <else>
440
                                                <echo>
441
                                                        Skip ${u-cp-project.name} project from Update classpath file
442
                                                </echo>
443
                                        </else>
444
                                </if>
445
                        </else>
446
                </if>
447
        </target>
448

    
449
        <target name="run-one-test">
450
                <property name="target.project.dir" location="../${target.project.name}"/>
451
                <if>
452
                        <available file="${target.project.dir}" type="dir"/>
453
                        <then>
454
                                <echo>
455
                                        Running tests: ${target.project.dir}
456
                                </echo>
457
                                <trycatch property="AnErrorHappened">
458
                                        <try>
459
                                                <ant dir="${target.project.dir}"
460
                                                        target="run-tests"
461
                                                        inheritAll="false">
462
                                                        <property name="JUnitProjectResults" value="${JUnitProjectResults}"/>
463
                                                        <property name="JUnitProjectResultsFile" value="${JUnitProjectResultsFile}"/>
464
                                                        <property name="JUnitGlobalResults" value="${JUnitGlobalResults}"/>
465
                                                        <property name="JUnitGlobalResultsFile" value="${JUnitGlobalResultsFile}"/>
466
                                                        <property name="JUnitSummaryFile" value="${JUnitSummaryFile}"/>
467
                                                        <property name="buildNumberFile" location="${buildNumberFile}"/>
468
                                                </ant>
469
                                        </try>
470
                                        <catch>
471
                                                <echo        level="error"
472
                                                                append="true"
473
                                                                file="${FlagTestError}">${target.project.name}: ${AnErrorHappened}</echo>
474
                                                <echo level="error">${target.project.name}: ${AnErrorHappened}</echo>
475
                                                <echo append="true" file="${JUnitGlobalResultsFile}">JUnitTests for ${target.project.name}: FAILED.${line.separator}</echo>
476
                                                <echo append="true" file="${target.project.dir}/${JUnitProjectResultsFile}">${AnErrorHappened}</echo>
477
                                        </catch>
478
                                </trycatch>
479
                        </then>
480
                        <else>
481
                                <echo>
482
                                        Skip ${target.project.dir} project from RunTests
483
                                </echo>
484
                                <echo append="true" file="${JUnitGlobalResultsFile}">JUnitTests for ${target.project.name}: SKIPPED.${line.separator}</echo>
485
                        </else>
486
                </if>
487
        </target>
488

    
489
        <target name="run-all-tests">
490
                <delete file="${FlagTestError}" />
491
                <move         file="${JUnitGlobalResultsFile}"
492
                                tofile="${JUnitGlobalResults}.old"
493
                                failonerror="false" />
494
                <property name="buildNumberFile" location="build.number"/>
495
                <foreach        list="${gvSIG_projects}"
496
                                        delimiter=","
497
                                          trim="true"
498
                                        target="run-one-test"
499
                                        param="target.project.name">
500
                                        <param name="buildNumberFile" location="${buildNumberFile}"/>
501
                </foreach>
502

    
503
                <foreach         list="${gvSIG_projects}"
504
                                          trim="true"
505
                                        delimiter=","
506
                                        target="concat-test-output"
507
                                        param="target.project.name" />
508

    
509
                <if>
510
                        <available file="${FlagTestError}" type="file"/>
511
                        <then>
512
                                <echo file="${JUnitGlobalResultsFile}.tmp"> === Global JUnit Results: FAILURE.${line.separator}${line.separator}</echo>
513
                                <concat  destfile="${JUnitGlobalResultsFile}.tmp2"
514
                                                binary="true">
515
                                        <fileset file="${JUnitGlobalResultsFile}.tmp"/>
516
                                        <fileset file="${JUnitGlobalResultsFile}"/>
517
                                </concat>
518
                                <move file="${JUnitGlobalResultsFile}.tmp2" tofile="${JUnitGlobalResultsFile}"/>
519
                                <delete file="${JUnitGlobalResultsFile}.tmp"/>
520
                                <echo level="error">JUnitTests: FAILURE.
521
                                        See ${JUnitGlobalResultsFile} file for details.
522
                                </echo>
523
                        </then>
524
                        <else>
525
                                <echo file="${JUnitGlobalResultsFile}.tmp"> === Global JUnit Results: SUCCESS.${line.separator}${line.separator}</echo>
526
                                <concat  destfile="${JUnitGlobalResultsFile}.tmp2"
527
                                                binary="true">
528
                                        <fileset file="${JUnitGlobalResultsFile}.tmp"/>
529
                                        <fileset file="${JUnitGlobalResultsFile}"/>
530
                                </concat>
531
                                <move file="${JUnitGlobalResultsFile}.tmp2" tofile="${JUnitGlobalResultsFile}"/>
532
                                <delete file="${22JUnitGlobalResultsFile}.tmp"/>
533
                                <echo>JUnitTests: SUCCESS.
534
                                                See ${JUnitGlobalResultsFile} file for details.
535
                                </echo>
536
                        </else>
537
                </if>
538
                <delete file="${FlagTestError}" />
539
        </target>
540

    
541
</project>
542