buildframework/helium/tools/compile/compile.antlib.xml
changeset 179 d8ac696cc51f
parent 1 be27ed110b50
child 217 0f5e3a7fb6af
child 593 4367a1b2db65
equal deleted inserted replaced
1:be27ed110b50 179:d8ac696cc51f
    24     <!-- This task transfer the log file into html format -->
    24     <!-- This task transfer the log file into html format -->
    25     <macrodef name="compileHtmlscanlogMacro" uri="http://www.nokia.com/helium">
    25     <macrodef name="compileHtmlscanlogMacro" uri="http://www.nokia.com/helium">
    26         <attribute name="input"/>
    26         <attribute name="input"/>
    27         <attribute name="output"/>
    27         <attribute name="output"/>
    28         <sequential>
    28         <sequential>
    29             <exec dir="${build.drive}/" executable="perl" failonerror="${failonerror}">
    29             <exec executable="perl" dir="${build.drive}/" failonerror="${failonerror}">
    30                 <arg value="${epocroot}epoc32/tools/htmlscanlog.pl"/>
    30                 <arg value="${epocroot}epoc32/tools/htmlscanlog.pl"/>
    31                 <arg value="-v"/>
    31                 <arg value="-v"/>
    32                 <arg value="-v"/>
    32                 <arg value="-v"/>
    33                 <arg value="-l"/>
    33                 <arg value="-l"/>
    34                 <arg file="@{input}"/>
    34                 <arg file="@{input}"/>
    46                 <not>
    46                 <not>
    47                     <isset property="skip.diamonds"/>
    47                     <isset property="skip.diamonds"/>
    48                 </not>
    48                 </not>
    49                 <then>
    49                 <then>
    50                     <fmpp sourceFile="${helium.dir}/tools/common/templates/diamonds/faults_metadata.ftl"
    50                     <fmpp sourceFile="${helium.dir}/tools/common/templates/diamonds/faults_metadata.ftl"
    51                                  outputfile="${build.log.dir}/compile-main.xml">
    51                                  outputfile="${diamonds.build.output.dir}/compile-main.xml">
    52                         <data expandProperties="yes">
    52                         <data expandProperties="yes">
    53                             dbPath: ${metadata.dbfile}
    53                             dbPath: ${metadata.dbfile}
    54                             logpath: @{logfile} 
    54                             logpath: @{logfile} 
    55                             ant: antProperties()
    55                             ant: antProperties()
    56                         </data>
    56                         </data>
    61     </macrodef>
    61     </macrodef>
    62 
    62 
    63     <macrodef name="compileLogSignalMacro" uri="http://www.nokia.com/helium">
    63     <macrodef name="compileLogSignalMacro" uri="http://www.nokia.com/helium">
    64         <attribute name="compile.summary.file"/>
    64         <attribute name="compile.summary.file"/>
    65         <attribute name="error.limit"/>
    65         <attribute name="error.limit"/>
       
    66         <attribute name="phase" default="compile"/>
    66         <sequential>
    67         <sequential>
    67             <hlm:metadataCountSeverity severity="ERROR" log="@{compile.summary.file}" 
    68             <hlm:metadataCountSeverity severity="ERROR" log="@{compile.summary.file}" 
    68                 db="${metadata.dbfile}" 
    69                 db="${metadata.dbfile}" 
    69                 property="build.errors.total"/>
    70                 property="build.errors.total"/>
    70                 
    71                 
    72             <echo message="${build.errors.limit}" />
    73             <echo message="${build.errors.limit}" />
    73             <echo message="@{error.limit}" />
    74             <echo message="@{error.limit}" />
    74             <if>
    75             <if>
    75                 <scriptcondition language="jython" value="false">
    76                 <scriptcondition language="jython" value="false">
    76 errorsTotal = project.getProperty("build.errors.total")
    77 errorsTotal = project.getProperty("build.errors.total")
    77 errorsLimit = project.getProperty("build.errors.limit")
    78 if int(r'@{error.limit}') > -1:
    78 if int(errorsLimit) > -1:
    79     if int(errorsTotal) > int(r'@{error.limit}'):
    79     if int(errorsTotal) > int(errorsLimit):
       
    80         self.setValue(1)
    80         self.setValue(1)
    81                 </scriptcondition>
    81                 </scriptcondition>
    82                 <then>
    82                 <then>
    83                     <property name="compile.result" value="1"/>
    83                     <property name="compile.result" value="1"/>
    84                 </then>
    84                 </then>
    86                     <property name="compile.result" value="0"/>
    86                     <property name="compile.result" value="0"/>
    87                 </else>
    87                 </else>
    88             </if>
    88             </if>
    89             <echo message="compile result:${compile.result}" />
    89             <echo message="compile result:${compile.result}" />
    90             <hlm:signalMacro skip.count="true" result="${compile.result}" 
    90             <hlm:signalMacro skip.count="true" result="${compile.result}" 
    91                 logfile="@{compile.summary.file}" 
    91                 logfile="@{compile.summary.file}"
       
    92                 phase="@{phase}" 
    92                 signal.input="${compile.signal.input}" />
    93                 signal.input="${compile.signal.input}" />
    93         </sequential>
    94         </sequential>
    94     </macrodef>
    95     </macrodef>
    95     
    96     
    96     <!-- Macro to start the build using EBS. Parameters are generated xml file for EBS builds
    97     <!-- Macro to start the build using EBS. Parameters are generated xml file for EBS builds
   146         the build environment.
   147         the build environment.
   147     -->
   148     -->
   148     <macrodef name="compileGenxmlMergeMacro" uri="http://www.nokia.com/helium">
   149     <macrodef name="compileGenxmlMergeMacro" uri="http://www.nokia.com/helium">
   149         <attribute name="input"/>
   150         <attribute name="input"/>
   150         <attribute name="output"/>
   151         <attribute name="output"/>
   151         <sequential>
   152         <attribute name="logfile"/>
       
   153         <sequential>
       
   154             <echo message="input:@{input}" />
       
   155             <echo message="output:@{output}" />
       
   156             <mkdir dir="${compile.log.dir}"/>
       
   157             <mkdir dir="${temp.build.dir}"/>
   152             <copy todir="${build.drive}/" verbose="true">
   158             <copy todir="${build.drive}/" verbose="true">
   153                 <fileset dir="${helium.dir}/tools/common/dtd" includes="*.dtd"/>
   159                 <fileset dir="${helium.dir}/tools/common/dtd" includes="*.dtd"/>
   154             </copy>
   160             </copy>
   155             <preset.exec executable="perl" dir="${build.drive}/" failonerror="${failonerror}" output="${build.log.dir}/${build.id}.sysdef_GenxmlMerge.log">
   161             <preset.exec executable="perl" dir="${build.drive}/" failonerror="${failonerror}" output="@{logfile}">
   156                 <arg value="${epocroot}epoc32/tools/build/genxml.pl"/>
   162                 <arg value="${epocroot}epoc32/tools/build/genxml.pl"/>
   157                 <arg value="-s"/>
   163                 <arg value="-s"/>
   158                 <arg value="${epocroot}"/>
   164                 <arg value="${epocroot}"/>
   159                 <arg value="-m"/>
   165                 <arg value="-m"/>
   160                 <arg value="@{output}"/>              
   166                 <arg value="@{output}"/>              
   163             <if>
   169             <if>
   164                 <not>
   170                 <not>
   165                     <available file="@{output}"/>
   171                     <available file="@{output}"/>
   166                 </not>
   172                 </not>
   167                 <then>
   173                 <then>
       
   174                     <echo file="@{logfile}" message="ERROR: Check @{input}" append="true"/>
   168                     <!-- Todo: metadata: Make sure that logfilter is added to the filterset -->
   175                     <!-- Todo: metadata: Make sure that logfilter is added to the filterset -->
   169                     <hlm:metadatarecord database="${metadata.dbfile}">
   176                     <hlm:metadatarecord database="${metadata.dbfile}">
   170                         <hlm:textmetadatainput>
   177                         <hlm:textmetadatainput>
   171                             <fileset casesensitive="false" file="${build.log.dir}/${build.id}.sysdef_GenxmlMerge.log" />
   178                             <fileset casesensitive="false" file="@{logfile}" />
   172                             <metadatafilterset>
       
   173                                 <metadatafilter priority="ERROR" regex="^ERROR:" description="genxml error" />
       
   174                                 <metadatafilter priority="ERROR" regex="^Context:" description="genxml context error" />
       
   175                             </metadatafilterset>
       
   176                             <metadatafilterset refid="filterset.genxml.merge" />
   179                             <metadatafilterset refid="filterset.genxml.merge" />
   177                         </hlm:textmetadatainput>
   180                         </hlm:textmetadatainput>
   178                     </hlm:metadatarecord>
   181                     </hlm:metadatarecord>
   179                     <hlm:generateBuildStatus file="${build.id}.sysdef_GenxmlMerge.log" />
   182                     <hlm:generateBuildStatus file="${build.id}.sysdef_GenxmlMerge.log" />
   180                     <hlm:signal name="canonicalSysDefFailSignal" result="1" >
   183                     <hlm:signal name="canonicalSysDefFailSignal" result="1" >
   181                         <signalNotifierInput>
   184                         <signalNotifierInput>
   182                             <signalInput refid="canonicalSysDefFailSignalInput" />
   185                             <signalInput refid="canonicalSysDefFailSignalInput" >
   183                             <notifierInput file = "${build.signal.status.dir}/${build.id}.sysdef_GenxmlMerge.log.status.html" />
   186                                 <notifierInput>
       
   187                                     <fileset dir="${build.log.dir}" >
       
   188                                         <include name="**/${build.id}.sysdef_GenxmlMerge.log*" />
       
   189                                     </fileset>
       
   190                                 </notifierInput>
       
   191                             </signalInput>
   184                         </signalNotifierInput>
   192                         </signalNotifierInput>
   185                     </hlm:signal>
   193                     </hlm:signal>
   186                 </then>
   194                 </then>
   187             </if>
   195             </if>
   188 
   196 
   231         <attribute name="target"/>
   239         <attribute name="target"/>
   232         <attribute name="custom"/>
   240         <attribute name="custom"/>
   233         <attribute name="dir"/>
   241         <attribute name="dir"/>
   234         <attribute name="annodetail"/>
   242         <attribute name="annodetail"/>
   235         <attribute name="root"/> 
   243         <attribute name="root"/> 
   236         <attribute name="failonerror"/> 
   244         <attribute name="failonerror"/>
       
   245         <attribute name="phase"/>
   237           self.setTaskName("emake");
   246           self.setTaskName("emake");
   238           // check attributes
   247           // check attributes
   239           if (attributes.get("name") == null)
   248           if (attributes.get("name") == null)
   240             throw new org.apache.tools.ant.BuildException("name attribute is not defined");
   249             throw new org.apache.tools.ant.BuildException("name attribute is not defined");
   241           self.log("Name: " + attributes.get("name"));
   250           self.log("Name: " + attributes.get("name"));
   242           if (attributes.get("makefile") == null)
   251           if (attributes.get("makefile") == null)
   243             throw new org.apache.tools.ant.BuildException("makefile attribute is not defined");
   252             throw new org.apache.tools.ant.BuildException("makefile attribute is not defined");
   244           self.log("Makefile: " + attributes.get("makefile"));
   253           self.log("Makefile: " + attributes.get("makefile"));
   245           String target = "all";
   254           String target = "all";
   246           String custom = "";
   255           String custom = "";
       
   256           String annofileDir = "";
   247           if (attributes.get("target") != null)
   257           if (attributes.get("target") != null)
   248             target = attributes.get("target");
   258             target = attributes.get("target");
   249           self.log("Target: " + target);
   259           self.log("Target: " + target);
   250           if (attributes.get("custom") != null)
   260           if (attributes.get("custom") != null)
   251             custom = attributes.get("custom");
   261             custom = attributes.get("custom");
   252           if (attributes.get("root") != null)
   262           if (attributes.get("root") != null)
   253             root = attributes.get("root");
   263             root = attributes.get("root");
   254           else
   264           else
   255             root = "";
   265             root = "";
       
   266           
   256           self.log("Custom: " + custom);
   267           self.log("Custom: " + custom);
   257 
   268 
   258       // Create and configure exec target
   269       // Create and configure exec target
   259           org.apache.tools.ant.taskdefs.ExecTask task = new org.apache.tools.ant.taskdefs.ExecTask();
   270           org.apache.tools.ant.taskdefs.ExecTask task = new org.apache.tools.ant.taskdefs.ExecTask();
       
   271           task.setProject(self.getProject());
   260           task.setTaskName(self.getTaskName());
   272           task.setTaskName(self.getTaskName());
   261           String emake = com.nokia.ant.util.Helper.getProperty(project, "ec.emake");          
   273           String emake = com.nokia.ant.util.Helper.getProperty(project, "ec.emake");          
   262           task.setExecutable(emake);
   274           task.setExecutable(emake);
   263           if (attributes.get("failonerror") != null) {
   275           if (attributes.get("failonerror") != null) {
   264             task.setFailonerror(Boolean.parseBoolean(attributes.get("failonerror")));
   276             task.setFailonerror(Boolean.parseBoolean(attributes.get("failonerror")));
   283           String heliumDir = com.nokia.ant.util.Helper.getProperty(project, "helium.dir"); 
   295           String heliumDir = com.nokia.ant.util.Helper.getProperty(project, "helium.dir"); 
   284           if (attributes.get("root") != null) {
   296           if (attributes.get("root") != null) {
   285             self.log("--emake-root=" + eroot + ";" + heliumDir + ";" + root);
   297             self.log("--emake-root=" + eroot + ";" + heliumDir + ";" + root);
   286           }         
   298           }         
   287           task.createArg().setValue("--emake-root=" + eroot + ";" + heliumDir + ";" + root);
   299           task.createArg().setValue("--emake-root=" + eroot + ";" + heliumDir + ";" + root);
       
   300           if (attributes.get("phase") != null) {
       
   301             annofileDir = com.nokia.ant.util.Helper.getProperty(project, "build.log.dir") + "/" + attributes.get("phase");
       
   302           }
       
   303           else {
       
   304             annofileDir = com.nokia.ant.util.Helper.getProperty(project, "build.log.dir");  
       
   305           }
   288           if (attributes.get("annodetail") != null) {
   306           if (attributes.get("annodetail") != null) {
   289             task.createArg().setValue("--emake-annodetail=" + attributes.get("annodetail"));            
   307             task.createArg().setValue("--emake-annodetail=" + attributes.get("annodetail"));            
   290             task.createArg().setValue("--emake-annofile=" + com.nokia.ant.util.Helper.getProperty(project, "build.log.dir") + "/" + buildId + "-" + attributes.get("name") + ".anno.xml");
   308             task.createArg().setValue("--emake-annofile=" + annofileDir + "/" + buildId + "-" + attributes.get("name") + ".emake.anno.xml");
   291           }
   309           }
   292           task.createArg().setLine(custom);
   310           task.createArg().setLine(custom);
   293           task.createArg().setLine("-f " + attributes.get("makefile"));
   311           task.createArg().setLine("-f " + attributes.get("makefile"));
   294           task.createArg().setLine(target);
   312           task.createArg().setLine(target);
   295           // Execute.
   313           // Execute.