buildframework/helium/tools/compile/compile.ant.xml
changeset 628 7c4a911dc066
parent 588 c7c26511138f
child 645 b8d81fa19e7d
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
    32     Comma-separated list of System Definition configuration names to be built in the compile-main stage.
    32     Comma-separated list of System Definition configuration names to be built in the compile-main stage.
    33     @type string
    33     @type string
    34     @editable required
    34     @editable required
    35     @scope public
    35     @scope public
    36     -->
    36     -->
    37 
    37     
       
    38     <!--* @property compile.cmd.clean.enabled
       
    39     Set to true if it clean compilation.  
       
    40     @type boolean
       
    41     @scope public
       
    42     @since 11.0
       
    43     -->
       
    44     
       
    45     <!--* @property internal.compile.cmd.clean.enabled
       
    46     Set to true if compile.cmd.clean.enabled is set to true.  
       
    47     @type boolean
       
    48     @scope private
       
    49     -->
       
    50     
       
    51     <!--* @property compile.cmd.clean
       
    52     Set to true if it clean compilation. - deprecated: Start using compile.cmd.clean.enabled property.  
       
    53     @type boolean
       
    54     @scope public
       
    55     @deprecated since 11.0
       
    56     -->
       
    57     
       
    58     <!--* @property compile.discard.result.enabled
       
    59     Set to true to discard the previous compilation results.  
       
    60     @type boolean
       
    61     @scope public
       
    62     @since 11.0
       
    63     -->
       
    64     
       
    65     <!--* @property internal.compile.discard.result.enabled
       
    66     Set to true if compile.discard.result.enabled set to true.  
       
    67     @type boolean
       
    68     @scope private
       
    69     @since 11.0
       
    70     -->
       
    71     
       
    72     <!--* @property compile.discard.result
       
    73     Set to true to discard the previous compilation results. - deprecated: Start using compile.discard.result.enabled property.  
       
    74     @type boolean
       
    75     @scope public
       
    76     @deprecated since 11.0
       
    77     -->
       
    78     
    38     <!-- Property declaration -->
    79     <!-- Property declaration -->
    39     <!-- Suffix used in genxml related output files. This value is added into file names to show that they are genxml related. Used in log files, genxml output files and component list for EE images. Normally does not need to be set.
    80     <!-- Suffix used in genxml related output files. This value is added into file names to show that they are genxml related. Used in log files, genxml output files and component list for EE images. Normally does not need to be set.
    40     @type string
    81     @type string
    41     @scope private
    82     @scope private
    42     -->
    83     -->
    53     <!-- Compilation summary file for diamonds.
    94     <!-- Compilation summary file for diamonds.
    54     @type string
    95     @type string
    55     @scope private
    96     @scope private
    56     -->
    97     -->
    57     <property name="diamonds.compile.summary" location="${compile.log.dir}/${build.id}_compile_diamonds.xml" />
    98     <property name="diamonds.compile.summary" location="${compile.log.dir}/${build.id}_compile_diamonds.xml" />
       
    99     
       
   100     <!--* @property sysdef3.enabled
       
   101      This property enables sbs compilation based on system definition schema 3.0.0. 
       
   102      @type boolean
       
   103      @scope public
       
   104      @editable required
       
   105      @since 11.0
       
   106      -->
       
   107     
       
   108     <!--* @property internal.sysdef3.enabled
       
   109      To run the sysdef3 dependent tasks if sysdef3.enabled set to true. 
       
   110      @type boolean
       
   111      @scope private
       
   112      -->
       
   113      
       
   114     <!-- Check is sysdef3 enabled. -->
       
   115     <condition property="internal.sysdef3.enabled">
       
   116         <istrue value="${sysdef3.enabled}" />
       
   117     </condition>
       
   118     
       
   119     <!-- To check is it clean compilation -->
       
   120     <condition property="internal.compile.cmd.clean.enabled" value="true" else="false">
       
   121         <or>
       
   122             <istrue value="${compile.cmd.clean.enabled}" />
       
   123             <istrue value="${compile.cmd.clean}" />
       
   124         </or>
       
   125     </condition>
       
   126     
       
   127     <!-- To check is it required to discard old compilation results -->
       
   128     <condition property="internal.compile.discard.result.enabled" value="true" else="false">
       
   129         <or>
       
   130             <istrue value="${compile.discard.result.enabled}" />
       
   131             <istrue value="${compile.discard.result}" />
       
   132         </or>
       
   133     </condition> 
    58     
   134     
    59     <!-- including common compilation macros -->
   135     <!-- including common compilation macros -->
    60     <hlm:typedef file="${helium.dir}/tools/compile/compile.antlib.xml" uri="http://www.nokia.com/helium"/>
   136     <hlm:typedef file="${helium.dir}/tools/compile/compile.antlib.xml" uri="http://www.nokia.com/helium"/>
    61     <import file="nokiacompile.ant.xml" />
   137     <import file="nokiacompile.ant.xml" />
    62     <import file="cmaker.ant.xml" />
   138     <import file="cmaker.ant.xml" />
    79 
   155 
    80     <!-- Does all the necessary steps before starting the component build -->
   156     <!-- Does all the necessary steps before starting the component build -->
    81     <target name="precompile" depends="create-canonical-sysdef-file,precompile-ec,run-coverity-configure"/>
   157     <target name="precompile" depends="create-canonical-sysdef-file,precompile-ec,run-coverity-configure"/>
    82 
   158 
    83     <!-- post operation for EC builds, submits the compile time and lists all the built components-->
   159     <!-- post operation for EC builds, submits the compile time and lists all the built components-->
    84     <target name="postcompile" depends="postcompile-ec,render-build-duplicates,post-coverity" unless="env.HLM_SUBCON" />
   160     <target name="postcompile" depends="postcompile-ec,render-build-duplicates,post-coverity,sbs-checksource" unless="env.HLM_SUBCON" />
    85     
   161     
    86     
   162     
    87     <!-- Pre-processes all System Definition input files.
   163     <!-- Pre-processes all System Definition input files.
    88 
   164 
    89     Any Ant properties used in the files will be replaced by their values.
   165     Any Ant properties used in the files will be replaced by their values.
   139 
   215 
   140     <!-- Merges all preprocessed System Definition files into one combined file. -->
   216     <!-- Merges all preprocessed System Definition files into one combined file. -->
   141     <target name="create-canonical-sysdef-file" depends="preprocess-sysdef-files">
   217     <target name="create-canonical-sysdef-file" depends="preprocess-sysdef-files">
   142         <mkdir dir="${compile.log.dir}" />
   218         <mkdir dir="${compile.log.dir}" />
   143         <if>
   219         <if>
   144             <istrue value="${schema.new}" />
   220             <istrue value="${sysdef3.enabled}" />
   145             <then>
   221             <then>
       
   222                 <for param="file" keepgoing="true">
       
   223                     <resources refid="system.definition.files" />
       
   224                     <sequential>
       
   225                         <trycatch reference="internal.sysdef3.validation.error">
       
   226                             <try>
       
   227                                 <xmlvalidate file="@{file}" lenient="true" />
       
   228                             </try>
       
   229                             <catch>
       
   230                                 <echo>ERROR: ${toString:internal.sysdef3.validation.error}</echo>
       
   231                                 <throw refid="internal.sysdef3.validation.error" />
       
   232                             </catch>
       
   233                         </trycatch>                        
       
   234                     </sequential>
       
   235                 </for>
   146                 <mkdir dir="${temp.build.dir}/root" />
   236                 <mkdir dir="${temp.build.dir}/root" />
   147                 <mkdir dir="${temp.build.dir}/join" />
   237                 <mkdir dir="${temp.build.dir}/join" />
   148                 <delete>
   238                 <delete>
   149                     <fileset dir="${temp.build.dir}/root" />
   239                     <fileset dir="${temp.build.dir}/root" />
   150                     <fileset dir="${temp.build.dir}/join" />
   240                     <fileset dir="${temp.build.dir}/join" />
   151                 </delete>
   241                 </delete>
   152                 <!-- creating the root sysdef file for packages referenced directly -->
   242                 <if>
   153                 <hlm:createRootSysdef destFile="${temp.build.dir}/root/generated.root.xml" epocroot="${build.drive}/"
   243                     <resourcecount when="ne" count="0">
   154                     checkPackageExists="${compile.cmd.clean}">
   244                         <restrict>
   155                     <restrict>
   245                             <resources refid="system.definition.files" />
   156                         <resources refid="system.definition.files" />
   246                             <rsel:and>
   157                         <rsel:name name="**${file.separator}package_definition.xml" />
   247                                 <rsel:name name="**${file.separator}package_definition.xml" />
   158                     </restrict>
   248                                 <rsel:not>
   159                 </hlm:createRootSysdef>
   249                                     <hlm:isVendorPackage />
       
   250                                 </rsel:not>
       
   251                             </rsel:and>
       
   252                         </restrict>
       
   253                     </resourcecount>
       
   254                     <then>
       
   255                         <!-- creating the root sysdef file for packages referenced directly -->
       
   256                         <hlm:createRootSysdef destFile="${temp.build.dir}/root/generated.root.xml" epocroot="${build.drive}/"
       
   257                             checkPackageExists="${internal.compile.cmd.clean.enabled}">
       
   258                             <restrict>
       
   259                                 <resources refid="system.definition.files" />
       
   260                                 <rsel:and>
       
   261                                     <rsel:name name="**${file.separator}package_definition.xml" />
       
   262                                     <rsel:not>
       
   263                                         <hlm:isVendorPackage />
       
   264                                     </rsel:not>
       
   265                                 </rsel:and>
       
   266                             </restrict>
       
   267                         </hlm:createRootSysdef>
       
   268                     </then>
       
   269                 </if>
       
   270                 <if>
       
   271                     <resourcecount when="ne" count="0">
       
   272                         <restrict>
       
   273                             <resources refid="system.definition.files" />
       
   274                             <rsel:and>
       
   275                                 <rsel:name name="**${file.separator}package_definition.xml" />
       
   276                                 <hlm:isVendorPackage />
       
   277                             </rsel:and>
       
   278                         </restrict>
       
   279                     </resourcecount>
       
   280                     <then>
       
   281                         <hlm:createRootSysdef destFile="${temp.build.dir}/root/generated_vendor.root.xml" epocroot="${build.drive}/"
       
   282                             checkPackageExists="${internal.compile.cmd.clean.enabled}">
       
   283                             <restrict>
       
   284                                 <resources refid="system.definition.files" />
       
   285                                 <rsel:and>
       
   286                                     <rsel:name name="**${file.separator}package_definition.xml" />
       
   287                                     <hlm:isVendorPackage />
       
   288                                 </rsel:and>
       
   289                             </restrict>
       
   290                         </hlm:createRootSysdef>
       
   291                     </then>
       
   292                 </if>
   160                 <!-- Joining all the Root sysdef files -->
   293                 <!-- Joining all the Root sysdef files -->
   161                 <for param="file">
   294                 <for param="file">
   162                     <path>
   295                     <path>
   163                         <restrict>
   296                         <restrict>
   164                             <resources refid="system.definition.files" />
   297                             <resources refid="system.definition.files" />
   165                             <rsel:not>
   298                             <rsel:not>
   166                                 <rsel:name name="**${file.separator}package_definition.xml" />
   299                                 <rsel:name name="**${file.separator}package_definition.xml" />
   167                             </rsel:not>
   300                             </rsel:not>
   168                         </restrict>
   301                         </restrict>
   169                         <fileset dir="${temp.build.dir}/root" includes="generated.root.xml" />
   302                         <fileset dir="${temp.build.dir}/root" includes="generated.root.xml" />
       
   303                         <fileset dir="${temp.build.dir}/root" includes="generated_vendor.root.xml" />
   170                     </path>
   304                     </path>
   171                     <sequential>
   305                     <sequential>
   172                         <hlm:joinSysdef epocroot="${build.drive}/" srcfile="@{file}" 
   306                         <hlm:joinSysdef epocroot="${build.drive}/" srcfile="@{file}" 
   173                             destfile="@{file}.join.xml" />
   307                             destfile="@{file}.join.xml" />
   174                         <move todir="${temp.build.dir}/join/">
   308                         <move todir="${temp.build.dir}/join/">
   196                 <!-- Merging all the joined files together -->
   330                 <!-- Merging all the joined files together -->
   197                 <hlm:mergeSysdef epocroot="${build.drive}/" destfile="${canonical.sysdef.file}">
   331                 <hlm:mergeSysdef epocroot="${build.drive}/" destfile="${canonical.sysdef.file}">
   198                     <fileset dir="${temp.build.dir}/join" includes="**/*.xml" />
   332                     <fileset dir="${temp.build.dir}/join" includes="**/*.xml" />
   199                 </hlm:mergeSysdef>
   333                 </hlm:mergeSysdef>
   200                 <hlm:assertFileExists file="${canonical.sysdef.file}" />
   334                 <hlm:assertFileExists file="${canonical.sysdef.file}" />
       
   335                 <hlm:metadatarecord database="${metadata.dbfile}">
       
   336                     <hlm:sysdefmetadatainput file="${canonical.sysdef.file}" />
       
   337                 </hlm:metadatarecord>
   201             </then>
   338             </then>
   202             <else>
   339             <else>
   203                 <pathconvert pathsep=" " property="system.definition.files.list">
   340                 <pathconvert pathsep=" " property="system.definition.files.list">
   204                     <fileset dir="${build.output.dir}/build/input/" includes="**"/>
   341                     <fileset dir="${build.output.dir}/build/input/" includes="**"/>
   205                     <chainedmapper>
   342                     <chainedmapper>
   218     <target name="compile-clean" depends="create-canonical-sysdef-file"
   355     <target name="compile-clean" depends="create-canonical-sysdef-file"
   219       if="sysdef.clean.configuration">
   356       if="sysdef.clean.configuration">
   220         <antcall target="compile-configuration" inheritRefs="true">
   357         <antcall target="compile-configuration" inheritRefs="true">
   221             <param name="sysdef.configuration" value="${sysdef.clean.configuration}"/>
   358             <param name="sysdef.configuration" value="${sysdef.clean.configuration}"/>
   222             <param name="compile.signal.input" value="compileCleanSignalInput"/>
   359             <param name="compile.signal.input" value="compileCleanSignalInput"/>
   223             <param name="compile.discard.result" value="true"/>
   360             <param name="internal.compile.discard.result.enabled" value="true"/>
   224         </antcall>
   361         </antcall>
   225     </target>
   362     </target>
   226 
   363 
   227 
   364 
   228     <!-- Creates a input file for EBS using Symbian genxml tool. -->
   365     <!-- Creates a input file for EBS using Symbian genxml tool. -->
   300                 <isset property="build.system.sbs-ec"/>
   437                 <isset property="build.system.sbs-ec"/>
   301             </or>
   438             </or>
   302             <then>
   439             <then>
   303                 <if>
   440                 <if>
   304                     <not>
   441                     <not>
   305                         <isfalse value="${compile.discard.result}"/>
   442                         <isfalse value="${internal.compile.discard.result.enabled}"/>
   306                     </not>
   443                     </not>
   307                     <then>
   444                     <then>
   308                         <delete file="${compile.log.dir}/${build.id}.${sysdef.configuration}_compile.log.xml" failonerror="false"/>
   445                         <delete file="${compile.log.dir}/${build.id}.${sysdef.configuration}_compile.log.xml" failonerror="false"/>
   309                     </then>
   446                     </then>
   310                 </if>
   447                 </if>
   327                 <if>
   464                 <if>
   328                     <!--
   465                     <!--
   329                       Only generate the log.xml if we want the results to be included in the final results
   466                       Only generate the log.xml if we want the results to be included in the final results
   330                       or get them used by the signaling mechanism.
   467                       or get them used by the signaling mechanism.
   331                     -->
   468                     -->
   332                     <isfalse value="${compile.discard.result}"/>
   469                     <isfalse value="${internal.compile.discard.result.enabled}"/>
   333                     <then>
   470                     <then>
   334                         <hlm:metadatarecord database="${metadata.dbfile}">
   471                         <hlm:metadatarecord database="${metadata.dbfile}">
   335                             <hlm:abldmetadatainput>
   472                             <hlm:abldmetadatainput>
   336                                 <fileset casesensitive="false" file="${compile.log.dir}/${build.id}.${sysdef.configuration}_compile.log" />
   473                                 <fileset casesensitive="false" file="${compile.log.dir}/${build.id}.${sysdef.configuration}_compile.log" />
   337                                 <metadatafilterset refid="filterset.compile" />
   474                                 <metadatafilterset refid="filterset.compile" />
   338                             </hlm:abldmetadatainput>
   475                             </hlm:abldmetadatainput>
   339                         </hlm:metadatarecord>
   476                         </hlm:metadatarecord>
   340                         <hlm:compileLogSignalMacro compile.summary.file="${build.id}.${sysdef.configuration}_compile.log" 
   477                         <hlm:compileLogSignalMacro compile.summary.file="${compile.log.dir}/${build.id}.${sysdef.configuration}_compile.log" 
   341                             error.limit="${build.errors.limit}" phase="compile"/>
   478                             error.limit="${build.errors.limit}" phase="compile"/>
   342                         <!-- Todo: metadata: insert assertions for metadata parsing here -->
   479                         <!-- Todo: metadata: insert assertions for metadata parsing here -->
   343                     </then>
   480                     </then>
   344                 </if>
   481                 </if>
   345             </else>
   482             </else>
   371     </target>
   508     </target>
   372     <var name="build.errors.total" value="" unset="true"/>
   509     <var name="build.errors.total" value="" unset="true"/>
   373 
   510 
   374     <!-- Starts the actual compilation  phase of a build -->
   511     <!-- Starts the actual compilation  phase of a build -->
   375     <target name="compile-main" depends="precompile,do-compile-main,postcompile"/>
   512     <target name="compile-main" depends="precompile,do-compile-main,postcompile"/>
   376 
       
   377     <!-- Macro to preprocess build information -->
       
   378     <scriptdef name="diamondsSummaryMacro" language="jython" uri="http://www.nokia.com/helium">
       
   379         <attribute name="output"/>
       
   380     <![CDATA[
       
   381 from xml.sax.handler import ContentHandler
       
   382 from xml.sax import make_parser
       
   383 from xml.sax.saxutils import quoteattr
       
   384 
       
   385 class DiamondsSummary(ContentHandler):
       
   386     def __init__(self):
       
   387         ContentHandler.__init__(self)
       
   388         self.scanLog = False
       
   389         self.components = {}
       
   390         self.component = None
       
   391         self.level = 0
       
   392         self.total = {'error':0, 'critical':0, 'warning':0}
       
   393 
       
   394     def startElement(self, name, attrs):
       
   395         if name == 'log' and attrs.get('filename', None) != None and attrs.get('filename', '').endswith('_compile.log'):
       
   396             self.scanLog = True
       
   397         elif self.scanLog and name == "task":
       
   398             self.level += 1
       
   399 
       
   400         if self.scanLog and name == "task" and self.level == 2 and attrs.get('name', None) != None:
       
   401             self.component = attrs.get('name', None)
       
   402             if self.component not in self.components:
       
   403                 self.components[self.component] = {'error':0, 'critical':0, 'warning':0}
       
   404 
       
   405         if self.scanLog and name == "message" and attrs.get('priority', None) != None:
       
   406             if attrs.get('priority') in self.total:
       
   407                 self.total[attrs.get('priority')] += 1
       
   408 
       
   409         if self.scanLog and name == "message" and self.level > 1 and self.component != None and attrs.get('priority', None) != None:
       
   410             if attrs.get('priority') in self.components[self.component]:
       
   411                 self.components[self.component][attrs.get('priority')] += 1
       
   412 
       
   413     def endElement(self, name):
       
   414         if name == 'log':
       
   415             self.scanLog = False
       
   416             self.level = 0
       
   417             self.component = None
       
   418         elif name == 'task':
       
   419             self.level = self.level - 1
       
   420 
       
   421 
       
   422 parser = make_parser()
       
   423 diamondsSummary = DiamondsSummary()
       
   424 parser.setContentHandler(diamondsSummary)
       
   425 parser.parse(open(str(project.getProperty('build.summary.file'))))
       
   426 
       
   427 output = '<?xml version="1.0"?>\n<compile>\n'
       
   428 output += '<components>\n'
       
   429 for name in diamondsSummary.components:
       
   430     xname = quoteattr(name)
       
   431     output += '<component name=%s error="%d" critical="%d" warning="%d" />\n' % (xname, diamondsSummary.components[name]['error'], diamondsSummary.components[name]['critical'], diamondsSummary.components[name]['warning'])
       
   432     #print name + " ==> %d" % diamondsSummary.components[name]['error']
       
   433 output += '</components>\n'
       
   434 output += '<total error="%d" critical="%d" warning="%d" />\n' % (diamondsSummary.total['error'], diamondsSummary.total['critical'], diamondsSummary.total['warning'])
       
   435 output += '</compile>\n'
       
   436 self.log(str("Writing %s" % str(attributes.get('output'))))
       
   437 f = open(str(attributes.get('output')), 'w+')
       
   438 f.write(output)
       
   439     ]]></scriptdef>
       
   440 
   513 
   441     <!-- Creates a .csv log of the sizes of all the binaries created in the build. -->
   514     <!-- Creates a .csv log of the sizes of all the binaries created in the build. -->
   442     <target name="binary-sizes-log" if="binary.sizes.output">
   515     <target name="binary-sizes-log" if="binary.sizes.output">
   443         <hlm:startSpecificLogMacro name="${compile.log.dir}/${build.id}_binary_sizes.log" phase="compile"/>
   516         <hlm:startSpecificLogMacro name="${compile.log.dir}/${build.id}_binary_sizes.log" phase="compile"/>
   444         <!-- File containing data related to flash image size
   517         <!-- File containing data related to flash image size
   509     <target name="postbuild" depends="update-uaprof-header,sisfiles" unless="env.HLM_SUBCON">
   582     <target name="postbuild" depends="update-uaprof-header,sisfiles" unless="env.HLM_SUBCON">
   510         <antcall target="security-checker"/>
   583         <antcall target="security-checker"/>
   511         <antcall target="dump-swicertstore"/>
   584         <antcall target="dump-swicertstore"/>
   512         <antcall target="check-stub-sis"/>
   585         <antcall target="check-stub-sis"/>
   513     </target>
   586     </target>
       
   587 
   514 </project>
   588 </project>
       
   589