buildframework/helium/tools/common/logging.ant.xml
changeset 307 22ecbfc20eb4
parent 215 b61c19d4168d
parent 217 0f5e3a7fb6af
child 308 7830b8253b5a
equal deleted inserted replaced
215:b61c19d4168d 307:22ecbfc20eb4
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!-- 
       
     3 ============================================================================ 
       
     4 Name        : logging.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="logging" xmlns:hlm="http://www.nokia.com/helium">
       
    24     <description>
       
    25         Targets related to log parsing, rendaring, upload to diamonds etc.
       
    26     </description>
       
    27     <!-- Merges all XML log files ending in ".log2.xml" in the build log directory
       
    28     into a single summary log file. -->
       
    29     <target name="log-merge" unless="metadata.enable" >
       
    30         <mkdir dir="${build.log.dir}"/>
       
    31         <dependset>
       
    32             <srcfileset dir="${build.log.dir}" includes="${build.id}*.log.xml"/>
       
    33             <targetfileset file="${build.summary.file}"/>
       
    34         </dependset>
       
    35         <if>
       
    36             <not>
       
    37                 <available file="${build.summary.file}"/>
       
    38             </not>
       
    39             <then>
       
    40                 <echo>Merging all *.log.xml files</echo>        
       
    41                 <mkdir dir="${build.log.dir}/summary"/>
       
    42                 <xmltask  dest="${build.summary.file}">
       
    43                     <insert path="/"  >
       
    44                     <![CDATA[
       
    45                     <logSummary/>
       
    46                     ]]>
       
    47                     </insert>
       
    48                 </xmltask>
       
    49                 <for param="file">
       
    50                     <path>
       
    51                         <fileset dir="${build.log.dir}">
       
    52                             <include name="${build.id}*.log.xml"/>
       
    53                         </fileset>
       
    54                     </path>
       
    55                     <sequential>
       
    56                         <echo>Inserting @{file} into summary.</echo>
       
    57                         <!--<xmltask source="${build.summary.file}"
       
    58                                  dest="${build.summary.file}">
       
    59                            <insert path="/logSummary" file="@{file}" />
       
    60                         </xmltask>-->
       
    61                         <hlm:assertPropertySet property="build.summary.file" message="Property build.summary.file is not defined." />
       
    62                         <script language="jython" setbeans="false">
       
    63 # Temporary solution
       
    64 import log2xml
       
    65 log2xml.append_summary(project.getProperty('build.summary.file'), r'@{file}')
       
    66                         </script>                        
       
    67                     </sequential>
       
    68                 </for>
       
    69             </then>
       
    70             <else>
       
    71                 <echo>Summary XML log file does not need updating.</echo>
       
    72             </else>
       
    73         </if>
       
    74     </target>
       
    75     
       
    76     
       
    77     <!-- Outputs an HTML readable version of the summary log. -->
       
    78     <target name="render-log-summary">
       
    79         <fmpp sourceFile="${helium.dir}/tools/common/templates/log/summary_metadata.html.ftl"
       
    80                      outputfile="${build.log.dir}/summary/${build.id}_summary.html">
       
    81             <freemarkerLinks expandProperties="yes">
       
    82                 macro: ${helium.dir}/tools/common/templates/macro
       
    83             </freemarkerLinks>
       
    84             <data expandProperties="yes">
       
    85                 dbPath: ${metadata.dbfile}
       
    86                 loginfo: xml(${build.log.dir}/${build.id}_info.log.xml)
       
    87                 ant: antProperties()
       
    88             </data>
       
    89         </fmpp>
       
    90     </target>
       
    91     
       
    92     <!-- Prepare email for build summary -->
       
    93     <target name="logger-email" depends="log-merge">
       
    94         <fmpp sourceRoot="${helium.dir}/tools/common/templates/log" includes="email.html.ftl" outputRoot="${build.log.dir}/summary"
       
    95               replaceExtension="html.ftl, html">
       
    96             <data expandProperties="yes">
       
    97                 doc: xml(${build.summary.file})
       
    98                 ant: antProperties()
       
    99             </data>
       
   100         </fmpp>        
       
   101     </target>
       
   102     
       
   103 
       
   104     <!-- Test target to show how Diamond metadata could be rendered. -->
       
   105     <target name="render-diamonds-data" depends="log-merge">
       
   106         <mkdir dir="${build.log.dir}/summary/diamonds"/>
       
   107         <fmpp sourceRoot="${helium.dir}/tools/common/templates/diamonds"
       
   108               outputRoot="${build.log.dir}/summary/diamonds" includes="diamonds.xml.ftl"
       
   109               replaceExtension="xml.ftl, xml">
       
   110             <data expandProperties="yes">
       
   111                 doc: xml(${build.summary.file})
       
   112                 ant: antProperties()
       
   113             </data>
       
   114         </fmpp>
       
   115     </target>
       
   116 
       
   117     
       
   118     <!-- Render the CC dashboad summary. -->
       
   119     <target name="render-cc-summary" depends="log-merge">
       
   120         <mkdir dir="${build.log.dir}/summary"/>
       
   121         <fmpp sourceFile="${helium.dir}/tools/common/templates/log/cc_summary_metadata.html.ftl"
       
   122                      outputfile="${build.log.dir}/summary/${build.id}_cc_summary.html">
       
   123             <data expandProperties="yes">
       
   124                 dbPath: ${metadata.dbfile}
       
   125                 ant: antProperties()
       
   126             </data>
       
   127         </fmpp>
       
   128     </target>
       
   129 
       
   130     
       
   131     <!-- Creates a full summary log from all the build logs. -->
       
   132     <target name="build-log-summary" depends="render-log-summary"/>
       
   133     
       
   134     <!-- Test target to check signal. -->
       
   135     <target name="check-signal" />
       
   136     
       
   137 </project>