<?xml version="1.0" encoding="UTF-8"?>
<!-- 
============================================================================ 
Name        : overlays.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:

============================================================================
-->
<project name="overlays" xmlns:hlm="http://www.nokia.com/helium">
    <description>
    Scans the overlay structure and creates  report.
    </description>
    <!-- Scans the overlay structure used in SAL projects. 
         Creates report page from which build managers can 
         easibly see the files that need to be merged. -->
    <target name="scan-overlays">
        <if>
            <isreference refid="overlay.files" type="fileset"/>
            <then>
                <pathconvert refid="overlay.files" property="overlay.files.path"/>
                <hlm:python>
        
import comments

files = r'${overlay.files.path}'.split(';')

# Create a comment parser that extracts branchInfo XML elements in comments
parser = comments.CommentParser(files, 'branchInfo')
doc = parser.scan()

# Write the XML content to a log file
logfile = open(r'${overlays.log.file}', 'w')
doc.xml(logfile, indent=u"yes")
logfile.close()
        
                </hlm:python>
                <xslt in="${overlays.log.file}" out="${overlays.log.file}.html" style="${helium.dir}/tools/preparation/overlayLog_to_html.xslt"/>
            </then>
            <!-- Need to define an 'id' to match the refid in this file, for schema validation. -->
            <else>
                <!-- An XML element with an 'id' attribute is created to allow successful XML validation.
                This serves no other purpose. -->
                <property id="overlay.files" name="overlay.files.id" value="invalid" />
                <echo>WARNING: 'overlay.files' reference not defined. Overlay scanning will not happen.</echo>
            </else>
        </if>
    </target>
</project>