buildframework/helium/tools/common/logging.ant.xml
changeset 217 0f5e3a7fb6af
parent 181 59bb7c4d6172
child 307 22ecbfc20eb4
child 584 56dd7656a965
child 587 85df38eb4012
equal deleted inserted replaced
181:59bb7c4d6172 217:0f5e3a7fb6af
     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                         <fileset dir="${temp.build.dir}">
       
    55                             <include name="**/${build.id}*.log.xml"/>
       
    56                         </fileset>
       
    57                     </path>
       
    58                     <sequential>
       
    59                         <echo>Inserting @{file} into summary.</echo>
       
    60                         <!--<xmltask source="${build.summary.file}"
       
    61                                  dest="${build.summary.file}">
       
    62                            <insert path="/logSummary" file="@{file}" />
       
    63                         </xmltask>-->
       
    64                         <hlm:assertPropertySet property="build.summary.file" message="Property build.summary.file is not defined." />
       
    65                         <script language="jython" setbeans="false">
       
    66 # Temporary solution
       
    67 import log2xml
       
    68 log2xml.append_summary(project.getProperty('build.summary.file'), r'@{file}')
       
    69                         </script>                        
       
    70                     </sequential>
       
    71                 </for>
       
    72             </then>
       
    73             <else>
       
    74                 <echo>Summary XML log file does not need updating.</echo>
       
    75             </else>
       
    76         </if>
       
    77     </target>
       
    78     
       
    79     
       
    80     <!-- Outputs an HTML readable version of the summary log. -->
       
    81     <target name="render-log-summary">
       
    82         <if>
       
    83             <and>
       
    84                 <available file="${build.log.dir}/${build.id}_info.log.xml"/>
       
    85                 <available file="${metadata.dbfile}"/>
       
    86             </and>
       
    87             <then>
       
    88                 <fmpp sourceFile="${helium.dir}/tools/common/templates/log/summary_metadata.html.ftl"
       
    89                              outputfile="${build.log.dir}/${build.id}_summary.html">
       
    90                     <freemarkerLinks expandProperties="yes">
       
    91                         macro: ${helium.dir}/tools/common/templates/macro
       
    92                     </freemarkerLinks>
       
    93                     <data expandProperties="yes">
       
    94                         dbPath: ${metadata.dbfile}
       
    95                         loginfo: xml(${build.log.dir}/${build.id}_info.log.xml)
       
    96                         ant: antProperties()
       
    97                     </data>
       
    98                 </fmpp>
       
    99                 <if>
       
   100                     <not>
       
   101                         <available file="${build.log.dir}/${build.id}_summary.html"/>
       
   102                     </not>
       
   103                     <then>
       
   104                         <echo message="Error: failed to generate Summary file" />
       
   105                     </then>
       
   106                 </if>
       
   107             </then>
       
   108         </if>
       
   109     </target>
       
   110     
       
   111     <!-- Prepare email for build summary -->
       
   112     <target name="logger-email" depends="log-merge">
       
   113         <fmpp sourceRoot="${helium.dir}/tools/common/templates/log" includes="email.html.ftl" outputRoot="${build.log.dir}/summary"
       
   114               replaceExtension="html.ftl, html">
       
   115             <data expandProperties="yes">
       
   116                 doc: xml(${build.summary.file})
       
   117                 ant: antProperties()
       
   118             </data>
       
   119         </fmpp>        
       
   120     </target>
       
   121     
       
   122 
       
   123     <!-- Test target to show how Diamond metadata could be rendered. -->
       
   124     <target name="render-diamonds-data" depends="log-merge">
       
   125         <mkdir dir="${build.log.dir}/summary/diamonds"/>
       
   126         <fmpp sourceRoot="${helium.dir}/tools/common/templates/diamonds"
       
   127               outputRoot="${build.log.dir}/summary/diamonds" includes="diamonds.xml.ftl"
       
   128               replaceExtension="xml.ftl, xml">
       
   129             <data expandProperties="yes">
       
   130                 doc: xml(${build.summary.file})
       
   131                 ant: antProperties()
       
   132             </data>
       
   133         </fmpp>
       
   134     </target>
       
   135 
       
   136     
       
   137     <!-- Render the CC dashboad summary. -->
       
   138     <target name="render-cc-summary" depends="log-merge">
       
   139         <mkdir dir="${build.log.dir}/summary"/>
       
   140         <fmpp sourceFile="${helium.dir}/tools/common/templates/log/cc_summary_metadata.html.ftl"
       
   141                      outputfile="${build.log.dir}/summary/${build.id}_cc_summary.html">
       
   142             <data expandProperties="yes">
       
   143                 dbPath: ${metadata.dbfile}
       
   144                 ant: antProperties()
       
   145             </data>
       
   146         </fmpp>
       
   147     </target>
       
   148 
       
   149     
       
   150     <!-- Creates a full summary log from all the build logs. -->
       
   151     <target name="build-log-summary" depends="render-log-summary"/>
       
   152     
       
   153     <!-- Test target to check signal. -->
       
   154     <target name="check-signal" />
       
   155     
       
   156 </project>