587
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
|
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 |
-->
|
645
|
23 |
<project name="helium-builder" default="build" xmlns:au="antlib:org.apache.ant.antunit" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:ac="antlib:net.sf.antcontrib" xmlns:hlm="http://www.nokia.com/helium">
|
587
|
24 |
<property environment="env" />
|
|
25 |
<taskdef name="fmpp" classname="fmpp.tools.AntTask" />
|
|
26 |
<import file="delivery.ant.xml" />
|
|
27 |
|
588
|
28 |
<!-- Ensuring that only Ant 1.7.0 is in use.
|
587
|
29 |
<ac:if>
|
|
30 |
<not>
|
|
31 |
<contains string="${ant.version}" substring="1.7.0" />
|
|
32 |
</not>
|
|
33 |
<then>
|
|
34 |
<fail message="Your current ant version is ${ant.version}, you must use 1.7.0" />
|
|
35 |
</then>
|
588
|
36 |
</ac:if> -->
|
587
|
37 |
|
|
38 |
<condition property="platform" value="win32" else="unix">
|
|
39 |
<os family="windows"/>
|
|
40 |
</condition>
|
588
|
41 |
|
587
|
42 |
<dirname property="builder.dir" file="${ant.file.helium-builder}" />
|
|
43 |
<property name="source.root.dir" location="${builder.dir}/.." />
|
|
44 |
<property name="build.temp.dir" location="${source.root.dir}/build" />
|
|
45 |
<property name="components.temp.dir" location="${build.temp.dir}/components" />
|
|
46 |
<property name="component" value="*" />
|
|
47 |
<property name="component.type" value="*" />
|
|
48 |
<property name="component.root" value="*" />
|
|
49 |
<property name="config" value="sf" />
|
|
50 |
<property name="sf.delivery.zip" location="${build.temp.dir}/helium-sf-src.zip" />
|
|
51 |
<property name="binary.delivery.zip" location="${build.temp.dir}/helium-bin.zip" />
|
645
|
52 |
<property name="doc.build.dir" location="${build.temp.dir}/doc/api" />
|
587
|
53 |
|
|
54 |
<fileset id="ant.build.files" dir="${source.root.dir}">
|
|
55 |
<include name="${component.root}/${component.type}/${component}/build.xml" />
|
|
56 |
<exclude name="*builder/**" />
|
|
57 |
<exclude name="*/*builder/**" />
|
|
58 |
<exclude name="tools/**" />
|
|
59 |
<exclude name="config/**" />
|
|
60 |
<exclude name="doc/**" />
|
|
61 |
<exclude name="external/**" />
|
|
62 |
<exclude name="extensions/**" />
|
|
63 |
<exclude name="licences/**" />
|
|
64 |
<exclude name="tests/**" />
|
|
65 |
<exclude name="build/**" />
|
|
66 |
</fileset>
|
|
67 |
|
645
|
68 |
<!-- Add macro in order to avoid the use of failonerror="false" in the delete task -->
|
|
69 |
<macrodef name="deleteIfDirExists">
|
|
70 |
<attribute name="dir"/>
|
|
71 |
<sequential>
|
|
72 |
<ac:if>
|
|
73 |
<available file="@{dir}" type="dir" />
|
|
74 |
<then>
|
|
75 |
<delete dir="@{dir}" />
|
|
76 |
</then>
|
|
77 |
</ac:if>
|
|
78 |
</sequential>
|
|
79 |
</macrodef>
|
|
80 |
|
|
81 |
|
587
|
82 |
<target name="cleanup" description="Cleanup (delete the temp build directory)">
|
645
|
83 |
<deleteIfDirExists dir="${build.temp.dir}" />
|
|
84 |
<deleteIfDirExists dir="${source.root.dir}/external/antlibs2" />
|
|
85 |
<deleteIfDirExists dir="${source.root.dir}/external/python/lib/auto" />
|
587
|
86 |
</target>
|
|
87 |
|
588
|
88 |
|
587
|
89 |
<target name="get-build-list">
|
|
90 |
<ivy:buildlist reference="ivy.buildlist.path">
|
|
91 |
<fileset refid="ant.build.files"/>
|
|
92 |
</ivy:buildlist>
|
|
93 |
</target>
|
|
94 |
|
588
|
95 |
|
587
|
96 |
<target name="report" depends="get-build-list" description="Create Ivy report for each component">
|
|
97 |
<subant target="report" buildpathref="ivy.buildlist.path">
|
|
98 |
<property name="builder.dir" location="${builder.dir}" />
|
|
99 |
</subant>
|
|
100 |
</target>
|
|
101 |
|
588
|
102 |
|
587
|
103 |
<target name="compile" depends="get-build-list">
|
|
104 |
<subant target="compile" buildpathref="ivy.buildlist.path">
|
|
105 |
<property name="builder.dir" location="${builder.dir}" />
|
|
106 |
<property name="source.root.dir" value="${source.root.dir}"/>
|
|
107 |
</subant>
|
|
108 |
</target>
|
|
109 |
|
588
|
110 |
|
587
|
111 |
<target name="build" depends="get-build-list" description="Build each component">
|
|
112 |
<subant target="package" buildpathref="ivy.buildlist.path">
|
|
113 |
<property name="builder.dir" location="${builder.dir}" />
|
|
114 |
<property name="source.root.dir" value="${source.root.dir}"/>
|
|
115 |
<property name="platform" value="${platform}"/>
|
|
116 |
</subant>
|
|
117 |
</target>
|
|
118 |
|
588
|
119 |
|
587
|
120 |
<target name="clean" depends="get-build-list" description="Run clean on each component">
|
|
121 |
<subant target="clean" buildpathref="ivy.buildlist.path">
|
|
122 |
<property name="builder.dir" location="${builder.dir}" />
|
|
123 |
<property name="source.root.dir" value="${source.root.dir}"/>
|
|
124 |
</subant>
|
|
125 |
</target>
|
|
126 |
|
588
|
127 |
|
587
|
128 |
<target name="test" depends="get-build-list,build" description="Run test on each component">
|
|
129 |
<ac:for param="file" keepgoing="true">
|
|
130 |
<path refid="ivy.buildlist.path" />
|
|
131 |
<sequential>
|
628
|
132 |
<ac:trycatch>
|
|
133 |
<try>
|
|
134 |
<echo>Start component test set: @{file}</echo>
|
|
135 |
<ant antfile="@{file}" dir="@{file}/.." target="test" inheritAll="false">
|
|
136 |
<property name="builder.dir" location="${builder.dir}" />
|
|
137 |
<property name="source.root.dir" location="${source.root.dir}" />
|
|
138 |
</ant>
|
|
139 |
<echo>End component test set: @{file}</echo>
|
|
140 |
</try>
|
|
141 |
<catch>
|
|
142 |
<property name="quality.thrown" value="@{file}"/>
|
|
143 |
</catch>
|
|
144 |
</ac:trycatch>
|
587
|
145 |
</sequential>
|
|
146 |
</ac:for>
|
628
|
147 |
<ac:if>
|
|
148 |
<isset property="quality.thrown"/>
|
|
149 |
<then>
|
|
150 |
<fail message="${quality.thrown} failed"/>
|
|
151 |
</then>
|
|
152 |
</ac:if>
|
587
|
153 |
</target>
|
|
154 |
<!-- TODO: remove after CI tools are cleaned up -->
|
|
155 |
<target name="unittest" depends="test"/>
|
|
156 |
|
588
|
157 |
|
|
158 |
<target name="junit" depends="get-build-list" description="Run JUnit tests on each component">
|
587
|
159 |
<subant target="junit" buildpathref="ivy.buildlist.path">
|
|
160 |
<property name="builder.dir" location="${builder.dir}" />
|
588
|
161 |
<property name="source.root.dir" location="${source.root.dir}" />
|
587
|
162 |
</subant>
|
|
163 |
</target>
|
|
164 |
|
588
|
165 |
|
|
166 |
<target name="antunit" depends="get-build-list" description="Run AntUnit tests on each component">
|
587
|
167 |
<subant target="antunit" buildpathref="ivy.buildlist.path">
|
|
168 |
<property name="builder.dir" location="${builder.dir}" />
|
588
|
169 |
<property name="source.root.dir" location="${source.root.dir}" />
|
587
|
170 |
</subant>
|
|
171 |
</target>
|
|
172 |
|
588
|
173 |
|
587
|
174 |
<target name="quality" depends="get-build-list" description="Run quality checks on each component">
|
|
175 |
<ac:for param="file" keepgoing="true">
|
|
176 |
<path refid="ivy.buildlist.path" />
|
|
177 |
<sequential>
|
|
178 |
<echo>Checking @{file}</echo>
|
628
|
179 |
<ac:trycatch>
|
|
180 |
<try>
|
|
181 |
<ant antfile="@{file}" dir="@{file}/.." target="quality" inheritAll="false">
|
|
182 |
<property name="builder.dir" location="${builder.dir}" />
|
|
183 |
<property name="source.root.dir" value="${source.root.dir}"/>
|
|
184 |
<property name="platform" value="${platform}"/>
|
|
185 |
</ant>
|
|
186 |
</try>
|
|
187 |
<catch>
|
|
188 |
<property name="quality.thrown" value="@{file}"/>
|
|
189 |
</catch>
|
|
190 |
</ac:trycatch>
|
587
|
191 |
</sequential>
|
|
192 |
</ac:for>
|
628
|
193 |
<ac:if>
|
|
194 |
<isset property="quality.thrown"/>
|
|
195 |
<then>
|
|
196 |
<fail message="${quality.thrown} failed"/>
|
|
197 |
</then>
|
|
198 |
</ac:if>
|
587
|
199 |
</target>
|
|
200 |
|
588
|
201 |
|
628
|
202 |
<target name="ci" depends="quality"/>
|
|
203 |
|
587
|
204 |
<target name="checkstyle" depends="get-build-list" description="Run checkstyle on each component">
|
|
205 |
<ac:for param="file" keepgoing="true">
|
|
206 |
<path refid="ivy.buildlist.path" />
|
|
207 |
<sequential>
|
628
|
208 |
<ac:trycatch>
|
|
209 |
<try>
|
|
210 |
<ant antfile="@{file}" dir="@{file}/.." target="checkstyle" inheritAll="false">
|
|
211 |
<property name="builder.dir" location="${builder.dir}" />
|
|
212 |
<property name="source.root.dir" value="${source.root.dir}"/>
|
|
213 |
<property name="platform" value="${platform}"/>
|
|
214 |
</ant>
|
|
215 |
</try>
|
|
216 |
<catch>
|
|
217 |
<property name="quality.thrown" value="@{file}"/>
|
|
218 |
</catch>
|
|
219 |
</ac:trycatch>
|
587
|
220 |
</sequential>
|
|
221 |
</ac:for>
|
628
|
222 |
<ac:if>
|
|
223 |
<isset property="quality.thrown"/>
|
|
224 |
<then>
|
|
225 |
<fail message="${quality.thrown} failed"/>
|
|
226 |
</then>
|
|
227 |
</ac:if>
|
587
|
228 |
</target>
|
|
229 |
|
588
|
230 |
|
587
|
231 |
<target name="get-deps" description="Retrieving Helium dependencies">
|
|
232 |
<ac:if>
|
|
233 |
<not>
|
|
234 |
<isset property="config" />
|
|
235 |
</not>
|
|
236 |
<then>
|
|
237 |
<fail message="config is not defined." />
|
|
238 |
</then>
|
|
239 |
</ac:if>
|
|
240 |
<echo>Using ${config} configuration.</echo>
|
|
241 |
<delete>
|
|
242 |
<fileset dir="${build.temp.dir}" includes="ivy/com.nokia.helium.config/**" />
|
|
243 |
</delete>
|
|
244 |
<ivy:settings file="${source.root.dir}/${config}/settings/ivysettings.xml" />
|
|
245 |
|
|
246 |
<!-- the call to resolve is not mandatory, retrieve makes an implicit call if we don't -->
|
|
247 |
<ivy:resolve organisation="com.nokia.helium.config" module="helium-${config}-config" revision="1.0" inline="true" />
|
|
248 |
<ivy:retrieve sync="true" conf="default" organisation="com.nokia.helium.config"
|
|
249 |
module="helium-${config}-config" revision="1.0"
|
|
250 |
inline="true" type="jar"
|
628
|
251 |
pattern="${source.root.dir}/external/antlibs2/[artifact]-[revision].[ext]" />
|
|
252 |
<delete>
|
645
|
253 |
<fileset dir="${source.root.dir}" includes="external/python/lib/auto/zipnotsafe/**" />
|
628
|
254 |
</delete>
|
587
|
255 |
<ivy:retrieve sync="true" conf="default" organisation="com.nokia.helium.config"
|
|
256 |
module="helium-${config}-config" revision="1.0"
|
|
257 |
inline="true" type="egg"
|
628
|
258 |
pattern="${source.root.dir}/external/python/lib/auto/zipsafe/[artifact]-[revision].[ext]" />
|
|
259 |
<ivy:retrieve sync="false" conf="default" organisation="com.nokia.helium.config"
|
|
260 |
module="helium-${config}-config" revision="1.0"
|
|
261 |
inline="true" type="py"
|
|
262 |
pattern="${source.root.dir}/external/python/lib/auto/[artifact].[ext]" />
|
|
263 |
|
|
264 |
|
|
265 |
<path id="egg.deps.fileset" >
|
|
266 |
<dirset dir="${source.root.dir}/external/python/lib/auto" includes="*/*.egg" excludes="*/jython*.egg" />
|
|
267 |
<fileset dir="${source.root.dir}/external/python/lib/auto" includes="*/*.egg" excludes="*/jython*.egg" />
|
|
268 |
</path>
|
587
|
269 |
<fmpp sourceFile="template/easy-install.pth.ftl" outputFile="${source.root.dir}/external/python/lib/auto/easy-install.pth">
|
|
270 |
<data>
|
|
271 |
project: antProject()
|
628
|
272 |
ant: antProperties()
|
587
|
273 |
</data>
|
|
274 |
</fmpp>
|
|
275 |
|
628
|
276 |
<path id="egg.hlm.deps.fileset">
|
|
277 |
<dirset dir="${source.root.dir}">
|
|
278 |
<include name="external/python/lib/**/*.egg" />
|
|
279 |
<exclude name="**/*amara*" />
|
|
280 |
<exclude name="**/2.5/**" />
|
|
281 |
</dirset>
|
|
282 |
<fileset dir="${source.root.dir}">
|
|
283 |
<include name="external/python/**/*.egg" />
|
|
284 |
<exclude name="**/*amara*" />
|
|
285 |
<exclude name="**/2.5/**" />
|
|
286 |
</fileset>
|
|
287 |
</path>
|
587
|
288 |
<fmpp sourceFile="template/configure_jython.bat.ftl" outputFile="${source.root.dir}/external/python/configure_jython.bat">
|
|
289 |
<data>
|
|
290 |
project: antProject()
|
628
|
291 |
ant: antProperties()
|
587
|
292 |
</data>
|
|
293 |
</fmpp>
|
|
294 |
|
|
295 |
<fmpp sourceFile="template/configure_jython.sh.ftl" outputFile="${source.root.dir}/external/python/configure_jython.sh">
|
|
296 |
<data>
|
|
297 |
project: antProject()
|
628
|
298 |
ant: antProperties()
|
587
|
299 |
</data>
|
|
300 |
</fmpp>
|
|
301 |
</target>
|
|
302 |
|
|
303 |
|
|
304 |
<target name="build-helium-docs" unless="skip.docs">
|
|
305 |
<exec osfamily="windows" executable="${source.root.dir}/hlm.bat" dir="${source.root.dir}">
|
|
306 |
<arg value="docs"/>
|
|
307 |
</exec>
|
|
308 |
<exec osfamily="unix" executable="${source.root.dir}/hlm" dir="${source.root.dir}">
|
|
309 |
<arg value="docs"/>
|
|
310 |
</exec>
|
|
311 |
</target>
|
|
312 |
|
|
313 |
|
|
314 |
<target name="zip-releasable">
|
|
315 |
<delete file="${binary.delivery.zip}" failonerror="false" />
|
|
316 |
<zip destfile="${binary.delivery.zip}">
|
|
317 |
<zipfileset id="zip.content" dir="${source.root.dir}" prefix="helium">
|
|
318 |
<include name="hlm.bat" />
|
|
319 |
<include name="helium*.ant.xml" />
|
|
320 |
<include name="build.xml" />
|
|
321 |
<include name="tools/**" />
|
|
322 |
<include name="config/**" />
|
|
323 |
<include name="extensions/**" />
|
|
324 |
<include name="external/**" />
|
|
325 |
<include name="licenses/**" />
|
|
326 |
<include name="tests/minibuilds/**" />
|
|
327 |
<exclude name="config/version.txt.orig" />
|
|
328 |
<exclude name="**/distribution.policy.S60" />
|
|
329 |
</zipfileset>
|
|
330 |
<zipfileset id="zip.doc" dir="${source.root.dir}/build" prefix="helium">
|
|
331 |
<include name="doc/**" />
|
|
332 |
<exclude name="**/distribution.policy.S60" />
|
|
333 |
</zipfileset>
|
|
334 |
<zipfileset id="zip.executable" dir="${source.root.dir}" prefix="helium" filemode="755">
|
|
335 |
<include name="hlm" />
|
|
336 |
</zipfileset>
|
|
337 |
</zip>
|
|
338 |
</target>
|
|
339 |
|
|
340 |
|
|
341 |
<target name="get-helium-revision">
|
|
342 |
<exec executable="hg" outputproperty="hg.helium.revision">
|
|
343 |
<arg value="id" />
|
|
344 |
<arg value="--id" />
|
|
345 |
</exec>
|
|
346 |
<ac:propertyregex property="helium.revision"
|
|
347 |
input="${hg.helium.revision}"
|
|
348 |
regexp="([a-f0-9]+).*"
|
|
349 |
replace="\1"
|
|
350 |
casesensitive="false" />
|
|
351 |
<echo message="Revision set to: ${helium.revision}" />
|
|
352 |
</target>
|
|
353 |
|
588
|
354 |
|
587
|
355 |
<target name="update-version" depends="get-helium-revision">
|
|
356 |
<ac:if>
|
|
357 |
<available file="${source.root.dir}/config/version.txt.orig" />
|
|
358 |
<then>
|
|
359 |
<move file="${source.root.dir}/config/version.txt.orig" tofile="${source.root.dir}/config/version.txt" />
|
|
360 |
</then>
|
|
361 |
</ac:if>
|
|
362 |
<copy file="${source.root.dir}/config/version.txt" tofile="${source.root.dir}/config/version.txt.orig" />
|
|
363 |
<property file="${source.root.dir}/config/version.txt" />
|
|
364 |
<propertyfile file="${source.root.dir}/config/version.txt" comment="Helium version - DO NOT EDIT">
|
|
365 |
<entry key="helium.version" value="${helium.version}-r${helium.revision}"/>
|
|
366 |
</propertyfile>
|
|
367 |
</target>
|
|
368 |
|
588
|
369 |
|
587
|
370 |
<target name="restore-version">
|
|
371 |
<move file="${source.root.dir}/config/version.txt.orig" tofile="${source.root.dir}/config/version.txt" />
|
|
372 |
</target>
|
|
373 |
|
588
|
374 |
|
587
|
375 |
<target name="create-releasable" depends="get-deps,update-version,build-helium-docs,zip-releasable,restore-version" description="Create releasable binary package"/>
|
|
376 |
|
|
377 |
|
|
378 |
<target name="textdoc">
|
645
|
379 |
<deleteIfDirExists dir="${build.temp.dir}/doc/doctmp" />
|
587
|
380 |
<copy todir="${build.temp.dir}/doc/doctmp" overwrite="true">
|
|
381 |
<fileset dir="${source.root.dir}/sf/doc/src"/>
|
|
382 |
</copy>
|
|
383 |
<copy todir="${build.temp.dir}/doc/doctmp" overwrite="true" flatten="true">
|
628
|
384 |
<fileset dir="${source.root.dir}" includes="*/java/*/**/*.rst" excludes="*/java/*/doc/**/*.rst" />
|
|
385 |
<fileset dir="${source.root.dir}" includes="*/python/*/**/*.rst" excludes="*/python/*/doc/**/*.rst" />
|
|
386 |
<fileset dir="${source.root.dir}" includes="*/java/*/doc/" />
|
|
387 |
<fileset dir="${source.root.dir}" includes="*/python/*/doc/" />
|
587
|
388 |
</copy>
|
|
389 |
<rstMacro version="1.0" src="${build.temp.dir}/doc/doctmp"/>
|
|
390 |
</target>
|
|
391 |
|
588
|
392 |
|
587
|
393 |
<!-- Macro to generate html docs from rst. -->
|
|
394 |
<macrodef name="rstMacro">
|
|
395 |
<attribute name="version"/>
|
|
396 |
<attribute name="src" default="${source.root.dir}/sf/doc/src"/>
|
|
397 |
<attribute name="output" default="${build.temp.dir}/doc/text"/>
|
|
398 |
<sequential>
|
|
399 |
<property name="sphinx.lib.dir" location="${builder.dir}/tools/sphinx/Sphinx-0.5.1-py2.5.egg/sphinx" />
|
645
|
400 |
<exec executable="python" failonerror="true">
|
587
|
401 |
<env key="PYTHONPATH" path="${builder.dir}/tools/sphinx" />
|
|
402 |
<arg file="${builder.dir}/tools/sphinx/sphinx-build.py"/>
|
|
403 |
<arg value="-b" />
|
|
404 |
<arg value="html" />
|
|
405 |
<arg value="-D" />
|
|
406 |
<arg value="version=@{version}" />
|
|
407 |
<arg value="-D" />
|
|
408 |
<arg value="release=@{version}" />
|
|
409 |
<arg file="@{src}" />
|
|
410 |
<arg file="@{output}" />
|
|
411 |
</exec>
|
|
412 |
</sequential>
|
|
413 |
</macrodef>
|
645
|
414 |
|
|
415 |
<!-- Generate Ant API documentation using jeldoclet. -->
|
|
416 |
<target name="jeldoclet">
|
|
417 |
<path id="doclet-classpath">
|
|
418 |
<fileset dir="${build.temp.dir}" includes="**/*.jar"/>
|
|
419 |
<pathelement path="${java.class.path}/"/>
|
|
420 |
</path>
|
|
421 |
<javadoc destdir="${build.temp.dir}"
|
|
422 |
docletpathref="doclet-classpath"
|
|
423 |
useexternalfile="true"
|
|
424 |
failonerror="true">
|
|
425 |
<sourcepath>
|
|
426 |
<dirset dir="${source.root.dir}">
|
|
427 |
<include name="*/java/*/src"/>
|
|
428 |
</dirset>
|
|
429 |
</sourcepath>
|
|
430 |
<doclet name="com.jeldoclet.JELDoclet"/>
|
|
431 |
</javadoc>
|
|
432 |
<fmpp sourceFile="${builder.dir}/tools/antdoclet/doclet_list.rst.ftl"
|
|
433 |
outputFile="${build.temp.dir}/temp/doc/helium-antlib/tasks.rst">
|
|
434 |
<data expandProperties="yes">
|
|
435 |
doc: xml(${build.temp.dir}/jel.xml)
|
|
436 |
ant: antProperties()
|
|
437 |
</data>
|
|
438 |
</fmpp>
|
|
439 |
</target>
|
588
|
440 |
|
587
|
441 |
</project>
|
588
|
442 |
|
|
443 |
|