|
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 --> |
|
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"> |
|
24 <property environment="env" /> |
|
25 <taskdef name="fmpp" classname="fmpp.tools.AntTask" /> |
|
26 <import file="delivery.ant.xml" /> |
|
27 |
|
28 <!-- Ensuring that only Ant 1.7.0 is in use. --> |
|
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> |
|
36 </ac:if> |
|
37 |
|
38 <condition property="platform" value="win32" else="unix"> |
|
39 <os family="windows"/> |
|
40 </condition> |
|
41 <dirname property="builder.dir" file="${ant.file.helium-builder}" /> |
|
42 <property name="source.root.dir" location="${builder.dir}/.." /> |
|
43 <property name="build.temp.dir" location="${source.root.dir}/build" /> |
|
44 <property name="components.temp.dir" location="${build.temp.dir}/components" /> |
|
45 <property name="component" value="*" /> |
|
46 <property name="component.type" value="*" /> |
|
47 <property name="component.root" value="*" /> |
|
48 <property name="config" value="sf" /> |
|
49 <property name="sf.delivery.zip" location="${build.temp.dir}/helium-sf-src.zip" /> |
|
50 <property name="binary.delivery.zip" location="${build.temp.dir}/helium-bin.zip" /> |
|
51 |
|
52 <fileset id="ant.build.files" dir="${source.root.dir}"> |
|
53 <include name="${component.root}/${component.type}/${component}/build.xml" /> |
|
54 <exclude name="*builder/**" /> |
|
55 <exclude name="*/*builder/**" /> |
|
56 <exclude name="tools/**" /> |
|
57 <exclude name="config/**" /> |
|
58 <exclude name="doc/**" /> |
|
59 <exclude name="external/**" /> |
|
60 <exclude name="extensions/**" /> |
|
61 <exclude name="licences/**" /> |
|
62 <exclude name="tests/**" /> |
|
63 <exclude name="build/**" /> |
|
64 </fileset> |
|
65 |
|
66 <target name="cleanup" description="Cleanup (delete the temp build directory)"> |
|
67 <delete dir="${build.temp.dir}" failonerror="false"/> |
|
68 </target> |
|
69 |
|
70 <target name="get-build-list"> |
|
71 <ivy:buildlist reference="ivy.buildlist.path"> |
|
72 <fileset refid="ant.build.files"/> |
|
73 </ivy:buildlist> |
|
74 </target> |
|
75 |
|
76 <target name="report" depends="get-build-list" description="Create Ivy report for each component"> |
|
77 <subant target="report" buildpathref="ivy.buildlist.path"> |
|
78 <property name="builder.dir" location="${builder.dir}" /> |
|
79 </subant> |
|
80 </target> |
|
81 |
|
82 <target name="compile" depends="get-build-list"> |
|
83 <subant target="compile" buildpathref="ivy.buildlist.path"> |
|
84 <property name="builder.dir" location="${builder.dir}" /> |
|
85 <property name="source.root.dir" value="${source.root.dir}"/> |
|
86 </subant> |
|
87 </target> |
|
88 |
|
89 <target name="build" depends="get-build-list" description="Build each component"> |
|
90 <subant target="package" buildpathref="ivy.buildlist.path"> |
|
91 <property name="builder.dir" location="${builder.dir}" /> |
|
92 <property name="source.root.dir" value="${source.root.dir}"/> |
|
93 <property name="platform" value="${platform}"/> |
|
94 </subant> |
|
95 </target> |
|
96 |
|
97 <target name="clean" depends="get-build-list" description="Run clean on each component"> |
|
98 <subant target="clean" buildpathref="ivy.buildlist.path"> |
|
99 <property name="builder.dir" location="${builder.dir}" /> |
|
100 <property name="source.root.dir" value="${source.root.dir}"/> |
|
101 </subant> |
|
102 </target> |
|
103 |
|
104 <target name="test" depends="get-build-list,build" description="Run test on each component"> |
|
105 <ac:for param="file" keepgoing="true"> |
|
106 <path refid="ivy.buildlist.path" /> |
|
107 <sequential> |
|
108 <echo>Testing: @{file}</echo> |
|
109 <ant antfile="@{file}" dir="@{file}/.." target="test" inheritAll="false"> |
|
110 <property name="builder.dir" location="${builder.dir}" /> |
|
111 </ant> |
|
112 </sequential> |
|
113 </ac:for> |
|
114 </target> |
|
115 <!-- TODO: remove after CI tools are cleaned up --> |
|
116 <target name="unittest" depends="test"/> |
|
117 |
|
118 <target name="junit" depends="get-build-list" description="Run junit on each component"> |
|
119 <subant target="junit" buildpathref="ivy.buildlist.path"> |
|
120 <property name="builder.dir" location="${builder.dir}" /> |
|
121 </subant> |
|
122 </target> |
|
123 |
|
124 <target name="antunit" depends="get-build-list" description="Run antunit on each component"> |
|
125 <subant target="antunit" buildpathref="ivy.buildlist.path"> |
|
126 <property name="builder.dir" location="${builder.dir}" /> |
|
127 </subant> |
|
128 </target> |
|
129 |
|
130 <target name="quality" depends="get-build-list" description="Run quality checks on each component"> |
|
131 <ac:for param="file" keepgoing="true"> |
|
132 <path refid="ivy.buildlist.path" /> |
|
133 <sequential> |
|
134 <echo>Checking @{file}</echo> |
|
135 <ant antfile="@{file}" dir="@{file}/.." target="quality" inheritAll="false"> |
|
136 <property name="builder.dir" location="${builder.dir}" /> |
|
137 <property name="source.root.dir" value="${source.root.dir}"/> |
|
138 <property name="platform" value="${platform}"/> |
|
139 </ant> |
|
140 </sequential> |
|
141 </ac:for> |
|
142 </target> |
|
143 |
|
144 <target name="checkstyle" depends="get-build-list" description="Run checkstyle on each component"> |
|
145 <ac:for param="file" keepgoing="true"> |
|
146 <path refid="ivy.buildlist.path" /> |
|
147 <sequential> |
|
148 <ant antfile="@{file}" dir="@{file}/.." target="checkstyle" inheritAll="false"> |
|
149 <property name="builder.dir" location="${builder.dir}" /> |
|
150 <property name="source.root.dir" value="${source.root.dir}"/> |
|
151 <property name="platform" value="${platform}"/> |
|
152 </ant> |
|
153 </sequential> |
|
154 </ac:for> |
|
155 </target> |
|
156 |
|
157 <target name="get-deps" description="Retrieving Helium dependencies"> |
|
158 <ac:if> |
|
159 <not> |
|
160 <isset property="config" /> |
|
161 </not> |
|
162 <then> |
|
163 <fail message="config is not defined." /> |
|
164 </then> |
|
165 </ac:if> |
|
166 <echo>Using ${config} configuration.</echo> |
|
167 <delete> |
|
168 <fileset dir="${build.temp.dir}" includes="ivy/com.nokia.helium.config/**" /> |
|
169 </delete> |
|
170 <ivy:settings file="${source.root.dir}/${config}/settings/ivysettings.xml" /> |
|
171 |
|
172 <!-- the call to resolve is not mandatory, retrieve makes an implicit call if we don't --> |
|
173 <ivy:resolve organisation="com.nokia.helium.config" module="helium-${config}-config" revision="1.0" inline="true" /> |
|
174 <ivy:retrieve sync="true" conf="default" organisation="com.nokia.helium.config" |
|
175 module="helium-${config}-config" revision="1.0" |
|
176 inline="true" type="jar" |
|
177 pattern="${source.root.dir}/external/antlibs2/[artifact]-[revision].[ext]" /> |
|
178 <ivy:retrieve sync="true" conf="default" organisation="com.nokia.helium.config" |
|
179 module="helium-${config}-config" revision="1.0" |
|
180 inline="true" type="egg" |
|
181 pattern="${source.root.dir}/external/python/lib/auto/[artifact]-[revision].[ext]" /> |
|
182 <fileset id="egg.deps.fileset" dir="${source.root.dir}/external/python/lib/auto" includes="*.egg" /> |
|
183 <fmpp sourceFile="template/easy-install.pth.ftl" outputFile="${source.root.dir}/external/python/lib/auto/easy-install.pth"> |
|
184 <data> |
|
185 project: antProject() |
|
186 </data> |
|
187 </fmpp> |
|
188 |
|
189 <fileset id="egg.hlm.deps.fileset" dir="${source.root.dir}"> |
|
190 <include name="external/python/**/*.egg" /> |
|
191 <exclude name="**/2.5/**" /> |
|
192 </fileset> |
|
193 <fmpp sourceFile="template/configure_jython.bat.ftl" outputFile="${source.root.dir}/external/python/configure_jython.bat"> |
|
194 <data> |
|
195 project: antProject() |
|
196 </data> |
|
197 </fmpp> |
|
198 |
|
199 <fmpp sourceFile="template/configure_jython.sh.ftl" outputFile="${source.root.dir}/external/python/configure_jython.sh"> |
|
200 <data> |
|
201 project: antProject() |
|
202 </data> |
|
203 </fmpp> |
|
204 </target> |
|
205 |
|
206 |
|
207 <target name="build-helium-docs" unless="skip.docs"> |
|
208 <exec osfamily="windows" executable="${source.root.dir}/hlm.bat" dir="${source.root.dir}"> |
|
209 <arg value="docs"/> |
|
210 </exec> |
|
211 <exec osfamily="unix" executable="${source.root.dir}/hlm" dir="${source.root.dir}"> |
|
212 <arg value="docs"/> |
|
213 </exec> |
|
214 </target> |
|
215 |
|
216 |
|
217 <target name="zip-releasable"> |
|
218 <delete file="${binary.delivery.zip}" failonerror="false" /> |
|
219 <zip destfile="${binary.delivery.zip}"> |
|
220 <zipfileset id="zip.content" dir="${source.root.dir}" prefix="helium"> |
|
221 <include name="hlm.bat" /> |
|
222 <include name="helium*.ant.xml" /> |
|
223 <include name="build.xml" /> |
|
224 <include name="tools/**" /> |
|
225 <include name="config/**" /> |
|
226 <include name="extensions/**" /> |
|
227 <include name="external/**" /> |
|
228 <include name="licenses/**" /> |
|
229 <include name="tests/minibuilds/**" /> |
|
230 <exclude name="config/version.txt.orig" /> |
|
231 <exclude name="**/distribution.policy.S60" /> |
|
232 </zipfileset> |
|
233 <zipfileset id="zip.doc" dir="${source.root.dir}/build" prefix="helium"> |
|
234 <include name="doc/**" /> |
|
235 <exclude name="**/distribution.policy.S60" /> |
|
236 </zipfileset> |
|
237 <zipfileset id="zip.executable" dir="${source.root.dir}" prefix="helium" filemode="755"> |
|
238 <include name="hlm" /> |
|
239 </zipfileset> |
|
240 </zip> |
|
241 </target> |
|
242 |
|
243 |
|
244 <target name="get-helium-revision"> |
|
245 <exec executable="hg" outputproperty="hg.helium.revision"> |
|
246 <arg value="id" /> |
|
247 <arg value="--id" /> |
|
248 </exec> |
|
249 <ac:propertyregex property="helium.revision" |
|
250 input="${hg.helium.revision}" |
|
251 regexp="([a-f0-9]+).*" |
|
252 replace="\1" |
|
253 casesensitive="false" /> |
|
254 <echo message="Revision set to: ${helium.revision}" /> |
|
255 </target> |
|
256 |
|
257 <target name="update-version" depends="get-helium-revision"> |
|
258 <ac:if> |
|
259 <available file="${source.root.dir}/config/version.txt.orig" /> |
|
260 <then> |
|
261 <move file="${source.root.dir}/config/version.txt.orig" tofile="${source.root.dir}/config/version.txt" /> |
|
262 </then> |
|
263 </ac:if> |
|
264 <copy file="${source.root.dir}/config/version.txt" tofile="${source.root.dir}/config/version.txt.orig" /> |
|
265 <property file="${source.root.dir}/config/version.txt" /> |
|
266 <propertyfile file="${source.root.dir}/config/version.txt" comment="Helium version - DO NOT EDIT"> |
|
267 <entry key="helium.version" value="${helium.version}-r${helium.revision}"/> |
|
268 </propertyfile> |
|
269 </target> |
|
270 |
|
271 <target name="restore-version"> |
|
272 <move file="${source.root.dir}/config/version.txt.orig" tofile="${source.root.dir}/config/version.txt" /> |
|
273 </target> |
|
274 |
|
275 <target name="create-releasable" depends="get-deps,update-version,build-helium-docs,zip-releasable,restore-version" description="Create releasable binary package"/> |
|
276 |
|
277 |
|
278 <target name="textdoc"> |
|
279 <delete dir="${build.temp.dir}/doc/doctmp" failonerror="false"/> |
|
280 <copy todir="${build.temp.dir}/doc/doctmp" overwrite="true"> |
|
281 <fileset dir="${source.root.dir}/sf/doc/src"/> |
|
282 </copy> |
|
283 <copy todir="${build.temp.dir}/doc/doctmp" overwrite="true" flatten="true"> |
|
284 <fileset dir="${source.root.dir}" includes="*/java/*/**/*.rst"/> |
|
285 <fileset dir="${source.root.dir}" includes="*/python/*/**/*.rst"/> |
|
286 </copy> |
|
287 <rstMacro version="1.0" src="${build.temp.dir}/doc/doctmp"/> |
|
288 </target> |
|
289 |
|
290 <!-- Macro to generate html docs from rst. --> |
|
291 <macrodef name="rstMacro"> |
|
292 <attribute name="version"/> |
|
293 <attribute name="src" default="${source.root.dir}/sf/doc/src"/> |
|
294 <attribute name="output" default="${build.temp.dir}/doc/text"/> |
|
295 <sequential> |
|
296 <property name="sphinx.lib.dir" location="${builder.dir}/tools/sphinx/Sphinx-0.5.1-py2.5.egg/sphinx" /> |
|
297 <exec executable="python" failonerror="${failonerror}"> |
|
298 <env key="PYTHONPATH" path="${builder.dir}/tools/sphinx" /> |
|
299 <arg file="${builder.dir}/tools/sphinx/sphinx-build.py"/> |
|
300 <arg value="-b" /> |
|
301 <arg value="html" /> |
|
302 <arg value="-D" /> |
|
303 <arg value="version=@{version}" /> |
|
304 <arg value="-D" /> |
|
305 <arg value="release=@{version}" /> |
|
306 <arg file="@{src}" /> |
|
307 <arg file="@{output}" /> |
|
308 </exec> |
|
309 </sequential> |
|
310 </macrodef> |
|
311 </project> |