buildframework/helium/tools/common/logging.ant.xml
author timothy.murphy@nokia.com
Fri, 15 Jan 2010 20:19:26 +0000
branchwip
changeset 118 375b7128e900
parent 1 be27ed110b50
child 179 d8ac696cc51f
permissions -rw-r--r--
Put stderr into separate log file

<?xml version="1.0" encoding="UTF-8"?>
<!-- 
============================================================================ 
Name        : logging.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="logging" xmlns:hlm="http://www.nokia.com/helium">
    <description>
        Targets related to log parsing, rendaring, upload to diamonds etc.
    </description>
    <!-- Merges all XML log files ending in ".log2.xml" in the build log directory
    into a single summary log file. -->
    <target name="log-merge" unless="metadata.enable" >
        <mkdir dir="${build.log.dir}"/>
        <dependset>
            <srcfileset dir="${build.log.dir}" includes="${build.id}*.log.xml"/>
            <targetfileset file="${build.summary.file}"/>
        </dependset>
        <if>
            <not>
                <available file="${build.summary.file}"/>
            </not>
            <then>
                <echo>Merging all *.log.xml files</echo>        
                <mkdir dir="${build.log.dir}/summary"/>
                <xmltask  dest="${build.summary.file}">
                    <insert path="/"  >
                    <![CDATA[
                    <logSummary/>
                    ]]>
                    </insert>
                </xmltask>
                <for param="file">
                    <path>
                        <fileset dir="${build.log.dir}">
                            <include name="${build.id}*.log.xml"/>
                        </fileset>
                    </path>
                    <sequential>
                        <echo>Inserting @{file} into summary.</echo>
                        <!--<xmltask source="${build.summary.file}"
                                 dest="${build.summary.file}">
                           <insert path="/logSummary" file="@{file}" />
                        </xmltask>-->
                        <hlm:assertPropertySet property="build.summary.file" message="Property build.summary.file is not defined." />
                        <script language="jython" setbeans="false">
# Temporary solution
import log2xml
log2xml.append_summary(project.getProperty('build.summary.file'), r'@{file}')
                        </script>                        
                    </sequential>
                </for>
            </then>
            <else>
                <echo>Summary XML log file does not need updating.</echo>
            </else>
        </if>
    </target>
    
    
    <!-- Outputs an HTML readable version of the summary log. -->
    <target name="render-log-summary">
        <fmpp sourceFile="${helium.dir}/tools/common/templates/log/summary_metadata.html.ftl"
                     outputfile="${build.log.dir}/summary/${build.id}_summary.html">
            <freemarkerLinks expandProperties="yes">
                macro: ${helium.dir}/tools/common/templates/macro
            </freemarkerLinks>
            <data expandProperties="yes">
                dbPath: ${metadata.dbfile}
                loginfo: xml(${build.log.dir}/${build.id}_info.log.xml)
                ant: antProperties()
            </data>
        </fmpp>
    </target>
    
    <!-- Prepare email for build summary -->
    <target name="logger-email" depends="log-merge">
        <fmpp sourceRoot="${helium.dir}/tools/common/templates/log" includes="email.html.ftl" outputRoot="${build.log.dir}/summary"
              replaceExtension="html.ftl, html">
            <data expandProperties="yes">
                doc: xml(${build.summary.file})
                ant: antProperties()
            </data>
        </fmpp>        
    </target>
    

    <!-- Test target to show how Diamond metadata could be rendered. -->
    <target name="render-diamonds-data" depends="log-merge">
        <mkdir dir="${build.log.dir}/summary/diamonds"/>
        <fmpp sourceRoot="${helium.dir}/tools/common/templates/diamonds"
              outputRoot="${build.log.dir}/summary/diamonds" includes="diamonds.xml.ftl"
              replaceExtension="xml.ftl, xml">
            <data expandProperties="yes">
                doc: xml(${build.summary.file})
                ant: antProperties()
            </data>
        </fmpp>
    </target>

    
    <!-- Render the CC dashboad summary. -->
    <target name="render-cc-summary" depends="log-merge">
        <mkdir dir="${build.log.dir}/summary"/>
        <fmpp sourceFile="${helium.dir}/tools/common/templates/log/cc_summary_metadata.html.ftl"
                     outputfile="${build.log.dir}/summary/${build.id}_cc_summary.html">
            <data expandProperties="yes">
                dbPath: ${metadata.dbfile}
                ant: antProperties()
            </data>
        </fmpp>
    </target>

    
    <!-- Creates a full summary log from all the build logs. -->
    <target name="build-log-summary" depends="render-log-summary"/>
    
    <!-- Test target to check signal. -->
    <target name="check-signal" />
    
</project>