buildframework/helium/tools/quality/internal-exports.ant.xml
author Bob Rosenberg <bob.rosenberg@nokia.com>
Mon, 18 Oct 2010 10:33:54 +0100
changeset 660 66ff3e731c60
parent 645 b8d81fa19e7d
permissions -rw-r--r--
Sysdeftools additional support for merging misordered system definitions. More extensive validation. Minor bug fixes. Bash wrappers for perl scripts for unix installs.

<?xml version="1.0" encoding="UTF-8"?>
<!-- 
============================================================================ 
Name        : internal-exports.ant.xml 
Part of     : Helium 

Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved.
This component and the accompanying materials are made available
under the terms of the License "Eclipse Public License v1.0"
which accompanies this distribution, and is available
at the URL "http://www.eclipse.org/legal/epl-v10.html".

Initial Contributors:
Nokia Corporation - initial contribution.

Contributors:

Description:

============================================================================
-->
<!--* @package quality -->
<project name="quality.internal-exports" xmlns:hlm="http://www.nokia.com/helium">
    <description>
        Analyse the content generated under the source tree.
    </description>

    <!--
        This macro generates an XML file that list the file generated outside epoc32 during the build.
        It relies on the output of "abld -what" command.

        e.g:
          <pre>
        <hlm:internalExportsMacro output="${build.log.dir}/${build.id}_internal_exports.xml">
            <fileset dir="${build.log.dir}">
                <include name="${build.id}.*_compile.log"/>
                <exclude name="${build.id}.*_output_build.log"/>
            </fileset>
        </hlm:internalExportsMacro>
        </pre>
    -->
    <scriptdef name="internalExportsMacro" language="jython" uri="http://www.nokia.com/helium">
        <element name="fileset" type="fileset"/>
        <attribute name="output"/>
        <![CDATA[
import integration.quality
import os
if attributes.get('output') == None:
    raise Exception("'output' attribute is not defined.")
self.log("Creating %s" % str(attributes.get('output')))
output = open(str(attributes.get('output')), "w+")
output.write("<?xml version=\"1.0\"?>\n<internalexports>\n")
for eid in range(elements.get("fileset").size()):
    ds = elements.get("fileset").get(int(eid)).getDirectoryScanner(project)
    ds.scan()
    for filename in ds.getIncludedFiles():
        filename = os.path.join(str(ds.getBasedir()), str(filename))
        parser = integration.quality.InternalExportParser(open(filename, 'r'))
        parser.parse()
        for component in parser.internalexports.keys():
            output.write("    <component name=\"%s\">\n" % component)
            output.write("".join(["        <file name=\"%s\"/>\n" % x for x in parser.internalexports[component]]))
            output.write("    </component>\n")
output.write("</internalexports>\n")
output.close()
        ]]>
    </scriptdef>

    <!--
        This target generate an XML file that contains the list of file exported inside the
        source tree. The files are sorted by components.
    -->
    <target name="integration-internal-exports">
        <hlm:internalExportsMacro output="${temp.build.dir}/${build.id}_internal_exports.xml">
            <fileset dir="${compile.log.dir}">
                <include name="${build.id}.*_compile.log"/>
                <exclude name="${build.id}.*_output_build.log"/>
            </fileset>
        </hlm:internalExportsMacro>
    </target>

    
    <!-- Render the build duplicates xml file into an HTML output. -->
    <target name="render-internal-exports" depends="integration-internal-exports">
        <fmpp sourceFile="${helium.dir}/tools/quality/templates/internal-exports.html.ftl"
              outputFile="${build.log.dir}/${build.id}_internal-exports.html">
            <freemarkerLinks expandProperties="yes">
                macro: ${helium.dir}/tools/common/templates/macro
            </freemarkerLinks>
            <data expandProperties="yes">
                doc: xml(${temp.build.dir}/${build.id}_internal_exports.xml)
                ant: antProperties()
            </data>
        </fmpp>
    </target>



</project>