|
1 <?xml version="1.0" encoding="UTF-8"?> |
|
2 <!-- |
|
3 ============================================================================ |
|
4 Name : mmp-to-target.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 quality --> |
|
24 <project name="quality.mmp-to-target" xmlns:hlm="http://www.nokia.com/helium"> |
|
25 <description> |
|
26 Generate the list of targets from the project files. |
|
27 </description> |
|
28 |
|
29 <!-- |
|
30 Generates an output text file that list the generated target per mmp files. |
|
31 The list of mmps is to provided throught a fileset. |
|
32 |
|
33 e.g. |
|
34 <pre> |
|
35 <hlm:mmpToTargetMacro output="targets_from_mmps.txt"> |
|
36 <fileset dir="${build.drive}/"> |
|
37 <include name="s60/**/*.mmp"/> |
|
38 <include name="ncp_sw/**/*.mmp"/> |
|
39 <include name="ppd_sw/**/*.mmp"/> |
|
40 <include name="psw/**/*.mmp"/> |
|
41 <exclude name="**/tsrc/**/*.mmp"/> |
|
42 </fileset> |
|
43 </hlm:mmpToTargetMacro> |
|
44 </pre> |
|
45 --> |
|
46 <scriptdef name="mmpToTargetMacro" language="jython" uri="http://www.nokia.com/helium"> |
|
47 <element name="fileset" type="fileset"/> |
|
48 <attribute name="output"/> |
|
49 <![CDATA[ |
|
50 import integration.quality |
|
51 import os |
|
52 import re |
|
53 if attributes.get('output') == None: |
|
54 raise Exception("'output' attribute is not defined.") |
|
55 project.log("Creating %s" % str(attributes.get('output'))) |
|
56 output = open(str(attributes.get('output')), "w+") |
|
57 match_target = re.compile("\s*TARGET\s+(.+)") |
|
58 for eid in range(elements.get("fileset").size()): |
|
59 ds = elements.get("fileset").get(int(eid)).getDirectoryScanner(project) |
|
60 ds.scan() |
|
61 for filename in ds.getIncludedFiles(): |
|
62 filename = os.path.join(str(ds.getBasedir()), str(filename)) |
|
63 project.log("Analysing %s" % filename, 4) |
|
64 input = open(filename, 'r') |
|
65 for line in input.readlines(): |
|
66 m = match_target.match(line) |
|
67 # do not match resource files. |
|
68 if m != None and os.path.splitext(m.group(1))[1].lower() != ".rsc": |
|
69 output.write("%s : %s\n" % (os.path.splitdrive(filename)[1], m.group(1))) |
|
70 output.close() |
|
71 ]]> |
|
72 </scriptdef> |
|
73 |
|
74 |
|
75 <!-- |
|
76 This target generates a text file which maps executable and they mmp source location. |
|
77 |
|
78 e.g: |
|
79 \src\common\generic\wap-stack\wapstack\group\wapstkcli.mmp : wapstkcli.dll |
|
80 \src\common\generic\wap-stack\wapstack\group\wapstksrv.mmp : wapstksrv.dll |
|
81 --> |
|
82 <target name="integration-mmp-to-target"> |
|
83 <mkdir dir="${post.log.dir}" /> |
|
84 <hlm:mmpToTargetMacro output="${post.log.dir}/${build.id}_targets_from_mmps.txt"> |
|
85 <fileset refid="mmp.to.target.config"/> |
|
86 </hlm:mmpToTargetMacro> |
|
87 </target> |
|
88 |
|
89 <!-- Default configuration for the integration-mmp-to-target target. --> |
|
90 <fileset dir="${build.drive}/" id="mmp.to.target.config"> |
|
91 <include name="s60/**/*.mmp"/> |
|
92 <include name="ncp_sw/**/*.mmp"/> |
|
93 <include name="ppd_sw/**/*.mmp"/> |
|
94 <include name="psw/**/*.mmp"/> |
|
95 <exclude name="**/tsrc/**/*.mmp"/> |
|
96 </fileset> |
|
97 |
|
98 </project> |