|
1 <?xml version="1.0" encoding="UTF-8"?> |
|
2 <!-- |
|
3 ============================================================================ |
|
4 Name : common.ant.xml |
|
5 Part of : Helium |
|
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 <!--* @package framework --> |
|
24 <project name="common" xmlns:hlm="http://www.nokia.com/helium" xmlns:cs="antlib:com.puppycrawl.tools.checkstyle"> |
|
25 <description> |
|
26 Common targets for all Helium tools. |
|
27 </description> |
|
28 |
|
29 <!--======================================================================= |
|
30 Preset definitions --> |
|
31 <presetdef name="preset.exec"> |
|
32 <exec> |
|
33 <!-- Note the extra ':' required at the start of the value. This |
|
34 is required for the Symbian tools to match the env variable. --> |
|
35 <env key="ARMV5VER" value=":${arm.compiler.version}"/> |
|
36 |
|
37 <!-- Tools configuration --> |
|
38 <env key="LOGONSERVER" value="${logon.server}"/> |
|
39 </exec> |
|
40 </presetdef> |
|
41 |
|
42 |
|
43 <presetdef name="preset.mail"> |
|
44 <mail from="${email.from}" messagemimetype="text/html" mailhost="${email.smtp.server}" failonerror="false"/> |
|
45 </presetdef> |
|
46 |
|
47 |
|
48 <!-- Outputs diagnostics information for the Helium configuration. |
|
49 |
|
50 This contains: |
|
51 * The current configuration of properties. |
|
52 * The Ant diagnostics information. |
|
53 --> |
|
54 <target name="diagnostics" description="Print diagnostics about Helium"> |
|
55 <echo> |
|
56 -------- Helium diagnostics report -------- |
|
57 Helium version ${helium.version} |
|
58 |
|
59 ------------------------------------------- |
|
60 Helium configuration |
|
61 ------------------------------------------- |
|
62 </echo> |
|
63 <runtarget target="config"/> |
|
64 <diagnostics/> |
|
65 <hlm:database/> |
|
66 </target> |
|
67 |
|
68 <!-- Sets the properties that are dependent on build.number -property. |
|
69 |
|
70 The properties are: |
|
71 * build.version |
|
72 * build.id |
|
73 * prep.build.dir |
|
74 * publish.dir |
|
75 * publish.release.dir |
|
76 --> |
|
77 <target name="build-number"> |
|
78 <fail unless="build.number" message="build.number property not defined" /> |
|
79 <!-- Version of the build. |
|
80 @type string |
|
81 @scope private |
|
82 --> |
|
83 <property name="build.version" value="${core.build.version}.${build.number}"/> |
|
84 <!-- A unique ID for the build. |
|
85 @type string |
|
86 @scope private |
|
87 --> |
|
88 <property name="build.id" value="${build.name}_${build.version}"/> |
|
89 <!-- This is the directory where the build area is prepared. Once created it is substed to the build.drive. |
|
90 @type string |
|
91 @scope private |
|
92 --> |
|
93 <property name="prep.build.dir" location="${prep.root.dir}/${build.id}"/> |
|
94 <!-- Directory where the build is published (includes build.id) |
|
95 @type string |
|
96 --> |
|
97 <property name="publish.dir" location="${publish.root.dir}/${build.name}/builds/${core.build.version}/${build.id}"/> |
|
98 <!-- The directory where the release of this build is published to on the local network. |
|
99 @type string |
|
100 @scope private |
|
101 --> |
|
102 <property name="publish.release.dir" location="${publish.root.dir}/${build.name}/releases/${core.build.version}/${build.id}"/> |
|
103 </target> |
|
104 |
|
105 <!-- Variable set to configuration tool. |
|
106 Currently supported configuration tool arguments are |
|
107 argument : ant variable name |
|
108 |
|
109 -master_conf : master_conf |
|
110 -confml : confml |
|
111 -impl : impl |
|
112 -iby : iby |
|
113 -ignore_errors : keepgoing(true - uses -ignore_errors, otherwise not, setting |
|
114 true generates cenrep incase of errors, and signals has to be configured to stop the build |
|
115 in case of errors). |
|
116 --> |
|
117 <hlm:argSet id="cnftool.refid"> |
|
118 <hlm:arg name="path" value="${build.drive}/s60/tools/toolsextensions/configurationtool" /> |
|
119 <hlm:arg name="master_conf" value="s60.confml" /> |
|
120 <hlm:arg name="confml" value="\epoc32\rom\config\confml_data\s60" /> |
|
121 <hlm:arg name="impl" value="\epoc32\rom\config\confml_data\s60" /> |
|
122 <hlm:arg name="iby" value="\epoc32\rom\include\" /> |
|
123 <hlm:arg name="keepgoing" value="false" /> |
|
124 </hlm:argSet> |
|
125 |
|
126 <!-- Target to run configtool. See cnftool.refid for config tool parameters--> |
|
127 <target name="configtool" description="target to run configtool, refid is for mcl, overridden by changing cnftool.refid"> |
|
128 <hlm:toolMacro name="configuration"> |
|
129 <hlm:toolvarset refid="cnftool.refid"/> |
|
130 </hlm:toolMacro> |
|
131 </target> |
|
132 |
|
133 <!-- Finds the build manager's (current user) email address from their username. --> |
|
134 <target name="lookup-email" > |
|
135 <if> |
|
136 <isset property="email.ldap.server"/> |
|
137 <then> |
|
138 <if> |
|
139 <not> |
|
140 <isset property="email.from"/> |
|
141 </not> |
|
142 <then> |
|
143 <hlm:ldap url="${email.ldap.server}" rootdn="${email.ldap.rootdn}" filter="uid=${env.USERNAME}" outputproperty="email.from" key="mail"/> |
|
144 </then> |
|
145 </if> |
|
146 </then> |
|
147 </if> |
|
148 </target> |
|
149 |
|
150 <!-- To authenticate the noe password (read from .netrc file) for ${env.USERNAME}. --> |
|
151 <target name="authenticate-user" if="authenticate.noe.user"> |
|
152 <runtarget target="noe-password"/> |
|
153 |
|
154 <hlm:ldapauthenticate url="${email.ldap.server}" |
|
155 rootdn="${email.ldap.rootdn}" |
|
156 searchdn="${ldap.organization.unit.rootdn}, ${ldap.people.rootdn}" |
|
157 filter="uid=${env.USERNAME}" |
|
158 outputproperty="is.authentication.sucess" |
|
159 key="employeeNumber" |
|
160 password="${noe.password}" |
|
161 /> |
|
162 <if> |
|
163 <istrue value="${is.authentication.sucess}" /> |
|
164 <then> |
|
165 <echo>noe authentication for user ${env.USERNAME} is success.</echo> |
|
166 </then> |
|
167 <else> |
|
168 <fail message="noe authentication for user ${env.USERNAME} is failed."/> |
|
169 </else> |
|
170 </if> |
|
171 </target> |
|
172 |
|
173 <!-- Utility target to test mail sending from Helium. --> |
|
174 <target name="check-mail" depends="lookup-email"> |
|
175 <preset.mail tolist="${email.from}" subject="mail-test"/> |
|
176 </target> |
|
177 |
|
178 <!-- A simple test target that prints a simple message --> |
|
179 <target name="hello"> |
|
180 <echo message="Hello!"/> |
|
181 <if> |
|
182 <isset property="build.number"/> |
|
183 <then> |
|
184 <echo message="Ant libs found OK"/> |
|
185 </then> |
|
186 </if> |
|
187 </target> |
|
188 |
|
189 |
|
190 <!-- A simple test target that prints a simple message and is dependant upon another target to show how ANT works--> |
|
191 <target name="hi" depends="hello"/> |
|
192 |
|
193 |
|
194 <!-- A simple test target that prints a simple message --> |
|
195 <target name="fail"> |
|
196 <fail message="Test build failure."/> |
|
197 </target> |
|
198 |
|
199 |
|
200 <!-- Print out the build properties --> |
|
201 <target name="config" description="Print out the build properties"> |
|
202 <echoproperties> |
|
203 <propertyset negate="true"> |
|
204 <propertyref prefix="java."/> |
|
205 <propertyref prefix="sun."/> |
|
206 <propertyref prefix="awt."/> |
|
207 <propertyset refid="password.list.ref"/> |
|
208 </propertyset> |
|
209 </echoproperties> |
|
210 </target> |
|
211 |
|
212 <!-- Prints out target dependencies. |
|
213 |
|
214 A <tt>target</tt> property should be defined on the command line to specify which target's dependencies to analyse. |
|
215 |
|
216 Example: <tt>hlm -Dtarget=compile-main deps</tt> |
|
217 --> |
|
218 <target name="deps"> |
|
219 <fail unless="target" message="target property not defined, example: hlm -Dtarget=compile-main deps" /> |
|
220 <hlm:dependencies target="${target}" format="nested"/> |
|
221 </target> |
|
222 |
|
223 |
|
224 <!-- Displays target dependencies in a text box. |
|
225 |
|
226 A <tt>target</tt> property should be defined on the command line to specify which target's dependencies to analyse. --> |
|
227 <target name="execlist"> |
|
228 <fail unless="target" message="target property not defined" /> |
|
229 <hlm:record name="execlist.txt" action="start" emacsmode="true"/> |
|
230 <hlm:dependencies target="${target}" format="executable"/> |
|
231 <hlm:record name="execlist.txt" action="stop"/> |
|
232 <exec executable="notepad.exe"> |
|
233 <arg value="execlist.txt"/> |
|
234 </exec> |
|
235 <delete file="execlist.txt"/> |
|
236 </target> |
|
237 |
|
238 |
|
239 <!-- Prints out Helium help dialog --> |
|
240 <target name="help"> |
|
241 <if> |
|
242 <not> |
|
243 <available file="${database.file}"/> |
|
244 </not> |
|
245 <then> |
|
246 <antcall target="database"/> |
|
247 </then> |
|
248 </if> |
|
249 <if> |
|
250 <isset property="help.target"/> |
|
251 <then> |
|
252 <fmpp sourcefile="${helium.dir}/tools/common/templates/help_text.txt.ftl" outputfile="build/help_text.txt" quiet="true"> |
|
253 <data expandProperties="yes"> |
|
254 xml: xml(${database.file}) |
|
255 helpTarget: ${help.target} |
|
256 </data> |
|
257 </fmpp> |
|
258 <loadfile srcfile="build/help_text.txt" property="help.text"/> |
|
259 <echo>${help.text}</echo> |
|
260 </then> |
|
261 <else> |
|
262 <echo> |
|
263 Usage: |
|
264 hlm [target] [-D<property>=<value>] [-f <ant_build_file>] [-h] [-p -v] |
|
265 |
|
266 [target] Run Ant target |
|
267 [-D<property>=<value>] Set an Ant property |
|
268 [-f <ant_build_file>] Use another Ant build file |
|
269 [-h] Print Ant help text |
|
270 [-p -v] List all Ant targets |
|
271 |
|
272 Variable properties for helium: |
|
273 -Dsysdef.configuration=default set build configuration, default value is 'default' |
|
274 -Dbuild.system=ebs set build system, default value is 'ebs' |
|
275 - possible values are 'ebs' and 'ec' |
|
276 |
|
277 Usage examples: |
|
278 hlm build the default build target |
|
279 hlm -Dbuild.system=ec-helium use electric cloud build system |
|
280 </echo> |
|
281 </else> |
|
282 </if> |
|
283 </target> |
|
284 |
|
285 |
|
286 <!-- Automates deletion of old work areas. |
|
287 |
|
288 <tt>prep.root.dir</tt> is the path where work areas are typically stored. This command |
|
289 scans that directory for sub-directories that match a pattern based on the build name. |
|
290 A dialog is displayed listing the directories as checkboxes. Check each build area |
|
291 directory to delete it. |
|
292 --> |
|
293 <target name="clean-pc"> |
|
294 <dirset id="prep.build.dirs" dir="${prep.root.dir}"> |
|
295 <include name="*_*"/> |
|
296 <include name="subcon_*_*"/> |
|
297 </dirset> |
|
298 <pathconvert pathsep="," property="prep.build.dirs.path"> |
|
299 <dirset refid="prep.build.dirs"/> |
|
300 </pathconvert> |
|
301 <fmpp sourceFile="${helium.dir}/tools/common/templates/clean_pc.ant.ftl" |
|
302 outputFile="${cache.dir}/clean_pc.ant.xml"> |
|
303 <data expandProperties="yes"> |
|
304 prepRootDir: ${prep.root.dir} |
|
305 buildAreaDirs: [${prep.build.dirs.path}] |
|
306 </data> |
|
307 </fmpp> |
|
308 <ant antfile="${cache.dir}/clean_pc.ant.xml"/> |
|
309 <delete file="${cache.dir}/clean_pc.ant.xml"/> |
|
310 </target> |
|
311 |
|
312 |
|
313 <!-- Displays the current version of Helium --> |
|
314 <target name="version" description="Displays the current version of Helium"> |
|
315 <echo message="Helium version: ${helium.version}" /> |
|
316 </target> |
|
317 |
|
318 |
|
319 <!-- Checks the Ant configuration against a Helium data model. --> |
|
320 <target name="check"> |
|
321 <hlm:antconfiglint> |
|
322 <WrongTypePropertyCheck/> |
|
323 </hlm:antconfiglint> |
|
324 </target> |
|
325 |
|
326 |
|
327 <!-- Generates an Ant XML database file. |
|
328 |
|
329 This lists all the targets and information about them. --> |
|
330 <target name="database"> |
|
331 <mkdir dir="${basedir}/build"/> |
|
332 <hlm:database output="${database.file}"> |
|
333 <fileset dir="${helium.dir}"> |
|
334 <include name="config/signaling_config_default.ant.xml"/> |
|
335 <include name="config/stages_config_default.ant.xml"/> |
|
336 <include name="config/metadata_filter_config_default.ant.xml"/> |
|
337 </fileset> |
|
338 </hlm:database> |
|
339 </target> |
|
340 |
|
341 |
|
342 <!-- Looks for lint-style issues with the Ant files in Helium, using the antlint task. --> |
|
343 <target name="antlint"> |
|
344 <delete dir="${helium.build.dir}/jep"/> |
|
345 <delete dir="${helium.build.dir}/python"/> |
|
346 <delete dir="${helium.build.dir}/beanshell"/> |
|
347 <delete file="${helium.build.dir}/test_jython.xml"/> |
|
348 <hlm:antlint> |
|
349 <fileset id="antlint.files" dir="${helium.dir}"> |
|
350 <include name="*.ant.xml"/> |
|
351 <include name="tools/**/*.ant.xml"/> |
|
352 <include name="tools/**/build.xml"/> |
|
353 <include name="tools/**/*.antlib.xml"/> |
|
354 <include name="config/**/*.ant.xml"/> |
|
355 <include name="config/**/build.xml"/> |
|
356 <include name="config/**/*.antlib.xml"/> |
|
357 <include name="external/helium-antlib/**/*.ant.xml"/> |
|
358 <include name="external/helium-antlib/**/build.xml"/> |
|
359 <include name="external/helium-antlib/**/*.antlib.xml"/> |
|
360 <include name="extensions/nokia/**/build.xml"/> |
|
361 <include name="extensions/nokia/**/*.antlib.xml"/> |
|
362 <include name="extensions/nokia/**/*.ant.xml"/> |
|
363 <exclude name="external/helium-antlib/**/data/*.xml"/> |
|
364 </fileset> |
|
365 <checker name="CheckTabCharacter" severity="error" /> |
|
366 <checker name="CheckPropertyName" severity="warning">([a-z0-9[\\d\\_\\.\\@\\{\\}\\$]]*)</checker> |
|
367 <checker name="CheckTargetName" severity="warning">([a-z0-9[\\d\\-]]*)</checker> |
|
368 <checker name="CheckIndentation" severity="error"/> |
|
369 <checker name="CheckPresetDefMacroDefName" severity="warning">([a-z0-9][a-zA-Z0-9]*)</checker> |
|
370 <checker name="CheckProjectName" severity="warning">([a-z0-9[\\d\\.\\_\\-]]*)</checker> |
|
371 <checker name="CheckDescription" severity="warning"/> |
|
372 <checker name="CheckFileName" severity="warning" >^build.xml$|ant.xml$|antlib.xml$</checker> |
|
373 <checker name="CheckRunTarget" severity="warning"/> |
|
374 <checker name="CheckAntCall" severity="warning"/> |
|
375 <checker name="CheckScriptSize" severity="warning"/> |
|
376 <checker name="CheckUseOfIfInTargets" severity="warning"/> |
|
377 <checker name="CheckJepJythonScript" severity="error" /> |
|
378 <checker name="CheckPropertiesInDataModel" severity="warning"/> |
|
379 <checker name="CheckScriptCondition" severity="warning"/> |
|
380 <checker name="CheckPythonTasks" severity="warning"/> |
|
381 <checker name="CheckUseOfEqualsTask" severity="warning"/> |
|
382 <checker name="CheckScriptDefNameAttributes" severity="error"/> |
|
383 <checker name="CheckScriptDefStyle" severity="warning"/> |
|
384 <checker name="CheckScriptDef" severity="error"/> |
|
385 <checker name="CheckDuplicateNames" severity="warning"/> |
|
386 </hlm:antlint> |
|
387 <fileset id="jep.files" dir="${helium.build.dir}"> |
|
388 <include name="jep/**/*.py"/> |
|
389 <include name="python/**/*.py"/> |
|
390 </fileset> |
|
391 <antcall target="pylint" inheritRefs="true"> |
|
392 <reference refid="jep.files" torefid="python.files" /> |
|
393 </antcall> |
|
394 <cs:checkstyle config="config/java_checkstyle_config.xml"> |
|
395 <fileset dir="${helium.build.dir}/beanshell" includes="**/*.java"/> |
|
396 <formatter type="plain"/> |
|
397 </cs:checkstyle> |
|
398 |
|
399 <for param="file"> |
|
400 <path> |
|
401 <fileset dir="${helium.dir}"> |
|
402 <include name="**/*.ftl"/> |
|
403 <include name="**/*.rst"/> |
|
404 <exclude name="**/*.mk.ftl"/> |
|
405 <exclude name="build/**/*"/> |
|
406 </fileset> |
|
407 </path> |
|
408 <sequential> |
|
409 <loadfile srcfile="@{file}" property="tabs.in.ftl"> |
|
410 <filterchain> |
|
411 <linecontainsregexp> |
|
412 <regexp pattern="\t"/> |
|
413 </linecontainsregexp> |
|
414 </filterchain> |
|
415 </loadfile> |
|
416 <fail if="tabs.in.ftl" message="@{file} has tabs" /> |
|
417 </sequential> |
|
418 </for> |
|
419 </target> |
|
420 |
|
421 |
|
422 <!-- This target can be use to clean up after a build finished or failed. |
|
423 |
|
424 This contains: |
|
425 * Unsubst build drive if the build finished. |
|
426 * Can be used to do other cleanup stuff too. |
|
427 --> |
|
428 <target name="cleanup-all"> |
|
429 <!-- unsubst build drive after build finished if the property "unsubst.after.build" defined as "yes" --> |
|
430 <if> |
|
431 <and> |
|
432 <isset property="unsubst.after.build"/> |
|
433 <istrue value="${unsubst.after.build}" /> |
|
434 </and> |
|
435 <then> |
|
436 <echo> Removing build drive: ${build.drive} </echo> |
|
437 <hlm:unsubst drive="${build.drive}"/> |
|
438 </then> |
|
439 </if> |
|
440 </target> |
|
441 |
|
442 |
|
443 <!-- Macro test target. --> |
|
444 <target name="macro-test"> |
|
445 <hlm:fooMacro/> |
|
446 </target> |
|
447 |
|
448 </project> |
|
449 |
|
450 |
|
451 |
|
452 |