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