buildframework/helium/tools/common/common.antlib.xml
changeset 217 0f5e3a7fb6af
parent 179 d8ac696cc51f
child 587 85df38eb4012
--- a/buildframework/helium/tools/common/common.antlib.xml	Fri Feb 05 11:59:41 2010 +0000
+++ b/buildframework/helium/tools/common/common.antlib.xml	Thu Mar 04 15:10:37 2010 +0200
@@ -20,6 +20,7 @@
 
 ============================================================================
 -->
+<!--* @package framework -->
 <antlib xmlns:au="org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium">
     
     
@@ -170,7 +171,10 @@
              match = pattern.matcher(line);
             if (match.find()) {
                 //self.log("Line containg " + search + " is = " + line + " returned vaue = " + match.group(1));
-                output = output + match.group(1) + ",";
+                int checkIndex = output.indexOf(match.group(1), 0);
+                if (checkIndex == -1 ) {
+                   output = output + match.group(1) + ",";
+                }
             }
         }
     } catch (IOException ex) {
@@ -214,63 +218,6 @@
     </scriptdef>
 
 
-    <!-- Macro to record content to a separate log file without recording in the main log. -->
-    <macrodef name="recordStartMacro" uri="http://www.nokia.com/helium">
-        <attribute name="name"/>
-        <attribute name="emacsmode" default="false"/>
-        <sequential>
-            <if>
-                <available file="${build.log.dir}" type="dir"/>
-                <then>
-                    <hlm:record name="${build.log.dir}/@{name}" action="start" append="true" emacsmode="@{emacsmode}" loglevel="${ant.loglevel}"/>
-                </then>
-            </if>
-        </sequential>
-    </macrodef>
-
-
-    <!-- Macro to stop recording content to a separate log file without recording in the main log. -->
-    <macrodef name="recordStopMacro" uri="http://www.nokia.com/helium">
-        <attribute name="name"/>
-        <sequential>
-            <if>
-                <available file="${build.log.dir}/@{name}"/>
-                <then>
-                    <hlm:record name="${build.log.dir}/@{name}" action="stop" append="true"/>
-                </then>
-            </if>
-        </sequential>
-    </macrodef>
-
-    
-    <!--Macro to stop recording to the main log file (if present) and record to
-        a separate log file that is filtered after logging is stopped. -->
-    <macrodef name="filterRecordStartMacro" uri="http://www.nokia.com/helium">
-        <attribute name="pattern" default=""/>
-        <attribute name="category" default=""/>
-        <sequential>
-            <hlm:record name="${build.cache.log.dir}/temp_ant_build.log" action="start" loglevel="${ant.loglevel}">
-                <hlm:recordfilter category="@{category}" regexp="@{pattern}" />
-            </hlm:record>
-        </sequential>
-    </macrodef>
-    
-
-    <!--Macro to stop recording the seperate filtered log file, filter the passwords
-    and start recording in main log file -->
-    <macrodef name="filterRecordStopMacro" uri="http://www.nokia.com/helium">
-        <attribute name="log" default="${build.log}"/>
-        <attribute name="append" default="true"/>
-        <sequential>
-            <hlm:record name="${build.cache.log.dir}/temp_ant_build.log" action="stop"/>                    
-            <concat destfile="@{log}" append="@{append}">
-                <filelist dir="${build.cache.log.dir}" files="temp_ant_build.log"/>                        
-            </concat>
-            <delete file="${build.cache.log.dir}/temp_ant_build.log" failonerror="false"/>
-            <echo>End of filtering @{log} for passwords</echo>
-        </sequential>
-    </macrodef>
-    
     
     <!-- A generic assert macro similar to AntUnit "assertTrue". -->
     <macrodef name="assert" uri="http://www.nokia.com/helium">
@@ -523,127 +470,6 @@
         ]]>
      </scriptdef>
 
-    <!-- Extract logs from text file and process error/warnings/components name etc
-    into xml file.
-    <deprecated>Please consider using the metadata framework.</deprecated>
-    -->
-    <scriptdef name="logextract" language="jython"  uri="http://www.nokia.com/helium">
-        <attribute name="file" />
-        <attribute name="outputfile" />
-        <element name="fileset" type="fileset"/>
-        <element name="logfilterset" classname="com.nokia.ant.types.LogFilterSet"/>
-        <![CDATA[
-import os.path
-import log2xml
-import java.io
-
-def convertFile(inputfile, outputfile, config):
-    if (outputfile != None):
-        print "output file not none"
-        print "output file: %s" % outputfile
-        targetfile = str(outputfile)
-    else:
-        #print "output file: %s" % outputfile
-        targetfile = "%s.xml" % inputfile
-        #print "targetFile %s" % targetfile
-    if not os.path.exists(targetfile) or \
-       (os.path.exists(targetfile) and os.path.getmtime(inputfile) > os.path.getmtime(targetfile)):
-        self.getProject().log("Converting %s..." % inputfile)
-        log2xml.convert(inputfile, targetfile, False, config)
-    else:
-        self.getProject().log("Extracted log is uptodate: %s" % inputfile)
-        
-config = log2xml.DEFAULT_CONFIGURATION
-logfilterset = elements.get("logfilterset")
-if logfilterset != None and logfilterset.size() > 0:
-    # if any logfilterset are dfined then
-    # it override the default configuration
-    config = {}
-    for filtersetid in range(logfilterset.size()):
-        filterset = logfilterset.get(filtersetid)
-        if filterset.isReference():
-            filterset = filterset.getRefid().getReferencedObject(project)
-        filters = filterset.getFilters()
-        for filterid in range(filters.size()):
-            if not filters.get(filterid).getCategory() in config:
-                config[filters.get(filterid).getCategory()] = []
-            config[filters.get(filterid).getCategory()].append(str(filters.get(filterid).getRegex()))
-
-fileset = elements.get("fileset")
-outputfile = attributes.get("outputfile")
-if fileset != None and fileset.size() > 0:
-    for filesetid in range(fileset.size()):
-        dirscanner = fileset.get(filesetid).getDirectoryScanner(project)
-        for filename in dirscanner.getIncludedFiles():
-            inputfile = str(java.io.File(dirscanner.getBasedir(), str(filename)).getAbsolutePath())
-            convertFile(inputfile, outputfile, config)
-elif attributes.get("file") != None:
-    inputfile = str(java.io.File(str(attributes.get("file"))).getAbsolutePath())
-    convertFile(inputfile, outputfile, config)
-else:
-    self.log("No input specified.")
-        ]]>
-    </scriptdef>
-    
-    
-    <!--Macro to stop recording to the main log file (if present) and record to
-        a separate log file into a temporary location (doesn't need the build aread to work). -->
-    <macrodef name="tempRecordStartMacro" uri="http://www.nokia.com/helium">
-        <attribute name="name"/>
-        <sequential>
-            <mkdir dir="${build.cache.log.dir}"/>
-            <hlm:record name="${build.cache.log.dir}/@{name}" action="start" loglevel="${ant.loglevel}"/>
-        </sequential>
-    </macrodef>
-
-
-    <!--Macro to restart  the main log file (if present) and stop recording to
-        a separate log file into a temporary location the file is next xml summarized 
-        and potentially copied to the build area (if exists). Else those files will get copied during the 
-        build area preparation. -->
-    <macrodef name="tempRecordStopMacro" uri="http://www.nokia.com/helium">
-        <attribute name="name"/>
-        <attribute name="phase" default=""/>
-        <attribute name="database" default="${metadata.dbfile}"/>
-        <attribute name="filterref" default="filterset.temprecord"/>
-        <sequential>
-            <mkdir dir="${build.cache.log.dir}"/>
-            <mkdir dir="${build.log.dir}"/>
-            <mkdir dir="${build.cache.log.dir}/signals"/>
-            <hlm:record name="${build.cache.log.dir}/@{name}" action="stop" loglevel="${ant.loglevel}"/>
-            <!--Temporary solution, the logextract in general 
-                needs to be handled in a better way (not all logs needs to be processed,
-                logextract / counting errors could be merged and logextract should be
-                executed on a need basis and not to process for all stopmacro.-->
-            <!-- Todo: metadata: replace logextract -->
-            <hlm:metadatarecord database="@{database}">
-                <hlm:antmetadatainput>
-                    <fileset casesensitive="false" file="${build.cache.log.dir}/@{name}" />
-                    <metadatafilterset refid="@{filterref}" />
-                </hlm:antmetadatainput>
-            </hlm:metadatarecord>
-            <hlm:generateBuildStatus dbfile="@{database}" output-dir="${build.cache.log.dir}/signals" file="@{name}" />
-            <if>
-                <isset property="@{phase}.log.dir" />
-                <then>
-                    <mkdir dir="${@{phase}.log.dir}"/>
-                    <copy todir="${@{phase}.log.dir}" failonerror="false">
-                        <fileset casesensitive="false" file="${build.cache.log.dir}/@{name}" />
-                    </copy>
-                </then>
-                <else>
-                    <copy todir="${build.log.dir}" failonerror="false">
-                        <fileset casesensitive="false" file="${build.cache.log.dir}/@{name}" />
-                    </copy>
-                </else>
-            </if>            
-            <copy todir="${build.signal.status.dir}" failonerror="false">
-                <fileset casesensitive="false" dir="${build.cache.log.dir}/signals" />
-            </copy>
-        </sequential>
-    </macrodef>
-    
-
     <macrodef name="signalMacro" uri="http://www.nokia.com/helium">
         <attribute name="logfile"/>
         <attribute name="phase" default=""/>
@@ -653,7 +479,7 @@
         <sequential>
             <var name="signal.errors.total" value="" unset="true"/>
             <var name="base.signal.log.file" value="" unset="true"/>
-            <basename property="base.signal.log.file" file="@{logfile}" suffix=".log"/>
+            <basename property="base.signal.log.file" file="@{logfile}"/>
             <if>
                 <isfalse value="@{skip.count}" />
                 <then>
@@ -690,7 +516,7 @@
                 <signalNotifierInput>
                     <signalInput refid="@{signal.input}" />
                     <notifierInput>
-                        <fileset dir="${build.log.dir}" >
+                        <fileset casesensitive="false" dir="${build.log.dir}" >
                             <include name="**/${base.signal.log.file}*" />
                         </fileset>
                     </notifierInput>
@@ -699,65 +525,6 @@
         </sequential>
     </macrodef>
 
-    <!-- Macro to start logging to a separate log file.
-    
-    This will stop logging to the main ant_build log file until stopSpecificLogMacro
-    is called. -->
-    <macrodef name="startSpecificLogMacro">
-        <attribute name="name"/>
-        <attribute name="regexp" default=""/>
-        <attribute name="backup" default="false"/>
-        <attribute name="phase" default=""/>
-        
-        <sequential>
-            <if>
-                <isset property="@{phase}.log.dir" />
-                <then>
-                    <mkdir dir="${@{phase}.log.dir}"/>
-                </then>
-            </if> 
-            <mkdir dir="@{name}/.."/>
-            <hlm:record name="@{name}" action="start" loglevel="verbose" >
-                <hlm:recordfilter category="@{phase}" regexp="@{regexp}" />
-            </hlm:record>
-        </sequential>
-    </macrodef>
-
-
-    <!--Macro to restart  the main log file (if present) and stop recording to
-        a separate log file. -->
-    <macrodef name="stopSpecificLogMacro">
-        <attribute name="name"/>
-        <attribute name="phase" default=""/>
-        <sequential>
-            <hlm:record name="@{name}" action="stop" loglevel="verbose"/>
-        </sequential>
-    </macrodef>
-
-    <!-- Temp BMD macro -->
-    <macrodef name="bmdLogExtractMacro" uri="http://www.nokia.com/helium">
-        <attribute name="log"/>
-        <attribute name="metadatafilterset" default="common"/>
-        <sequential>
-            <hlm:metadatarecord database="${metadata.dbfile}">
-                <hlm:textmetadatainput>
-                    <fileset casesensitive="false" file="@{log}"/>
-                    <metadatafilterset refid="@{metadatafilterset}" />
-                </hlm:textmetadatainput>
-            </hlm:metadatarecord>
-            <!-- todo: check to add for usage and add genbuildstatus macro -->
-            <basename property="log.name" file="@{log}"/>
-            <fmpp sourceFile="${helium.dir}/tools/common/templates/db2xml.xml.ftl"
-                         outputfile="@{log}.xml">
-                <data expandProperties="yes">
-                    dbPath: ${metadata.dbfile}
-                    log: ${log.name}
-                    ant: antProperties()
-                </data>
-            </fmpp>
-        </sequential>
-    </macrodef>
-
     <!-- A simple test macro -->
     <macrodef name="fooMacro" uri="http://www.nokia.com/helium">
         <sequential>