Statistics
| Revision:

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

History | View | Annotate | Download (16.7 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
                binaries
75
        "/>
76

    
77
        <property name="mandatoryProjets" value="
78
                _fwAndami,
79
                libCorePlugin,
80
                libFMap,
81
                appgvSIG,
82
                extJCRS
83
        "/>
84

    
85
        <property name="global.installBaseDir" location="${andami}"/>
86

    
87
        <property name="JUnitProjectResults" value="JUnitProjectResults"/>
88
        <property name="JUnitProjectResultsFile" value="JUnitProjectResults.txt"/>
89
        <property name="JUnitGlobalResults" location="JUnitGlobalResults"/>
90
        <property name="JUnitGlobalResultsFile" location="JUnitGlobalResults.txt"/>
91
        <property name="JUnitSummaryFile" location="JUnitGlobalResults.txt"/>
92
        <property name="FlagTestError" location="JUnitFlagError"/>
93

    
94
        <!--
95
                ============================================
96
                Targets for build of the appgvSIG project
97
                ============================================
98
        -->
99

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

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

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

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

    
127
        </target>
128

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

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

    
148
        </target>
149

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

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

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

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

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

    
187
        <!--
188
                ============================================
189
                Targets for global build
190
                ============================================
191
        -->
192

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

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

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

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

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

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

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

    
249
        <target name="build-all-JS1.5_JT1.4"
250
                description="
251
                        Global build for the whole gvSIG.
252
                        Compiles all the sources and builds the application so that it's ready to execute.
253
                        Source Java 1.5 and Target Java 1.4
254
        ">
255
                <antcall target="build-all-projects">
256
                        <param name="JavaSourceVersion" value="1.5"/>
257
                        <param name="JavaTargetVersion" value="jsr14"/>
258
                </antcall>
259
        </target>
260

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

    
276

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

    
283
        <target name="clean-all"
284
                                depends="clean_andami_gvSIGdir,clean-all-projects"
285
                                description="clean up application and projets" />
286

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

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

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

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

    
308

    
309

    
310
        <!-- utility targets -->
311

    
312

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

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

    
350

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

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

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

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

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

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

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

    
538
</project>
539