Project

General

Profile

Download (13.4 KB) Statistics
| Branch: | Revision:

git_sitools_idoc / flarecast / workspace / fr.cnes.sitools.ext.test / build / targets.xml @ d2a8c3fd

1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<!-- =================================== == Copyright 2010-2014 CNES - CENTRE 
3
        NATIONAL d'ETUDES SPATIALES == == This file is part of SITools2. == == SITools2 
4
        is free software: you can redistribute it and/or modify == it under the terms 
5
        of the GNU General Public License as published by == the Free Software Foundation, 
6
        either version 3 of the License, or == (at your option) any later version. 
7
        == == SITools2 is distributed in the hope that it will be useful, == but 
8
        WITHOUT ANY WARRANTY; without even the implied warranty of == MERCHANTABILITY 
9
        or FITNESS FOR A PARTICULAR PURPOSE. See the == GNU General Public License 
10
        for more details. == == You should have received a copy of the GNU General 
11
        Public License == along with SITools2. If not, see <http://www.gnu.org/licenses/>. 
12
        ==================================== -->
13
<!-- <path id="compile.classpath"> -->
14
<!-- <pathelement location="${comp.wp.dir}/org.restlet.patched/org.restlet.patched_1.0.1.jar"/> -->
15
<!-- <pathelement location="${comp.cp.dir}/fr.cnes.sitools.core.jar" /> -->
16
<!-- <pathelement location="${comp.lib.dir}/javax.measure_0.9.5/javax.measure_0.9.5.jar" 
17
        /> -->
18
<!-- <fileset dir="${cots.dir}/restlet-2.0.5-patched"> -->
19
<!-- <include name="**/*.jar" /> -->
20
<!-- <include name="**/*.zip" /> -->
21
<!-- </fileset> -->
22
<!-- </path> -->
23

    
24
<target name="prepare-extensions">
25
        <!-- Creation des repertoires dist.dir et out.jar.dir -->
26
        <mkdir dir="${dist.dir}" />
27
</target>
28

    
29

    
30
<target name="compile-extensions">
31
        <javac srcdir="./src" debug="${debug}" deprecation="${deprecation}"
32
                optimize="${optimize}" encoding="${encoding}" includeAntRuntime="false"
33
                destdir="${out.classes.dir}">
34
                <classpath refid="compile.classpath" />
35
        </javac>
36
        
37
        <copy todir="${out.classes.dir}">
38
                <fileset dir="${src.dir}">
39
                        <patternset refid="all.resource.files" />
40
                </fileset>
41
        </copy>
42
</target>
43

    
44
<target name="jar-extensions">
45
        <delete file="modules.jar" />
46
        <property name="version.num" value="1.00" />
47
        <buildnumber file="build.num" />
48
        <jar jarfile="${dist.dir}/${project.name}.jar" basedir="${out.classes.dir}"
49
                includes="**/*.class" excludes="**/*Helper">
50
                <metainf dir="${out.classes.dir}/META-INF">
51
                        <include name="**/*Helper" />
52
                </metainf>
53
        </jar>
54
</target>
55

    
56
<target name="cleanup-extensions">
57
<!--        <delete>-->
58
<!--                <fileset dir="." includes="**/*.class" />-->
59
<!--        </delete>-->
60

    
61
</target>
62

    
63
<!--<target name="deploy-jar-extensions"> -->
64
<!-- Deploiement du JAR de l'extension -->
65
<!-- <echo message="- Deploiement du JAR de l'extension -" /> <copy todir="${out.jar.dir}"> 
66
        <fileset dir="${dist.lib.dir}" /> </copy> </target> -->
67

    
68

    
69
<!-- ========================================================================================= 
70
        test-init : Creation de l'arborescence pour les tests ========================================================================================= -->
71
<target name="test-init">
72
        <mkdir dir="${test.dir}" />
73
        <delete dir="${test.reports.data.dir}" />
74
        <delete dir="${test.reports.dir}" />
75
        <mkdir dir="${test.reports.dir}" />
76
        <mkdir dir="${test.reports.data.dir}" />
77
</target>
78

    
79
<!-- ========================================================================================= 
80
        test-compile : Compilation des TestCase JUnit et des classes de tests ========================================================================================= -->
81
<target name="test-compile">
82
        <!-- Compile tests -->
83
        <javac srcdir="${test.src.dir}" destdir="${test.classes.dir}"
84
                debug="${debug}" deprecation="${deprecation}" optimize="${optimize}"
85
                includeAntRuntime="false">
86

    
87
                <classpath>
88
                        <path refid="test.classpath" />
89
                </classpath>
90
        </javac>
91

    
92
        <!-- Copie les ressources des tests dans le repertoire ${test.conf.dir} -->
93
        <copy todir="${test.conf.dir}" includeemptydirs="false">
94
                <fileset dir="${test.src.dir}" excludes="**/*.java" />
95
        </copy>
96
</target>
97

    
98
<property name="test.last.failed.file" location="${test.dir}/.lasttestsfailed" />
99

    
100
<!-- ========================================================================================= 
101
        test : Execution des Tests JUnit et generation du rapport de test ========================================================================================= -->
102
<target name="test"
103
        description="Execution des tests JUnit et generation du rapport de test">
104
        <echo level="info" message="" />
105

    
106
        <!-- Execute les tests JUnit -->
107
        <junit printsummary="yes" errorProperty="test.failed"
108
                failureProperty="test.failed" fork="yes" dir="${basedir}">
109
                <sysproperty key="net.sourceforge.cobertura.datafile"
110
                        file="cobertura.ser" />
111
                <classpath refid="instrumented.classpath" />
112
                <classpath refid="test.classpath" />
113
                <formatter type="brief" usefile="false" />
114
                <formatter type="xml" />
115
                <test name="${testcase}" if="testcase" />
116
                <batchtest todir="${test.reports.data.dir}" unless="testcase">
117
                        <fileset dir="${test.classes.dir}" includes="**/ext/test/**/Test*.class"
118
                                excludes="**/Abstract*.class **/TestRunner.class" />
119
                        <fileset dir="${test.classes.dir}" includes="**/ext/test/**/*Test.class"
120
                                excludes="**/Abstract*.class" />
121
                        <fileset dir="${test.classes.dir}" includes="**/ext/test/**/*TestCase.class"
122
                                excludes="**/Abstract*.class" />
123
                </batchtest>
124
        </junit>
125

    
126
        <junitreport todir="${test.reports.data.dir}">
127
                <fileset dir="${test.reports.data.dir}">
128
                        <include name="TEST-*.xml" />
129
                </fileset>
130
                <report format="frames" todir="${test.reports.dir}" />
131
        </junitreport>
132

    
133
        <echo message="last build failed tests" file="${test.last.failed.file}" />
134
        <fail if="test.failed">
135
                Unit tests failed. Check log or reports for details
136
        </fail>
137

    
138
        <!-- Remove test failed file, as these tests succeeded -->
139
        <delete file="${test.last.failed.file}" />
140
</target>
141

    
142
<!-- Classpath of the files to instrument -->
143
<path id="instrument.classpath">
144
        <fileset dir="${out.classes.dir}">
145
                <include name="**/*.class" />
146
        </fileset>
147
</path>
148

    
149
<!-- Defines the directory where to find the instrumented classes -->
150
<path id="instrumented.classpath">
151
        <pathelement location="${instrumented.dir}" />
152
</path>
153

    
154
<target name="instrumentClasses" depends="build-extensions">
155
        <delete dir="${cobertura.reports.dir}" />
156
        <mkdir dir="${cobertura.reports.dir}" />
157
        <path refid="test" />
158
        <cobertura-instrument todir="${instrumented.dir}"
159
                datafile="cobertura.ser">
160
                <ignore regex="org.apache.log4j.*" />
161
                <fileset dir="${out.classes.dir}">
162
                        <include name="**/*.class" />
163
                        <exclude name="**/*Test.class" />
164
                </fileset>
165
        </cobertura-instrument>
166
</target>
167

    
168
<target name="coverage" depends="instrumentClasses, execute-tests-ext">
169
        <cobertura-report format="html" srcdir="${src.dir}"
170
                destdir="${cobertura.reports.dir}" datafile="cobertura.ser" />
171
        <cobertura-report format="xml" srcdir="${src.dir}"
172
                destdir="${cobertura.reports.dir}" datafile="cobertura.ser" />
173
</target>
174

    
175
<target name="audit" description="Generates a report of code convention violations.">
176

    
177
        <delete dir="${checkstyle.reports.dir}" />
178
        <delete dir="${pmd.reports.dir}" />
179
        <delete dir="${cpd.reports.dir}" />
180

    
181
        <mkdir dir="${checkstyle.reports.dir}" />
182
        <mkdir dir="${pmd.reports.dir}" />
183
        <mkdir dir="${cpd.reports.dir}" />
184

    
185
        <!-- Audit CHECKSTYLE -->
186
        <checkstyle config="${audit.checkstyle.rules.dir}/AKKA-CheckStyle.xml"
187
                failureProperty="checkstyle.failure" failOnViolation="false">
188
                <formatter type="xml"
189
                        tofile="${checkstyle.reports.dir}/checkstyle_report.xml" />
190
                <fileset dir="${src.dir}" includes="**/*.java" />
191
        </checkstyle>
192
        <xslt in="${checkstyle.reports.dir}/checkstyle_report.xml" out="${checkstyle.reports.dir}/checkstyle_report.html"
193
                style="${audit.xsl.dir}/${checkstyle.xsl}" />
194

    
195
        <!-- Audit PMD -->
196
        <pmd rulesetfiles="${audit.pmd.rules.dir}/AKKA-PMD.xml">
197
                <formatter type="xml" toFile="${pmd.reports.dir}/pmd_report.xml" />
198
                <fileset dir="${src.dir}">
199
                        <include name="**/*.java" />
200
                </fileset>
201
        </pmd>
202

    
203
        <!-- Audit CPD -->
204
        <cpd minimumTokenCount="100" outputFile="${cpd.reports.dir}/cpd_report.xml"
205
                format="xml">
206
                <fileset dir="${src.dir}">
207
                        <include name="**/*.java" />
208
                </fileset>
209
        </cpd>
210

    
211
</target>
212

    
213
<!-- ========================================================================================= 
214
        init : Target d'initialisation. Elle doit etre appelee par toute les autres 
215
        targets. ========================================================================================= -->
216
<target name="init">
217
        <!-- Permet d'utiliser les valeurs ${TSTAMP}, ${DSTAMP}, ... dans les targets 
218
                si necessaires -->
219
        <tstamp />
220

    
221
        <!-- Affichage des parametres courant lors de l'execution de la tache Ant. -->
222
        <echo message="--------- ${project.fullname} ${project.version} ---------" />
223
        <echo message="" />
224

    
225
        <echo message="java.class.path    = ${java.class.path}" />
226
        <echo message="" />
227
        <echo message="java.home          = ${java.home}" />
228
        <echo message="user.home          = ${user.home}" />
229
        <echo message="" />
230
        <echo message="basedir            = ${basedir}" />
231
        <echo message="" />
232
        <echo message="compile.classpath  = ${toString:compile.classpath}" />
233

    
234
        <!-- Definition des filtres qui permettront de remplacer des token dans 
235
                les fichiers sources -->
236
        <!-- Les tokens seront de la forme suivante : @token@ dans les sources. 
237
                Et ils seront -->
238
        <!-- automatiquement remplaces par la valeur definie ci-dessous par Ant 
239
                lors de l'execution -->
240
        <!-- d'une tache ayant comme parametre : filtering="on" -->
241
        <filter token="project" value="${project.fullname}" />
242
        <filter token="version" value="${project.version}" />
243
        <filter token="year" value="${year}" />
244
        <filter token="author" value="${author}" />
245
</target>
246

    
247
<!-- ========================================================================================= 
248
        clean : Supprime les fichiers generes et les fichiers bak et de log. ========================================================================================= -->
249
<target name="clean">
250
        <!-- Supprime tous les fichiers temporaires de l'arborescance projet -->
251
        <delete>
252
                <fileset dir=".">
253
                        <patternset refid="all.tmp.files" />
254
                </fileset>
255
        </delete>
256

    
257
        <!-- Vide le repertoire "out" -->
258
        <delete dir="${out.classes.dir}" />
259
        <mkdir dir="${out.classes.dir}" />
260
</target>
261

    
262
<!-- ========================================================================================= 
263
        prepare : Prepare le repertoire "out" en y copiant les fichiers sources filtres. 
264
        ========================================================================================= -->
265
<target name="prepare">
266
        <!-- Creation des repertoires dist.dir et out.classes.dir -->
267
        <mkdir dir="${out.classes.dir}" />
268
        <mkdir dir="${lib.dir}" />
269

    
270
        <mkdir dir="${dist.dir}" />
271
</target>
272

    
273
<path id="javadoc">
274
        <pathelement location="${src.dir}" />        
275
</path>
276

    
277
<target name="javadoc">
278

    
279
        <!-- Suppression de l'ancien repertoire out.javadoc.dir -->
280
        <delete dir="${out.javadoc.dir}/sources" />
281

    
282
        <!-- Creation du repertoire out.javadoc.dir -->
283
        <mkdir dir="${out.javadoc.dir}/sources" />
284

    
285
        <!-- Generation de la javadoc du projet -->
286
        <javadoc sourcepathref="javadoc" packagenames="${project.packagenames}.*"
287
                destdir="${out.javadoc.dir}/sources" author="true" public="true"
288
                version="true" use="true" windowtitle="${project.fullname} ${project.version}"
289
                doctitle="${project.fullname} ${project.version}"
290
                bottom="Copyright &amp;copy; ${year} ${author}. All Rights Reserved.">
291
                <classpath>
292
                        <path>
293
                                <fileset dir="${cots.dir}/restlet-2.0.5-patched">
294
                                        <include name="**/*.jar" />
295
                                </fileset>
296
                        </path>
297
                        <path>
298
                                <fileset dir="${ROOT_DIRECTORY}/workspace/libraries">
299
                                        <include name="**/*.jar" />
300
                                </fileset>
301
                        </path>
302
                        <path>
303
                                <fileset dir="${ROOT_DIRECTORY}/workspace/org.restlet.ext.solr">
304
                                        <include name="**/*.jar" />
305
                                </fileset>
306
                        </path>
307
                </classpath>
308
        </javadoc>
309

    
310
        <!-- Creation du ZIP contenant la javadoc du projet -->
311
        <zip zipfile="${dist.dir}/${project.name}-doc-${project.version}.zip"
312
                basedir="${out.javadoc.dir}" />
313

    
314
        <!-- Suppression du repertoire out.javadoc.dir -->
315
        <!-- delete dir="${out.javadoc.dir}"/ -->
316
</target>
317

    
318
<target name="javadoc-tests">
319

    
320
        <!-- Suppression de l'ancien repertoire out.javadoc.dir -->
321
        <delete dir="${out.javadoc.dir}/tests" />
322

    
323
        <!-- Creation du repertoire out.javadoc.dir -->
324
        <mkdir dir="${out.javadoc.dir}/tests" />
325

    
326
        <!-- Generation de la javadoc du projet -->
327
        <javadoc sourcepath="${test.src.dir}" packagenames="${project.packagenames}.*"
328
                destdir="${out.javadoc.dir}/tests" author="true" public="true"
329
                version="true" use="true" windowtitle="${project.fullname} ${project.version}"
330
                doctitle="${project.fullname} ${project.version}"
331
                bottom="Copyright &amp;copy; ${year} ${author}. All Rights Reserved.">
332
                <link href="http://localhost:8182/sitools/developer/javadoc"
333
                        packagelistloc="." />
334
                <link offline="true" href="http://www.restlet.org/documentation/2.0/jse/api/"
335
                        packagelistloc="${cots.dir}/restlet-jse-2.0snapshot/docs/api" />
336
                <link offline="true" href="http://xstream.codehaus.org"
337
                        packagelistloc="http://xstream.codehaus.org/javadoc/" />
338
                <link offline="true" href="http://www.junit.org/" packagelistloc="${cots.dir}/junit/junit4.8.2/javadoc" />
339
                <classpath>
340
                        <pathelement path="${java.class.path}" />
341
                        <pathelement path="${servlet.jar}" />
342
                        <fileset dir="${lib.dir}">
343
                                <include name="**/*.jar" />
344
                                <include name="**/*.zip" />
345
                        </fileset>
346
                        <fileset dir="${cots.dir}/restlet-2.0.5-patched">
347
                                <include name="**/*.jar" />
348
                                <include name="**/*.zip" />
349
                        </fileset>
350
                </classpath>
351
        </javadoc>
352

    
353
        <!-- Creation du ZIP contenant la javadoc du projet -->
354
        <zip
355
                zipfile="${dist.dir}/${project.name}-doc-tests-${project.version}-${DSTAMP}.zip"
356
                basedir="${out.javadoc.dir}/tests" />
357

    
358
        <!-- Suppression du repertoire out.javadoc.dir -->
359
        <!-- delete dir="${out.javadoc.dir}"/ -->
360
</target>