buildframework/helium/tools/rombuild/imaker.ant.xml
branchfix
changeset 395 5ad27ebafc22
parent 217 0f5e3a7fb6af
child 587 85df38eb4012
equal deleted inserted replaced
394:b6f8d38305f2 395:5ad27ebafc22
    18 
    18 
    19 Description:
    19 Description:
    20 
    20 
    21 ============================================================================
    21 ============================================================================
    22 -->
    22 -->
       
    23 <!--* @package rombuild -->
    23 <project name="rombuild.imaker" xmlns:hlm="http://www.nokia.com/helium">
    24 <project name="rombuild.imaker" xmlns:hlm="http://www.nokia.com/helium">
    24     <description>
    25     <description>
    25         ROM image creation using iMaker (future implementation).
    26         ROM image creation using iMaker (future implementation).
    26     </description>
    27     </description>
    27 
       
    28     <!-- Defining the default rom image creation templates. -->
       
    29     <property name="imaker.fmpp.makefile" location="${helium.dir}/tools/common/templates/imaker/build_imaker_roms_signing.mk.ftl"/>
       
    30     <property name="imaker.fmpp.ant" location="${helium.dir}/tools/common/templates/imaker/build_imaker_roms.ant.xml.ftl"/>
       
    31     
       
    32     
       
    33     <!-- The iMaker task. -->
       
    34     <macrodef name="imaker" uri="http://www.nokia.com/helium">
       
    35         <element name="config"/>
       
    36         <attribute name="engine" default="ebs"/>
       
    37         <attribute name="name" default=""/>
       
    38         <attribute name="signal" default="true"/>
       
    39         <sequential>
       
    40             <hlm:tempRecordStartMacro name="${build.id}@{name}.roms.log"/>
       
    41             <hlm:imaker2tdd property="internal.imaker.tdd" dir="${build.drive}/">
       
    42                 <config/>
       
    43             </hlm:imaker2tdd>
       
    44             <echo>
       
    45 Generated TDD:
       
    46 ${internal.imaker.tdd}
       
    47             </echo>
       
    48             <mkdir dir="${build.log.dir}"/>
       
    49             <if>
       
    50                 <matches pattern="ec(-helium)?" string="@{engine}"/>
       
    51                 <then>
       
    52                     <fmpp sourceFile="${imaker.fmpp.makefile}"
       
    53                         outputFile="${temp.build.dir}/build_imaker_roms@{name}.mk">
       
    54                         <data expandProperties="yes">
       
    55                             data: ${internal.imaker.tdd}
       
    56                             ant: antProperties()
       
    57                         </data>
       
    58                     </fmpp>
       
    59                     <exec executable="${ec.emake}" dir="${build.drive}/">
       
    60                         <arg value="--emake-build-label=${build.id}@{name}-ROMS"/>
       
    61                         <arg value="--emake-class=${ec.build.class}"/>
       
    62                         <arg value="--emake-annofile=${build.log.dir}\${build.id}@{name}.ROMS.emake.anno.xml"/>
       
    63                         <arg value="--emake-autodepend=1"/>
       
    64                         <arg value="--emake-annodetail=basic,history,file,waiting"/>                            
       
    65                         <arg line="-f ${temp.build.dir}/build_imaker_roms@{name}.mk all"/>
       
    66                     </exec>
       
    67                 </then>
       
    68                 <else>
       
    69                     <fmpp sourceFile="${imaker.fmpp.ant}"
       
    70                         outputFile="${temp.build.dir}/build_imaker_roms@{name}.ant.xml">
       
    71                         <data expandProperties="yes">
       
    72                             data: ${internal.imaker.tdd}
       
    73                             ant: antProperties()
       
    74                         </data>
       
    75                     </fmpp>
       
    76                     <ant antfile="${temp.build.dir}/build_imaker_roms@{name}.ant.xml" target="all" />
       
    77                 </else>
       
    78             </if>
       
    79             
       
    80             <hlm:tempRecordStopMacro name="${build.id}@{name}.roms.log" filterref="filterset.imaker"/>
       
    81             <!-- Todo: metadata: insert assertions for metadata parsing here -->
       
    82             <if>
       
    83                 <istrue value="@{signal}"/>
       
    84                 <then>
       
    85                     <hlm:signalMacro logfile="${build.log.dir}/${build.id}@{name}.roms.log" 
       
    86                         signal.input="rombuildSignalInput" />
       
    87                 </then>
       
    88             </if>
       
    89         </sequential>
       
    90     </macrodef>
       
    91 
       
    92     <!--
       
    93         This task implements the transformation of iMaker introspection into a TDD for FMPP.
       
    94         Syntax will be like:
       
    95         <pre>
       
    96         <hlm:imaker2tdd property="internal.imaker.tdd">
       
    97             <imakerconfigurationset>
       
    98                 <imakerconfiguration>
       
    99                     <makefileset>
       
   100                         <include name="**/PRODUCT/*ui.mk"/>
       
   101                     </makefileset>
       
   102                     <categoryset>
       
   103                         <include name="build"/>
       
   104                         <include name="release"/>
       
   105                         <include name="test"/>
       
   106                     </categoryset>
       
   107                 </imakerconfiguration>
       
   108             </imakerconfigurationset>
       
   109         </hlm:imaker2tdd>                 
       
   110         </pre>
       
   111     -->
       
   112     
       
   113     <scriptdef name="imaker2tdd" language="jython" uri="http://www.nokia.com/helium">
       
   114         <element name="imakerconfigurationset" classname="com.nokia.ant.types.imaker.ConfigurationSet"/>
       
   115         <attribute name="property"/>
       
   116         <attribute name="file"/>
       
   117         <attribute name="dir"/>
       
   118         <![CDATA[
       
   119 import imaker
       
   120 import traceback
       
   121 import ant
       
   122 import logging
       
   123 logging.getLogger('imaker.api').addHandler(ant.AntHandler(self))
       
   124 try:
       
   125     imaker.ant_task_configuration(project, self, elements, attributes)
       
   126 except Exception, e:
       
   127     traceback.print_exc()
       
   128     # Propagate the exception
       
   129     raise e
       
   130 ]]>
       
   131     </scriptdef>
       
   132 
    28 
   133     <!--
    29     <!--
   134        This task merges all files mentioned in the fileset and output them in filename output file. 
    30        This task merges all files mentioned in the fileset and output them in filename output file. 
   135     -->
    31     -->
   136     <scriptdef name="mergeConfigXML" language="beanshell"  uri="http://www.nokia.com/helium">
    32     <scriptdef name="mergeConfigXML" language="beanshell"  uri="http://www.nokia.com/helium">
   177     <!--
    73     <!--
   178        This target is an helper to recompose the rom image configuration using the output of iMaker.
    74        This target is an helper to recompose the rom image configuration using the output of iMaker.
   179     -->
    75     -->
   180     <target name="imaker-merge-rom-xml">
    76     <target name="imaker-merge-rom-xml">
   181         <mkdir dir="${temp.build.dir}"/>
    77         <mkdir dir="${temp.build.dir}"/>
       
    78         <!-- Locates the parsed configuration for ROM builds.
       
    79         @type string
       
    80         @scope private
       
    81         -->
   182         <property name="rombuild.config.file.parsed" location="${build.output.dir}/rom_config.xml.parsed" />
    82         <property name="rombuild.config.file.parsed" location="${build.output.dir}/rom_config.xml.parsed" />
   183         <hlm:mergeConfigXML filename="${rombuild.config.file.parsed}">
    83         <hlm:mergeConfigXML filename="${rombuild.config.file.parsed}">
   184             <fileset dir="${release.images.dir}" includes="**/*.iconfig.xml"/>    
    84             <fileset dir="${release.images.dir}" includes="**/*.iconfig.xml"/>    
   185         </hlm:mergeConfigXML>
    85         </hlm:mergeConfigXML>
   186     </target>
    86     </target>
   187 
    87 
   188     <!-- Future official target for building roms using iMaker.
    88     <!--
       
    89         Implement a solution to create build information for imaker.
       
    90     -->
       
    91     <target name="rombuild-imaker-create-buildinfo">
       
    92         <!-- FMPP template to generate a buildinfo makefile.
       
    93         @type string
       
    94         -->
       
    95         <property name="rombuild.buildinfo.template" location="${helium.dir}/tools/common/templates/imaker/image_conf_buildinfo.mk.ftl" />
       
    96         <!-- Location of the output file.
       
    97         @type string
       
    98         @scope private
       
    99         -->
       
   100         <property name="rombuild.buildinfo.output" location="${build.drive}${env.EPOCROOT}epoc32/rom/config/image_conf_buildinfo.mk" />
       
   101         <fmpp sourceFile="${rombuild.buildinfo.template}" outputFile="${rombuild.buildinfo.output}">
       
   102             <data expandProperties="yes">
       
   103                 ant: antProperties()
       
   104             </data>
       
   105         </fmpp>
       
   106     </target>
       
   107 
       
   108     <!--
       
   109          Official target to build rom images using iMaker under Helium.
   189          To configure that target you have to define an imakerconfigurationset type identified by
   110          To configure that target you have to define an imakerconfigurationset type identified by
   190          'imaker.rom.config'.
   111          'imaker.rom.config'.
       
   112          The accelerator will automatically be selected based on the build.system property. But this
       
   113          default behaviour can be overriden by defining the reference of the engine to use via the 'imaker.engine'
       
   114          property.
   191     -->
   115     -->
   192     <target name="build-roms" depends="rombuild-imaker-create-buildinfo">
   116     <target name="build-roms" depends="rombuild-imaker-create-buildinfo">
   193         <property name="imaker.engine" value="${build.system}" />
   117         <mkdir dir="${roms.log.dir}"/>
       
   118         <if>
       
   119             <not>
       
   120                 <isset property="imaker.engine" />
       
   121             </not>
       
   122             <then>
       
   123                 <if>
       
   124                     <or>
       
   125                         <equals arg1="${build.system}" arg2="ec-helium" />
       
   126                         <equals arg1="${build.system}" arg2="sbs-ec" />
       
   127                     </or>
       
   128                     <then>
       
   129                         <!-- Defines which accelerator to use for running iMaker. (default value from build.system property)
       
   130                         @type string
       
   131                         @scope private
       
   132                         -->
       
   133                         <property name="imaker.engine" value="imaker.engine.ec" />
       
   134                     </then>
       
   135                 </if>
       
   136             </then>
       
   137         </if>
       
   138         <!-- Defines which accelerator to use for running iMaker. (default value from build.system property)
       
   139         @type string
       
   140         @scope private
       
   141         -->
       
   142         <property name="imaker.engine" value="imaker.engine.default" />        
   194         <property name="imaker.rom.name" value=""/>
   143         <property name="imaker.rom.name" value=""/>
   195         <hlm:imaker engine="${imaker.engine}" name="${imaker.rom.name}">
   144         <hlm:imaker epocroot="${build.drive}/" engineRefid="${imaker.engine}"
   196             <config>
   145                         output="${roms.log.dir}/${build.id}${imaker.rom.name}.roms.log" verbose="true">
   197                 <imakerconfigurationset refid="imaker.rom.config"/>
   146             <hlm:imakerconfigurationset refid="imaker.rom.config" />
   198             </config>
       
   199         </hlm:imaker>
   147         </hlm:imaker>
       
   148         <if>
       
   149             <available file="${roms.log.dir}/${build.id}${imaker.rom.name}.roms.log" />
       
   150             <then>
       
   151                 <echo message="WARNING: Nothing to build." file="${roms.log.dir}/${build.id}${imaker.rom.name}.roms.log" />
       
   152             </then>
       
   153         </if>
       
   154         <hlm:metadatarecord database="${metadata.dbfile}">
       
   155             <hlm:textmetadatainput>
       
   156                 <fileset casesensitive="false" file="${roms.log.dir}/${build.id}${imaker.rom.name}.roms.log" />
       
   157                 <metadatafilterset refid="filterset.imaker" />
       
   158             </hlm:textmetadatainput>
       
   159         </hlm:metadatarecord>
       
   160         <hlm:signalMacro logfile="${roms.log.dir}/${build.id}${imaker.rom.name}.roms.log" 
       
   161                          signal.input="rombuildSignalInput" />
   200         <if>
   162         <if>
   201             <istrue value="${blocks.enabled}" />
   163             <istrue value="${blocks.enabled}" />
   202             <then>
   164             <then>
   203                 <mkdir dir="${blocks.config.dir}" />
   165                 <mkdir dir="${blocks.config.dir}" />
   204                 <exec executable="python">
   166                 <exec executable="python">
   214                 </exec>
   176                 </exec>
   215             </then>
   177             </then>
   216         </if>
   178         </if>
   217     </target>
   179     </target>
   218     
   180     
       
   181     <!-- iMaker engine configuration -->
       
   182     <hlm:defaultEngine id="imaker.engine.default" threads="${number.of.threads}" />
       
   183 
       
   184     <hlm:emakeEngine id="imaker.engine.ec">
       
   185         <arg value="--emake-emulation=symbian" />
       
   186         <arg value="--emake-annofile=${roms.log.dir}/${build.id}${imaker.rom.name}.anno.xml"/>
       
   187         <arg value="--emake-root=${env.EMAKE_ROOT}${path.separator}${helium.dir}"/>
       
   188         <arg value="--emake-annodetail=basic,history,file,waiting"/>
       
   189         <arg value="--emake-historyfile=${roms.log.dir}/${build.id}${imaker.rom.name}.emake.data" />
       
   190         <arg value="--emake-class=${ec.build.class}" />
       
   191     </hlm:emakeEngine>
       
   192     
   219 </project>
   193 </project>