buildframework/helium/tools/rombuild/imaker.ant.xml
changeset 2 39c28ec933dd
equal deleted inserted replaced
1:820b22e13ff1 2:39c28ec933dd
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!-- 
       
     3 ============================================================================ 
       
     4 Name        : imaker.ant.xml 
       
     5 Part of     : Helium 
       
     6 
       
     7 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     8 All rights reserved.
       
     9 This component and the accompanying materials are made available
       
    10 under the terms of the License "Eclipse Public License v1.0"
       
    11 which accompanies this distribution, and is available
       
    12 at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    13 
       
    14 Initial Contributors:
       
    15 Nokia Corporation - initial contribution.
       
    16 
       
    17 Contributors:
       
    18 
       
    19 Description:
       
    20 
       
    21 ============================================================================
       
    22 -->
       
    23 <!--* @package rombuild -->
       
    24 <project name="rombuild.imaker" xmlns:hlm="http://www.nokia.com/helium">
       
    25     <description>
       
    26         ROM image creation using iMaker (future implementation).
       
    27     </description>
       
    28 
       
    29     <!--
       
    30        This task merges all files mentioned in the fileset and output them in filename output file. 
       
    31     -->
       
    32     <scriptdef name="mergeConfigXML" language="beanshell"  uri="http://www.nokia.com/helium">
       
    33         <element name="fileset" type="fileset"/>
       
    34         <attribute name="filename"/>
       
    35 <![CDATA[
       
    36 import java.io.File;
       
    37 import org.dom4j.Node;
       
    38 import org.dom4j.io.SAXReader;
       
    39 import org.dom4j.DocumentHelper;
       
    40 import org.dom4j.Element;
       
    41 import org.dom4j.Document;
       
    42 import org.dom4j.io.OutputFormat;
       
    43 import org.dom4j.io.XMLWriter;
       
    44 
       
    45 Document document = DocumentHelper.createDocument();
       
    46 Element root = document.addElement("build");
       
    47 Element rootConfig = root.addElement( "config" );
       
    48 rootConfig.addAttribute("abstract", "true");
       
    49 rootConfig.addAttribute("name", "ee-roms");
       
    50 
       
    51 filesets = elements.get("fileset");
       
    52 for (i = 0; i < filesets.size(); ++i) {
       
    53         ds = filesets.get(i).getDirectoryScanner(project);
       
    54         ds.scan();
       
    55         String[] files = ds.getIncludedFiles();
       
    56         for (j = 0; j < files.length ; ++j) {
       
    57            romconf = new File(ds.getBasedir(), files[j]);
       
    58            self.log("Adding " + romconf + ".");
       
    59            SAXReader reader = new SAXReader();
       
    60            Document document = reader.read(romconf);
       
    61            Node node = document.selectSingleNode("//build/config");
       
    62            rootConfig.add(node.detach());
       
    63         }
       
    64 }
       
    65 // lets write to a file
       
    66 OutputFormat format = OutputFormat.createPrettyPrint();
       
    67 XMLWriter writer = new XMLWriter(new FileWriter(attributes.get("filename")), format);
       
    68 writer.write( document );
       
    69 writer.close();
       
    70 ]]>
       
    71     </scriptdef>
       
    72     
       
    73     <!--
       
    74        This target is an helper to recompose the rom image configuration using the output of iMaker.
       
    75     -->
       
    76     <target name="imaker-merge-rom-xml">
       
    77         <mkdir dir="${temp.build.dir}"/>
       
    78         <!-- Locates the parsed configuration for ROM builds.
       
    79         @type string
       
    80         @scope private
       
    81         -->
       
    82         <property name="rombuild.config.file.parsed" location="${build.output.dir}/rom_config.xml.parsed" />
       
    83         <hlm:mergeConfigXML filename="${rombuild.config.file.parsed}">
       
    84             <fileset dir="${release.images.dir}" includes="**/*.iconfig.xml"/>    
       
    85         </hlm:mergeConfigXML>
       
    86     </target>
       
    87 
       
    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.
       
   110          To configure that target you have to define an imakerconfigurationset type identified by
       
   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.
       
   115     -->
       
   116     <target name="build-roms" depends="rombuild-imaker-create-buildinfo">
       
   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" />        
       
   143         <property name="imaker.rom.name" value=""/>
       
   144         <hlm:imaker epocroot="${build.drive}/" engineRefid="${imaker.engine}"
       
   145                         output="${roms.log.dir}/${build.id}${imaker.rom.name}.roms.log" verbose="true">
       
   146             <hlm:imakerconfigurationset refid="imaker.rom.config" />
       
   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" />
       
   162         <if>
       
   163             <istrue value="${blocks.enabled}" />
       
   164             <then>
       
   165                 <mkdir dir="${blocks.config.dir}" />
       
   166                 <exec executable="python">
       
   167                     <arg value="-m"/>
       
   168                     <arg value="packager.cli"/>
       
   169                     <arg value="--epocroot=${build.drive}/" />
       
   170                     <arg value="--config=${blocks.config.dir}" />
       
   171                     <arg value="--datasource=imaker-romdir" />
       
   172                     <arg value="-Dname=roms" />
       
   173                     <arg value="-Dversion=1" />
       
   174                     <arg value="-Ddir=${release.images.dir}" />
       
   175                     <arg value="--updateData" />
       
   176                 </exec>
       
   177             </then>
       
   178         </if>
       
   179     </target>
       
   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     
       
   193 </project>