Statistics
| Revision:

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

History | View | Annotate | Download (16.7 KB)

1 7210 cesar
<project name="appgvSIG" default="dist" basedir=".">
2 312 fernando
    <description>
3 13296 jmvivo
        gvSIG Main build
4 312 fernando
    </description>
5 13296 jmvivo
6
        <import file="../binaries/ant/utilities.xml"/>
7
8
        <!--
9
                ============================================
10 13423 cesar
                Properties for build of the appgvSIG project
11 13296 jmvivo
                ============================================
12
        -->
13
        <property name="version" value="1.2 ${eclipse.startTime}"/>
14 4907 cesar
        <property name="src" location="src"/>
15
        <property name="build" location="bin"/>
16 13423 cesar
        <property name="src-test" location="src-test"/>
17
        <property name="build-test" location="bin-test"/>
18 4907 cesar
        <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 13126 jmvivo
27 13296 jmvivo
        <!--
28
                ============================================
29
                Properties for global build
30
                ============================================
31
        -->
32 13126 jmvivo
33 13533 mhaloui
        <property name="gvSIG_projects" value="
34 13638 jmvivo
                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 13296 jmvivo
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 13392 jmvivo
87 13341 cesar
        <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 13296 jmvivo
94
        <!--
95
                ============================================
96 13423 cesar
                Targets for build of the appgvSIG project
97 13296 jmvivo
                ============================================
98
        -->
99
100 4907 cesar
        <target name="init">
101
                <!-- Create the time stamp -->
102
                <tstamp/>
103 7210 cesar
                <echo>
104
                        Compiling ${ant.project.name}...</echo>
105 10187 jmvivo
106
                <property file="build.number"/>
107 4907 cesar
                <!-- Creamos un fichero con el timeStamp para que lo lea el FPanelAbout -->
108
                <!-- <buildnumber/> -->
109
        </target>
110 4143 caballero
111 4907 cesar
        <target name="dist"
112 9200 jmvivo
                                depends="init,create-jar,copy-libs,copy-data-files,move-to-andami"
113 7139 cesar
                                description="Generate the distribution of the gvSIG plugin. To build just the appgvSIG project from Eclipse " >
114 9776 cesar
                <!-- Create the distribution directory -->
115 4907 cesar
        </target>
116 13126 jmvivo
117 4907 cesar
        <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 13126 jmvivo
                <loadEclipseClasspath project="${basedir}"/>
124 13296 jmvivo
                <gvSIG-javac
125 13423 cesar
                        classpath="${eclipseClasspath}"/>
126 312 fernando
127 13126 jmvivo
        </target>
128
129 4907 cesar
        <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 13126 jmvivo
134
        <target name="copy-libs">
135 4907 cesar
                <!-- 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 13296 jmvivo
                <ant dir="../libFMap" target="batch-build" inheritAll="false">
140 9200 jmvivo
                        <property name="debug" value="${debug}"/>
141
                        <property name="debuglevel" value="${debuglevel}"/>
142
                        <property name="encoding" value="ISO_8859_1"/>
143
                </ant>
144 4907 cesar
                <copy todir="${dist}/lib">
145 9200 jmvivo
                        <fileset dir="${fmapdir}/dist/lib/" includes="*.jar,*.zip"/>
146 4907 cesar
                </copy>
147 9200 jmvivo
148 4907 cesar
        </target>
149 13126 jmvivo
150 13296 jmvivo
        <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 4907 cesar
        <target name="copy-data-files">
156 5489 cesar
        <copy todir="${dist}">
157
                <fileset dir="config" includes="*" />
158
        </copy>
159 4907 cesar
                <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 13126 jmvivo
168 4907 cesar
        <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 13296 jmvivo
                <!--<delete dir="${dist}"/> -->
179 4907 cesar
        </target>
180 13531 jmvivo
181 13423 cesar
        <target name="run-tests" depends="batch-build,compile-tests">
182 13360 cesar
                <antcall target="generic-run-tests">
183
                        <param name="TestSuite.Name" value="com.iver.cit.gvsig.AllTests"/>
184
                </antcall>
185
        </target>
186 13126 jmvivo
187 13296 jmvivo
        <!--
188
                ============================================
189
                Targets for global build
190
                ============================================
191
        -->
192 13126 jmvivo
193 13296 jmvivo
        <!-- 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 13126 jmvivo
201 13296 jmvivo
        <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 13126 jmvivo
209 13296 jmvivo
        <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 5849 cesar
216 13296 jmvivo
        <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 13126 jmvivo
224 13296 jmvivo
    <target name="clean_andami_gvSIGdir"
225
            description="clean up the gvSIG andami deploy">
226
        <delete dir="${andami}/gvSIG" failonerror="false"/>
227
    </target>
228 10187 jmvivo
229 5849 cesar
        <target name="build-all"
230 13296 jmvivo
                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 6296 cesar
        </target>
236 13126 jmvivo
237 13296 jmvivo
        <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 6296 cesar
        </target>
248 13126 jmvivo
249 13296 jmvivo
        <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 13126 jmvivo
                </antcall>
259 13296 jmvivo
        </target>
260 13126 jmvivo
261 13296 jmvivo
        <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 13126 jmvivo
        </target>
275
276
277 13296 jmvivo
        <target name="build-all-projects"
278 13126 jmvivo
                        description="Builds the application, excluding extensions">
279
                <property file="build.number"/>
280 13533 mhaloui
                <foreach list="${gvSIG_projects}" trim="true" delimiter="," target="batch-build-project" param="bb-project.name"/>
281 5849 cesar
        </target>
282 12696 cesar
283 5849 cesar
        <target name="clean-all"
284 13296 jmvivo
                                depends="clean_andami_gvSIGdir,clean-all-projects"
285
                                description="clean up application and projets" />
286 13126 jmvivo
287 13296 jmvivo
        <target name="clean-all-projects"
288 13236 jmvivo
                description="cleans the base components of gvSIG: appgvSIG + libs">
289
                <!-- Delete the ${build} and ${dist} directory trees -->
290 13533 mhaloui
                <foreach list="${gvSIG_projects}"  trim="true" delimiter="," target="clean-project" param="c-project.name"/>
291 5849 cesar
        </target>
292 13126 jmvivo
293 5852 cesar
        <target name="install-all"
294 13296 jmvivo
                                        depends="install-all-projects"
295 7139 cesar
                                        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 13126 jmvivo
297 13296 jmvivo
        <target name="install-all-projects"
298 7139 cesar
                                description="Generate jars and copy files to Andami for the application (gvSIG+libs). Compilation is supposed to be automatically done by Eclipse" >
299 13533 mhaloui
                <foreach list="${gvSIG_projects}" trim="true"  delimiter="," target="install-project" param="i-project.name"/>
300 7139 cesar
        </target>
301 13126 jmvivo
302 13798 jmvivo
        <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 13296 jmvivo
        <!-- utility targets -->
311
312 13798 jmvivo
313 13296 jmvivo
        <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 13807 jmvivo
                        <entry  key="build.number" default="0" type="int" operation="+" pattern="0000"/>
319 13296 jmvivo
                </propertyfile>
320 7139 cesar
        </target>
321 5852 cesar
322 13296 jmvivo
        <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 13126 jmvivo
350
351 13423 cesar
        <target name="clean-project">
352
                <property name="c-project.dir" location="../${c-project.name}"/>
353 13296 jmvivo
                <if>
354 13423 cesar
                        <available file="${c-project.dir}" type="dir"/>
355 13296 jmvivo
                        <then>
356
                                <echo>
357 13423 cesar
                                        Clean ${c-project.name}
358 13296 jmvivo
                                </echo>
359 13423 cesar
                                <ant dir="${c-project.dir}" target="clean" inheritAll="false"/>
360 13296 jmvivo
                        </then>
361
                        <else>
362
                                <if>
363 13423 cesar
                                        <contains string="${mandatoryProjets}" substring="${c-project.name}"/>
364 13296 jmvivo
                                        <then>
365 13423 cesar
                                                <fail message="The required project is missing for Clean: ${c-project.name}"/>
366 13296 jmvivo
                                        </then>
367
                                        <else>
368
                                                <echo>
369 13423 cesar
                                                        Skip ${c-project.name} project from Clean
370 13296 jmvivo
                                                </echo>
371
                                        </else>
372
                                </if>
373
                        </else>
374
                </if>
375 5849 cesar
        </target>
376
377 13296 jmvivo
        <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 13392 jmvivo
410 13798 jmvivo
        <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 13341 cesar
        <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 13525 cesar
                                                        <property name="buildNumberFile" location="${buildNumberFile}"/>
465 13341 cesar
                                                </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 13650 cesar
                                                <echo append="true" file="${JUnitGlobalResultsFile}">JUnitTests for ${target.project.name}: FAILED.${line.separator}</echo>
473 13660 cesar
                                                <echo append="true" file="${target.project.dir}/${JUnitProjectResultsFile}">${AnErrorHappened}</echo>
474 13341 cesar
                                        </catch>
475
                                </trycatch>
476
                        </then>
477
                        <else>
478 13641 cesar
                                <echo>
479
                                        Skip ${target.project.dir} project from RunTests
480
                                </echo>
481 13650 cesar
                                <echo append="true" file="${JUnitGlobalResultsFile}">JUnitTests for ${target.project.name}: SKIPPED.${line.separator}</echo>
482 13341 cesar
                        </else>
483
                </if>
484
        </target>
485 13392 jmvivo
486 13341 cesar
        <target name="run-all-tests">
487
                <delete file="${FlagTestError}" />
488
                <move         file="${JUnitGlobalResultsFile}"
489
                                tofile="${JUnitGlobalResults}.old"
490
                                failonerror="false" />
491 13525 cesar
                <property name="buildNumberFile" location="build.number"/>
492 13341 cesar
                <foreach        list="${gvSIG_projects}"
493
                                        delimiter=","
494 13638 jmvivo
                                          trim="true"
495 13341 cesar
                                        target="run-one-test"
496 13525 cesar
                                        param="target.project.name">
497
                                        <param name="buildNumberFile" location="${buildNumberFile}"/>
498
                </foreach>
499 13392 jmvivo
500 13357 cesar
                <foreach         list="${gvSIG_projects}"
501 13638 jmvivo
                                          trim="true"
502 13357 cesar
                                        delimiter=","
503
                                        target="concat-test-output"
504
                                        param="target.project.name" />
505 5849 cesar
506 13341 cesar
                <if>
507
                        <available file="${FlagTestError}" type="file"/>
508
                        <then>
509 13423 cesar
                                <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 13357 cesar
                                <echo level="error">JUnitTests: FAILURE.
518 13341 cesar
                                        See ${JUnitGlobalResultsFile} file for details.
519
                                </echo>
520
                        </then>
521
                        <else>
522 13423 cesar
                                <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 13341 cesar
                                <echo>JUnitTests: SUCCESS.
531
                                                See ${JUnitGlobalResultsFile} file for details.
532
                                </echo>
533
                        </else>
534
                </if>
535 13357 cesar
                <delete file="${FlagTestError}" />
536 13341 cesar
        </target>
537 13126 jmvivo
538 312 fernando
</project>