587
|
1 |
<?xml version="1.0"?>
|
|
2 |
<!--
|
|
3 |
============================================================================
|
|
4 |
Name : build.xml
|
|
5 |
Part of : Helium AntLib
|
|
6 |
|
|
7 |
Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
8 |
All rights reserved.
|
|
9 |
This component and the accompanying materials are made available
|
|
10 |
under the terms of the License "Eclipse Public License v1.0"
|
|
11 |
which accompanies this distribution, and is available
|
|
12 |
at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
13 |
|
|
14 |
Initial Contributors:
|
|
15 |
Nokia Corporation - initial contribution.
|
|
16 |
|
|
17 |
Contributors:
|
|
18 |
|
|
19 |
Description:
|
|
20 |
|
|
21 |
============================================================================
|
|
22 |
-->
|
|
23 |
<project name="build-macros" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:au="org.apache.ant.antunit"
|
|
24 |
xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
|
|
25 |
<import file="common.ant.xml" />
|
|
26 |
|
|
27 |
<path id="emma.classpath">
|
|
28 |
<fileset dir="${builder.dir}/antlibs">
|
|
29 |
<include name="**/*.jar" />
|
|
30 |
</fileset>
|
|
31 |
</path>
|
588
|
32 |
|
587
|
33 |
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="emma.classpath"/>
|
|
34 |
<taskdef classpathref="emma.classpath" resource="emma_ant.properties" />
|
|
35 |
|
588
|
36 |
|
587
|
37 |
<target name="clean">
|
|
38 |
<delete dir="${module.temp.dir}" />
|
|
39 |
</target>
|
|
40 |
|
588
|
41 |
|
587
|
42 |
<target name="resolve">
|
628
|
43 |
<mkdir dir="${lib.dir}" />
|
|
44 |
<mkdir dir="${lib.dir}/zipsafe" />
|
|
45 |
<mkdir dir="${lib.dir}/zipnotsafe" />
|
|
46 |
<delete dir="${lib.dir}/zipnotsafe" includes="**/*" />
|
|
47 |
|
587
|
48 |
<ivy:settings file="${ivy.settings.dir}/ivysettings.xml" />
|
|
49 |
|
|
50 |
<!-- the call to resolve is not mandatory, retrieve makes an implicit call if we don't -->
|
|
51 |
<ivy:resolve file="${ivy.file}" log="download-only"/>
|
628
|
52 |
<ivy:retrieve pattern="${lib.dir}/zipsafe/[artifact].[ext]" type="egg" log="download-only"/>
|
|
53 |
<ivy:retrieve pattern="${lib.dir}/zipsafe/[artifact].[ext]" type="py" log="download-only"/>
|
|
54 |
<ivy:retrieve pattern="${lib.dir}/[artifact].[ext]" type="jar" log="download-only"/>
|
587
|
55 |
</target>
|
|
56 |
|
588
|
57 |
|
587
|
58 |
<target name="report" depends="resolve" description="--> generates a report of dependencies">
|
|
59 |
<ivy:report todir="${build.dir}"/>
|
|
60 |
</target>
|
|
61 |
|
588
|
62 |
|
587
|
63 |
<target name="quality" depends="checkstyle" />
|
|
64 |
|
588
|
65 |
|
587
|
66 |
<target name="checkstyle" depends="resolve">
|
|
67 |
<mkdir dir="${module.temp.dir}"/>
|
|
68 |
<echo>Running checkstyle on ${ant.project.name}.</echo>
|
|
69 |
<cs:checkstyle config="${builder.dir}/java/config/java_checkstyle_config.xml">
|
|
70 |
<classpath>
|
|
71 |
<path refid="lib.path.id" />
|
|
72 |
<pathelement location="${jar.file}" />
|
|
73 |
<pathelement location="${module.bin.dir}/${ant.project.name}.jar" />
|
|
74 |
</classpath>
|
|
75 |
<fileset dir="${src.dir}" includes="**/*.java"/>
|
|
76 |
<formatter type="plain"/>
|
|
77 |
<formatter type="xml" toFile="${module.temp.dir}/checkstyle_errors.xml"/>
|
|
78 |
</cs:checkstyle>
|
|
79 |
</target>
|
|
80 |
|
588
|
81 |
|
587
|
82 |
<target name="compile" depends="resolve" description="--> compile the project">
|
|
83 |
<mkdir dir="${classes.dir}" />
|
|
84 |
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="lib.path.id" debug="true" source="1.6" target="1.6" listfiles="true">
|
|
85 |
<compilerarg value="-Xlint:unchecked" />
|
|
86 |
<compilerarg value="-Xlint:deprecation" />
|
|
87 |
<compilerarg value="-Werror" />
|
|
88 |
</javac>
|
|
89 |
</target>
|
|
90 |
|
588
|
91 |
|
587
|
92 |
<target name="ivy-new-version" unless="ivy.new.revision">
|
|
93 |
<!-- default module version prefix value
|
|
94 |
<property name="module.version.prefix" value="${module.version.target}-dev-b" />
|
|
95 |
-->
|
|
96 |
<!-- asks to ivy an available version number
|
|
97 |
<ivy:info file="${ivy.file}" />
|
|
98 |
<ivy:buildnumber
|
|
99 |
organisation="${ivy.organisation}" module="${ivy.module}"
|
|
100 |
revision="${module.version.prefix}" defaultBuildNumber="1" revSep=""/> -->
|
|
101 |
</target>
|
|
102 |
|
588
|
103 |
|
587
|
104 |
<target name="local-version">
|
|
105 |
<!--<tstamp>
|
|
106 |
<format property="now" pattern="yyyyMMddHHmmss"/>
|
|
107 |
</tstamp>
|
|
108 |
<property name="ivy.new.revision" value="${module.version.target}-local-${now}"/>-->
|
|
109 |
</target>
|
|
110 |
|
588
|
111 |
|
587
|
112 |
<target name="version" depends="ivy-new-version">
|
|
113 |
<!-- create version file in classpath for later inclusion in jar
|
|
114 |
<mkdir dir="${classes.dir}"/>
|
|
115 |
<echo message="version=${ivy.new.revision}" file="${classes.dir}/${ant.project.name}.properties" append="false" />
|
|
116 |
-->
|
|
117 |
<!-- load generated version properties file
|
|
118 |
<property file="${classes.dir}/${ant.project.name}.properties" />-->
|
|
119 |
</target>
|
|
120 |
|
588
|
121 |
|
587
|
122 |
<target name="package" depends="local-version,version,compile" description="--> make a jar file for this project">
|
|
123 |
<delete dir="${module.bin.dir}"/>
|
|
124 |
<mkdir dir="${module.bin.dir}" />
|
|
125 |
<jar destfile="${module.bin.dir}/${ant.project.name}.jar">
|
|
126 |
<fileset dir="${classes.dir}" />
|
|
127 |
<fileset dir="${src.dir}">
|
|
128 |
<exclude name="**/distribution.policy.S60" />
|
|
129 |
<exclude name="**/*.java" />
|
|
130 |
</fileset>
|
|
131 |
<manifest>
|
|
132 |
<section name="common">
|
|
133 |
<attribute name="Implementation-Title" value="${ant.project.name}" />
|
|
134 |
<attribute name="Implementation-Vendor" value="Nokia" />
|
|
135 |
</section>
|
|
136 |
</manifest>
|
|
137 |
</jar>
|
|
138 |
|
|
139 |
<!--copy file="${module.bin.dir}/${ant.project.name}.jar" todir="${bin.dir}" /-->
|
|
140 |
<!--
|
|
141 |
<mkdir dir="${bin.dir}/com.nokia.helium/${ant.project.name}/${version}" />
|
588
|
142 |
<copy file="${bin.dir}/com.nokia.helium/${ant.project.name}/${version}/${ant.project.name}.jar" todir="${module.bin.dir}" />
|
587
|
143 |
[organisation]/[module]/[color]/[revision]/[artifact].[ext]
|
|
144 |
|
|
145 |
pubrevision="${version}"
|
|
146 |
pubdate="${now}"
|
|
147 |
-->
|
|
148 |
<ivy:publish artifactspattern="${module.bin.dir}/[artifact].[ext]"
|
|
149 |
resolver="local"
|
|
150 |
status="integration"
|
|
151 |
forcedeliver="true"
|
|
152 |
pubrevision="1.0"
|
|
153 |
overwrite="true"
|
|
154 |
/>
|
|
155 |
</target>
|
|
156 |
|
|
157 |
|
|
158 |
<target name="test" depends="junit,antunit"/>
|
|
159 |
|
588
|
160 |
|
|
161 |
<target name="junit" depends="resolve">
|
587
|
162 |
<mkdir dir="${build.temp.dir}" />
|
|
163 |
<if>
|
|
164 |
<available type="dir" file="${basedir}/tests/src"/>
|
|
165 |
<then>
|
|
166 |
<echo>JUnit test module ${ant.project.name}</echo>
|
|
167 |
<delete dir="${module.temp.dir}/junit_classes"/>
|
|
168 |
<delete>
|
|
169 |
<fileset dir="${module.temp.dir}" includes="**/*_junit.emma" />
|
|
170 |
<fileset dir="${module.temp.dir}" includes="backup/*.jar" />
|
|
171 |
</delete>
|
|
172 |
<mkdir dir="${module.temp.dir}/junit_classes" />
|
|
173 |
<javac srcdir="${basedir}/tests/src" destdir="${module.temp.dir}/junit_classes" debug="true">
|
|
174 |
<classpath>
|
|
175 |
<fileset dir="${module.temp.dir}">
|
|
176 |
<include name="**/*.jar"/>
|
|
177 |
</fileset>
|
|
178 |
</classpath>
|
|
179 |
<include name="**/*.java" />
|
|
180 |
</javac>
|
|
181 |
|
|
182 |
<mkdir dir="${module.temp.dir}/backup" />
|
|
183 |
<copy file="${jar.file}" todir="${module.temp.dir}/backup/" overwrite="true"/>
|
|
184 |
<emma enabled="true" verbosity="quiet">
|
|
185 |
<instr destdir="${module.temp.dir}/backup/" metadatafile="${module.temp.dir}/metadata_junit.emma" merge="true" mode="overwrite">
|
|
186 |
<instrpath>
|
|
187 |
<fileset dir="${module.temp.dir}/backup/" includes="${ant.project.name}.jar" />
|
|
188 |
</instrpath>
|
|
189 |
</instr>
|
|
190 |
</emma>
|
|
191 |
|
|
192 |
<mkdir dir="${junit.result.dir}" />
|
|
193 |
<delete file="${module.temp.dir}/coverage.emma" failonerror="false" />
|
|
194 |
<junit fork="yes" printsummary="yes" haltonfailure="yes">
|
|
195 |
<formatter type="brief" usefile="false"/>
|
|
196 |
<formatter type="xml" usefile="true"/>
|
|
197 |
<jvmarg value="-Demma.coverage.out.file=${module.temp.dir}/coverage_junit.emma" />
|
|
198 |
<jvmarg value="-Demma.coverage.out.merge=true" />
|
|
199 |
<jvmarg value="-Dtestdir=${basedir}" />
|
628
|
200 |
<jvmarg value="-Dtest.temp.dir=${test.temp.dir}" />
|
587
|
201 |
<classpath>
|
|
202 |
<fileset dir="${module.temp.dir}/backup/">
|
|
203 |
<include name="**/*.jar"/>
|
|
204 |
</fileset>
|
|
205 |
<fileset dir="${lib.dir}">
|
|
206 |
<include name="**/*.jar"/>
|
|
207 |
</fileset>
|
|
208 |
<fileset dir="${builder.dir}/antlibs">
|
|
209 |
<include name="**/*.jar"/>
|
|
210 |
</fileset>
|
|
211 |
<pathelement path="${module.temp.dir}/junit_classes" />
|
|
212 |
<fileset dir="${ant.home}/lib">
|
|
213 |
<include name="**/*.jar"/>
|
|
214 |
</fileset>
|
|
215 |
</classpath>
|
|
216 |
<batchtest fork="yes" todir="${junit.result.dir}">
|
|
217 |
<fileset dir="${basedir}/tests/src">
|
|
218 |
<include name="**/*Test*.java"/>
|
|
219 |
</fileset>
|
|
220 |
</batchtest>
|
|
221 |
</junit>
|
|
222 |
<delete dir="${module.temp.dir}/backup/" failonerror="false" />
|
|
223 |
|
|
224 |
<emma enabled="true" verbosity="quiet">
|
|
225 |
<report sourcepath="${src.dir}">
|
|
226 |
<infileset dir="${module.temp.dir}" includes="*_junit.emma" />
|
|
227 |
<txt outfile="${module.temp.dir}/coverage.txt" />
|
|
228 |
<html outfile="${module.temp.dir}/coverage.html" />
|
|
229 |
<xml outfile="${module.temp.dir}/coverage.xml" />
|
|
230 |
</report>
|
|
231 |
</emma>
|
|
232 |
<if>
|
|
233 |
<available file="${module.temp.dir}/coverage.txt" />
|
|
234 |
<then>
|
|
235 |
<loadfile property="message" srcFile="${module.temp.dir}/coverage.txt"/>
|
|
236 |
<echo message="${message}"/>
|
|
237 |
</then>
|
|
238 |
</if>
|
|
239 |
</then>
|
|
240 |
</if>
|
|
241 |
<if>
|
|
242 |
<resourcecount count="0" when="gt">
|
|
243 |
<fileset dir="${components.temp.dir}/" includes="*/*.emma" />
|
|
244 |
</resourcecount>
|
|
245 |
<then>
|
|
246 |
<emma enabled="true" verbosity="quiet">
|
|
247 |
<report sourcepath="${src.dir}">
|
|
248 |
<infileset dir="${components.temp.dir}/" includes="*/*.emma" />
|
|
249 |
<txt outfile="${build.temp.dir}/coverage.txt" />
|
|
250 |
<html outfile="${build.temp.dir}/coverage.html" />
|
|
251 |
<xml outfile="${build.temp.dir}/coverage.xml" />
|
|
252 |
</report>
|
|
253 |
</emma>
|
|
254 |
</then>
|
|
255 |
</if>
|
|
256 |
</target>
|
|
257 |
|
588
|
258 |
|
587
|
259 |
<target name="antunit">
|
|
260 |
<mkdir dir="${build.temp.dir}" />
|
|
261 |
<if>
|
|
262 |
<available type="dir" file="${basedir}/tests"/>
|
|
263 |
<then>
|
|
264 |
<trycatch property="antunitModule.error">
|
|
265 |
<try>
|
|
266 |
<!-- Temporarly replacing the jar file
|
|
267 |
with an instrumented one to do the
|
|
268 |
actual coverage measurment
|
|
269 |
-->
|
|
270 |
<mkdir dir="${module.temp.dir}/backup" />
|
|
271 |
<delete>
|
|
272 |
<fileset dir="${module.temp.dir}" includes="**/*_antunit.emma" />
|
|
273 |
</delete>
|
|
274 |
<copy file="${jar.file}" todir="${module.temp.dir}/backup/" />
|
|
275 |
<emma enabled="true" verbosity="quiet">
|
|
276 |
<instr destdir="${module.temp.dir}/backup/" metadatafile="${module.temp.dir}/metadata_antunit.emma" merge="true" mode="overwrite">
|
|
277 |
<instrpath>
|
|
278 |
<fileset dir="${module.temp.dir}/backup/" includes="${ant.project.name}.jar" />
|
|
279 |
</instrpath>
|
|
280 |
</instr>
|
|
281 |
</emma>
|
588
|
282 |
<pathconvert pathsep="${path.separator}" property="python.path">
|
628
|
283 |
<fileset dir="${lib.dir}" includes="zipsafe/*.egg"/>
|
|
284 |
<dirset dir="${lib.dir}" includes="zipnotsafe/*.egg"/>
|
|
285 |
<dirset dir="${lib.dir}" includes="zipsafe" />
|
588
|
286 |
</pathconvert>
|
587
|
287 |
<exec osfamily="windows" executable="cmd" dir="${basedir}/tests" failonerror="true">
|
588
|
288 |
<env key="ANT_ARGS" value="-lib ${lib.dir} -lib ${module.temp.dir}/backup/${ant.project.name}.jar -lib ${builder.dir}/antlibs -Dpython.path=${python.path}" />
|
|
289 |
<env key="PYTHONPATH" value="${python.path}" />
|
|
290 |
<env key="JYTHONPATH" value="${python.path}" />
|
|
291 |
<arg line="/c build.bat unittest " />
|
|
292 |
<arg value="-Dbuilder.dir=${builder.dir}" />
|
587
|
293 |
</exec>
|
645
|
294 |
<exec osfamily="unix" executable="/bin/bash" dir="${basedir}/tests" failonerror="true">
|
588
|
295 |
<env key="ANT_ARGS" value="-lib ${lib.dir} -lib ${module.temp.dir}/backup/${ant.project.name}.jar -lib ${builder.dir}/antlibs -Dpython.path=${python.path}" />
|
|
296 |
<env key="PYTHONPATH" value="${python.path}" />
|
|
297 |
<env key="JYTHONPATH" value="${python.path}" />
|
645
|
298 |
<arg value="./bld.sh" />
|
588
|
299 |
<arg line="unittest" />
|
|
300 |
<arg value="-Dbuilder.dir=${builder.dir}" />
|
587
|
301 |
</exec>
|
|
302 |
<move todir="${module.temp.dir}">
|
|
303 |
<fileset dir="${basedir}/tests" includes="**/coverage.ec" />
|
|
304 |
<chainedmapper>
|
|
305 |
<filtermapper>
|
|
306 |
<replacestring from="/" to="_" />
|
|
307 |
<replacestring from="\" to="_" />
|
|
308 |
</filtermapper>
|
|
309 |
<regexpmapper from="^(.*)\.ec$$" to="\1_antunit.emma" />
|
|
310 |
</chainedmapper>
|
|
311 |
</move>
|
|
312 |
<emma enabled="true" verbosity="quiet">
|
|
313 |
<report sourcepath="${src.dir}">
|
|
314 |
<infileset dir="${module.temp.dir}/" includes="*_antunit.emma" />
|
|
315 |
<txt outfile="${module.temp.dir}/coverage_antunit.txt" />
|
|
316 |
<html outfile="${module.temp.dir}/coverage_antunit.html" />
|
|
317 |
<xml outfile="${module.temp.dir}/coverage_antunit.xml" />
|
|
318 |
</report>
|
|
319 |
</emma>
|
|
320 |
<if>
|
|
321 |
<available file="${module.temp.dir}/coverage_antunit.txt" />
|
|
322 |
<then>
|
|
323 |
<loadfile property="message" srcFile="${module.temp.dir}/coverage_antunit.txt" />
|
|
324 |
<echo message="${message}" />
|
|
325 |
</then>
|
|
326 |
</if>
|
|
327 |
</try>
|
|
328 |
<catch>
|
|
329 |
<fail message="${antunitModule.error}" />
|
|
330 |
</catch>
|
|
331 |
<finally>
|
|
332 |
<delete>
|
|
333 |
<fileset dir="${module.temp.dir}" includes="backup/*.jar" />
|
|
334 |
</delete>
|
|
335 |
</finally>
|
|
336 |
</trycatch>
|
|
337 |
</then>
|
|
338 |
</if>
|
|
339 |
<if>
|
|
340 |
<resourcecount count="0" when="gt">
|
628
|
341 |
<fileset dir="${components.temp.dir}/" includes="*/*.emma" />
|
587
|
342 |
</resourcecount>
|
|
343 |
<then>
|
|
344 |
<emma enabled="true" verbosity="quiet">
|
|
345 |
<report sourcepath="${src.dir}">
|
|
346 |
<infileset dir="${components.temp.dir}/" includes="*/*.emma" />
|
|
347 |
<txt outfile="${build.temp.dir}/coverage.txt" />
|
|
348 |
<html outfile="${build.temp.dir}/coverage.html" />
|
|
349 |
<xml outfile="${build.temp.dir}/coverage.xml" />
|
|
350 |
</report>
|
|
351 |
</emma>
|
|
352 |
</then>
|
|
353 |
</if>
|
|
354 |
</target>
|
588
|
355 |
|
|
356 |
|
587
|
357 |
<target name="unittest" depends="antunit"/>
|
|
358 |
|
|
359 |
</project>
|
588
|
360 |
|
|
361 |
|