buildframework/helium/tools/compile/sbs/sbs.ant.xml
changeset 179 d8ac696cc51f
parent 1 be27ed110b50
child 217 0f5e3a7fb6af
child 593 4367a1b2db65
equal deleted inserted replaced
1:be27ed110b50 179:d8ac696cc51f
    70             </copy>
    70             </copy>
    71             <delete file="${build.drive}/output/build/canonical_system_definition_${sysdef.configuration}_temp.xml"/>
    71             <delete file="${build.drive}/output/build/canonical_system_definition_${sysdef.configuration}_temp.xml"/>
    72         </sequential>
    72         </sequential>
    73     </macrodef>
    73     </macrodef>
    74 
    74 
    75     <if>
       
    76         <not>
       
    77             <isset property="sbs.config"/>
       
    78         </not>
       
    79         <then>
       
    80             <property name="sbs.config" value="armv5" />
       
    81             <property name="sbs.tools.config" value="tools_rel" />
       
    82         </then>
       
    83     </if>
       
    84 
       
    85     <import file="sbs.settings.ant.xml" />
       
    86 
       
    87     <!-- SBS build with gmake as engine type. Default is using sbs macro, to use old implementation to
    75     <!-- SBS build with gmake as engine type. Default is using sbs macro, to use old implementation to
    88     use using exec task, then sbs.using.exec needs to be set. -->
    76     use using exec task, then sbs.using.exec needs to be set. -->
    89     <target name="compile-sbs" description="This is the main build that gets built for ARMV5 and WINSCW platforms">
    77     <target name="compile-sbs" description="This is the main build that gets built for ARMV5 and WINSCW platforms">
       
    78         <!-- only temporary once config file option starts to work, then no 
       
    79         need to copy the plugin file -->
       
    80 
    90         <if>
    81         <if>
    91             <or>
    82             <or>
    92                 <equals arg1="${build.system}" arg2="sbs" />
    83                 <equals arg1="${build.system}" arg2="sbs" />
    93                 <equals arg1="${build.system}" arg2="sbs-ec" />
    84                 <equals arg1="${build.system}" arg2="sbs-ec" />
    94             </or>
    85             </or>
    95             <then>
    86             <then>
    96                 <!-- Choosing the right command (either clean or normal command) and 
       
    97                     the default command if no input is specified for sbs -->
       
    98                 <var name="sbs.cmd.reference" value="sbs" />
       
    99                 <var name="sbs.make.reference" value="${build.system}.make.options" />
       
   100                 <hlm:sbsMakeOptions id="sbs.internal.make.options" refid="${sbs.make.reference}" />
       
   101                 <if>
       
   102                     <istrue value="${compile.cmd.clean}"/>
       
   103                     <then>
       
   104                         <var name="sbs.cmd.reference" value="${sbs.cmd.reference}.clean" />
       
   105                     </then>
       
   106                 </if>
       
   107                 <if>
       
   108                     <not>
       
   109                         <isreference refid="${sbs.cmd.reference}.var"/>
       
   110                     </not>
       
   111                     <then>
       
   112                         <var name="sbs.cmd.reference" value="${sbs.cmd.reference}.default" />
       
   113                     </then>
       
   114                 </if>
       
   115                 <if>
       
   116                     <not>
       
   117                         <isreference refid="${sbs.make.reference}"/>
       
   118                     </not>
       
   119                     <then>
       
   120                         <hlm:sbsMakeOptions id="sbs.internal.make.options" refid="${sbs.make.reference}.default" />
       
   121                     </then>
       
   122                 </if>
       
   123                 <var name="sbs.cmd.reference" value="${sbs.cmd.reference}.var" />
       
   124                 <echo message="sbs build:${env.SBS_HOME}/python/plugins/filter_heliumlog.py" />
       
   125 
       
   126                 <!-- Generate the filtered layers -->
       
   127                 <hlm:generate-layers />
       
   128 
       
   129                 <!-- run arm license checking / setting arm version only for arm config --> 
       
   130                 <hlm:getVariableValue name="config" property="compilevalue.var">
       
   131                     <hlm:argSet refid="${sbs.cmd.reference}" />
       
   132                 </hlm:getVariableValue>
       
   133                 <if>
       
   134                     <not>
       
   135                         <equals arg1="${compilevalue.var}" arg2="winscw"/>
       
   136                     </not>
       
   137                     <then>
       
   138                         <runtarget target="set-arm-version"/>
       
   139                     </then>
       
   140                 </if>
       
   141 
       
   142                 <!-- only temporary once config file option starts to work, then no 
       
   143                 need to copy the plugin file -->
       
   144 
       
   145                 <echo message="Copying helium filter plugin to sbs home" />
    87                 <echo message="Copying helium filter plugin to sbs home" />
   146                 <copy file="${helium.dir}/tools/common/python/scripts/filter_metadatalog.py" todir="${env.SBS_HOME}/python/plugins/" failonerror="true" />
    88                 <copy file="${helium.dir}/tools/common/python/scripts/filter_metadatalog.py" todir="${env.SBS_HOME}/python/plugins/" failonerror="true" />
   147                 <copy file="${helium.dir}/tools/common/python/scripts/sbsscanlogmetadata.py" todir="${env.SBS_HOME}/python/plugins/" failonerror="true" />
    89                 <copy file="${helium.dir}/tools/common/python/scripts/sbsscanlogmetadata.py" todir="${env.SBS_HOME}/python/plugins/" failonerror="true" />
   148 
    90                 <echo message="sbs.patternset: ${sbs.patternset}" />
   149 
    91                 <hlm:generate-layers />
   150                 <echo>Building with SBSv2</echo>
    92                 <var name="sbs.inputs.list" value="" unset="true"/>
   151                 <echo message="build.drive:${build.drive}"/>
    93                 <hlm:getsbsinputs config="sbs.${sysdef.configuration}" outputProperty="sbs.inputs.list"/>
   152                 <echo message="build.log.dir:${build.log.dir}"/>
    94                 <for list="${sbs.inputs.list}" delimiter="," param="sbs.input">
   153                 <echo message="sysdef.configuration:${sysdef.configuration}"/>
    95                     <sequential>
   154                 <echo message="canonical.sysdef.file:${canonical.sysdef.file}"/>
    96                         <echo message="building raptor input: @{sbs.input}" />
   155                 <echo message="env.SBS_HOME:${env.SBS_HOME}"/>
    97                         <hlm:getVariableValue name="--logfile" property="sbs.log.file">
   156                 <!-- Implicit calls to tools configuration, for temporary once the sbs is working
    98                             <hlm:sbsinput refid="@{sbs.input}" />
   157                     to execte all configuration at the same time, this could be removed. -->
    99                         </hlm:getVariableValue>
   158                 <if>
   100                         <!-- run arm license checking / setting arm version only for arm config -->
   159                     <istrue value="${sbs.implicit.tools.build}" />
   101                         <hlm:getVariableValue name="-c" property="compilevalue.var" failOnerror="false">
   160                     <then>
   102                             <hlm:sbsinput refid="@{sbs.input}" />
   161                         <echo message="Implicit tools configuration build" />
   103                         </hlm:getVariableValue>
   162                         <hlm:sbsCompileMacro cmdreference = "sbs.implicit.tools.var" />
   104                         <echo message="config parameter -c : ${compilevalue.var}" />
   163                     </then>
   105                         <if>
   164                 </if>
   106                             <and>
   165                 <hlm:sbsCompileMacro cmdreference = "${sbs.cmd.reference}" />
   107                                 <isset property="compilevalue.var"/>
       
   108                                 <matches string="${compilevalue.var}" pattern="arm.*"/>
       
   109                             </and>
       
   110                             <then>
       
   111                                 <runtarget target="set-arm-version"/>
       
   112                             </then>
       
   113                         </if>
       
   114                         <var name="sbs.clean.log" value="${sbs.log.file}.clean.log"/>
       
   115                         <!-- Generate the filtered layers -->
       
   116                         <hlm:sbstask sbsinput="@{sbs.input}" sysdefFile="${build.drive}/output/build/canonical_system_definition_${sysdef.configuration}.xml" 
       
   117                             layerPatternSetRef="${sbs.patternset}" errorOutput="${sbs.log.file}.sbs_error.log" 
       
   118                             workingDir="${build.drive}/" failOnError="false" outputLog="${sbs.log.file}" cleanLog = "${sbs.clean.log}"
       
   119                              statsLog="${compile.log.dir}/${build.id}_${sysdef.configuration}.info.xml" />
       
   120                         <!-- run arm license checking / setting arm version only for arm config --> 
       
   121                         <echo message="sbs.log.file: ${sbs.log.file}" />
       
   122                         <hlm:sbsProcessOutputMacro sbs.log.file="${sbs.log.file}"
       
   123                             sbs.clean.log.file="${sbs.clean.log}"  sbs.stats.file="${compile.log.dir}/${build.id}_${sysdef.configuration}.info.xml"
       
   124                             sbs.ant.output.file="${sbs.log.file}" sbs.error.output.file="${sbs.log.file}.sbs_error.log"/>
       
   125                     </sequential>
       
   126                 </for>
       
   127                 <hlm:assertFileExists file="${sbs.log.file}.sbs_error.log"/>
       
   128                 <hlm:assertFileExists file="${compile.log.dir}/${build.id}_${sysdef.configuration}.info.xml"/>
       
   129                 <hlm:assertFileExists file="${sbs.log.file}"/>
       
   130                 <hlm:assertFileExists file="${sbs.clean.log}"/>
   166             </then>
   131             </then>
   167         </if>
   132         </if>
   168     </target>
   133     </target>
   169 
   134 
   170     <macrodef name="sbsCompileMacro" uri="http://www.nokia.com/helium">
   135     <macrodef name="sbsProcessOutputMacro" uri="http://www.nokia.com/helium">
   171         <attribute name="cmdreference" />
   136         <attribute name="sbs.clean.log.file" />
       
   137         <attribute name="sbs.log.file" />
       
   138         <attribute name="sbs.stats.file" />
       
   139         <attribute name="sbs.error.output.file" />
       
   140         <attribute name="sbs.ant.output.file" />
   172         <sequential>
   141         <sequential>
   173             <var name="sbs.log.file" value="" unset="true"/>
   142             <var name="sbs.scan2.template" value="scan2.html.ftl" />
   174             
   143             <basename property="base.sbs.log" file="@{sbs.log.file}" suffix=".log"/>
   175             <delete file="${build.log.dir}/${build.id}.${sysdef.configuration}_sbs_info.xml" failonerror="false"/>
   144             <hlm:metadatarecord database="${metadata.dbfile}">
   176             <!-- sbs.log.file set by sbs tool execution, temporary -->
   145                 <hlm:textmetadatainput>
   177             <hlm:toolMacro name="sbs">
   146                     <fileset casesensitive="false" file="@{sbs.error.output.file}"/>
   178                 <hlm:toolvarset refid="@{cmdreference}"/>
   147                     <metadatafilterset refid="filterset.sbs" />
   179             </hlm:toolMacro>
   148                 </hlm:textmetadatainput>
   180             
   149             </hlm:metadatarecord>
       
   150             <basename property="base.sbs.ant.output.log" file="@{sbs.ant.output.file}" />
       
   151             <hlm:signalMacro logfile="@{sbs.error.output.file}" 
       
   152                 signal.input="raptorErrorSignalInput" phase="compile"/>
   181             <!-- update the resultes to database -->
   153             <!-- update the resultes to database -->
   182             <hlm:assertFileExists file="${build.log.dir}/${build.id}.${sysdef.configuration}_sbs_info.xml"/>
       
   183             <echo message="Metadata enabled, storing build status in database" />
   154             <echo message="Metadata enabled, storing build status in database" />
   184             <echo message="sbs log file :${sbs.log.file}" />
   155             <echo message="sbs log file :@{sbs.log.file}" />
   185             <hlm:metadatarecord database="${metadata.dbfile}">
   156             <echo message="sbs.clean.log.file :@{sbs.clean.log.file}" />
   186                 <hlm:sbsmetadatainput>
   157             <trycatch property="hlm-sbs.parser.thrown">
   187                     <fileset casesensitive="false" file="${sbs.log.file}"/>
   158                 <try>
   188                     <metadatafilterset refid="filterset.sbs" />
   159                     <hlm:metadatarecord database="${metadata.dbfile}">
   189                 </hlm:sbsmetadatainput>
   160                         <hlm:sbsmetadatainput cleanLogFile="@{sbs.clean.log.file}">
   190             </hlm:metadatarecord>
   161                             <fileset casesensitive="false" file="@{sbs.log.file}"/>
   191             <basename property="base.sbs.log.file" file="${sbs.log.file}" suffix=".log"/>
   162                             <metadatafilterset refid="filterset.sbs" />
   192             <echo message="base sbs log file :${base.sbs.log.file}" />
   163                         </hlm:sbsmetadatainput>
   193             <fmpp sourceFile="${helium.dir}/tools/common/templates/log/scan2.html.ftl"
   164                     </hlm:metadatarecord>
   194                          outputfile="${sbs.log.file}.scan2.html">
   165                 </try>
       
   166                 <catch>
       
   167                     <if>
       
   168                         <istrue value="${skip.sbs.parser.exception}" />
       
   169                         <then>
       
   170                             <var name="sbs.scan2.template" value="scan2_text.html.ftl" />
       
   171                             <hlm:metadatadelete database="${metadata-read-db}">
       
   172                                 <fileset casesensitive="false" file="@{sbs.log.file}"/>
       
   173                             </hlm:metadatadelete>
       
   174                             <hlm:metadatarecord database="${metadata-read-db}" >
       
   175                                 <hlm:textmetadatainput>
       
   176                                     <fileset casesensitive="false" file="@{sbs.log.file}"/>
       
   177                                 </hlm:textmetadatainput>
       
   178                             </hlm:metadatarecord>
       
   179                         </then>
       
   180                         <else>
       
   181                             <fail message="failed during raptor log parsing: might be due to invalid xml output from raptor" />
       
   182                         </else>
       
   183                     </if>
       
   184                 </catch>
       
   185             </trycatch>
       
   186             <fmpp sourceFile="${helium.dir}/tools/common/templates/log/${sbs.scan2.template}"
       
   187                          outputfile="@{sbs.log.file}.scan2.html">
   195                 <freemarkerLinks expandProperties="yes">
   188                 <freemarkerLinks expandProperties="yes">
   196                     macro: ${helium.dir}/tools/common/templates/macro
   189                     macro: ${helium.dir}/tools/common/templates/macro
   197                 </freemarkerLinks>
   190                 </freemarkerLinks>
   198                 <data expandProperties="yes">
   191                 <data expandProperties="yes">
   199                     dbPath: ${metadata.dbfile}
   192                     dbPath: ${metadata.dbfile}
   200                     doc: xml(${build.log.dir}/${build.id}.${sysdef.configuration}_sbs_info.xml)
   193                     doc: xml(@{sbs.stats.file})
   201                     ant: antProperties()
   194                     ant: antProperties()
   202                 </data>
   195                 </data>
   203             </fmpp>
   196             </fmpp>
   204             <echo message="generating signal" />
   197             <echo message="generating signal" />
   205             <hlm:assertFileExists file="${sbs.log.file}.scan2.html"/>
   198             <hlm:assertFileExists file="@{sbs.log.file}.scan2.html"/>
   206             <hlm:calculateErrorsFromLog logfile="${sbs.log.file}" />
   199             <hlm:calculateErrorsFromLog logfile="@{sbs.log.file}" />
   207             <hlm:compileLogSignalMacro compile.summary.file="${base.sbs.log.file}" 
   200             <hlm:compileLogSignalMacro compile.summary.file="${base.sbs.log}" 
   208                 error.limit="${build.errors.limit}"/>
   201                 error.limit="${build.errors.limit}" phase="compile"/>
   209             <!-- Blocks packaging configuration generation. -->
   202             <!-- Blocks packaging configuration generation. -->
   210             <if>
   203             <if>
   211                 <istrue value="${blocks.enabled}" />
   204                 <istrue value="${blocks.enabled}" />
   212                 <then>
   205                 <then>
   213                     <mkdir dir="${blocks.config.dir}" />
   206                     <mkdir dir="${blocks.config.dir}" />
   224                     </exec>
   217                     </exec>
   225                 </then>
   218                 </then>
   226             </if>
   219             </if>
   227         </sequential>
   220         </sequential>
   228     </macrodef>
   221     </macrodef>
   229 
       
   230     <!-- Get the supported configuration(armv5, winscw) from system definition file.  This is 
       
   231     temporary and will be moved to get values from carbon tool. -->
       
   232     <target name="get-sbs-configs">
       
   233         <hlm:getSBSConfigMacro sbs.sysdef.file="${canonical.sysdef.file}"/>
       
   234         <echo message="configs:${sbs.configs}"/>
       
   235     </target>
       
   236 </project>
   222 </project>