sf-platform/build.xml
author Simon Howkins <simonh@symbian.org>
Thu, 30 Sep 2010 17:39:10 +0100
changeset 1273 92bfe0d10c29
parent 1270 12dad5079459
child 1310 b91679effdcf
permissions -rw-r--r--
Bug 3750: Use .7z extension for PDK zip files created with LZMA compression Post-process the zip files and release_metadata to adjust the extension

<?xml version="1.0" encoding="UTF-8"?>
<project name="SF-PLATFORM-CONFIG" xmlns:hlm="http://www.nokia.com/helium">
  <!-- location of this config -->
  <dirname property="sf.platform.config.dir" file="${ant.file.SF-PLATFORM-CONFIG}"/>

  <!-- import package properties -->
  <import file="${sf.platform.config.dir}/platform_props.ant.xml" optional="true"/>
  
  <!-- import common properties/targets/references -->
  <import file="../common/build.xml" />
  
  <!-- import package references -->
  <import file="${sf.platform.config.dir}/platform_refs.ant.xml"  optional="true"/>
  
    <!-- pre helium 7+ should import compile targets from compile-hlm-5.ant.xml -->
    <if>
        <or>
          <equals arg1="${helium.version}" arg2="5.0"/>
          <equals arg1="${last.major.helium.version}" arg2="5.0"/>
        </or>
        <then>
            <echo>INFO Importing HLM5 compile targets</echo>
            <import file="${sf.platform.config.dir}/compile-hlm-5.ant.xml"/>          
        </then>
        <else>
             <echo>INFO Importing HLM7 compile targets</echo>
             <import file="${sf.platform.config.dir}/compile.ant.xml"/>
        </else>
    </if>

  <!-- MattD - workaround until generating a model from package definitions works-->
  <target name="sf-build-noprep" depends="sf-platform-bootstrap,sf-compile,sf-postbuild">
    <echo>[SF-BUILD-NOPREP] (platform)</echo>
    <echo>[SF-BUILD-NOPREP] WARNING: Not generating model from packages</echo>
  </target>

  <target name="sf-platform-bootstrap" depends="sf-gen-buildinfo-txt,sf-platform-bootstrap-gt,sf-platform-bootstrap-s60"/>

  <target name="sf-gen-buildinfo-txt">
    <mkdir dir="${build.drive}/epoc32/data/"/> 
    <delete file="${build.drive}/epoc32/data/buildinfo.txt"/>
    <echo file="${build.drive}/epoc32/data/buildinfo.txt" append="true" message="DeviceFamily               100 ${line.separator}"/>
    <echo file="${build.drive}/epoc32/data/buildinfo.txt" append="true" message="DeviceFamilyRev            0x900 ${line.separator}"/>
    <echo file="${build.drive}/epoc32/data/buildinfo.txt" append="true" message="ManufacturerSoftwareBuild  ${build.id}_Symbian_OS_v${sf.spec.sbs.variant} ${line.separator}"/>
  </target>

  <target name="sf-platform-bootstrap-gt" >
    <echo>[SF-platform-bootstrap-gt]</echo>
    <!-- do initial stuff to get raptor working -->
    <copy todir="${build.drive}/epoc32/include/variant/" failonerror="true" verbose="true">
        <fileset dir="${build.drive}/${sf.spec.bldmefirst.gt.hrh}" includes="*.hrh"/>
    </copy>
    <copy file="${build.drive}/${sf.spec.bldmefirst.gt.variant}" tofile="${build.drive}/epoc32/tools/variant/variant.cfg" failonerror="true" verbose="true" overwrite="true" preservelastmodified="true" />
    <copy file="${build.drive}/${sf.spec.bldmefirst.sbs.config.xml}" tofile="${build.drive}/epoc32/sbs_config/s60_sbs_config.xml" failonerror="false" verbose="true" overwrite="true" preservelastmodified="true" />
	<if><isset property="sf.spec.bldmefirst.gt.hrh.os"/>
	 <then>
	  <copy file="${build.drive}/${sf.spec.bldmefirst.gt.hrh.os}" tofile="${build.drive}/epoc32/include/variant/Symbian_OS.hrh" failonerror="false" overwrite="true" verbose="true" preservelastmodified="true" />
	 </then>
	</if>
  </target>

  <target name="sf-platform-bootstrap-s60" >    
    <!-- Do touch on S60 variant.cfg to force raptor to export -->
    <touch file="${build.drive}/${sf.spec.bldmefirst.s60.sbs.variant.cfg}" />
    <delete file="${build.log.dir}/${build.id}_bldmefirst-s60.log"/>

    <!-- turn comma separated list into sbs friendly -c list, and _ separated list for friendly log names -->
    <propertyregex property="i.sf.spec.sbs.config.expanded"         override="true" input="${sf.spec.sbs.config}" regexp="(,)" replace=" -c " defaultValue="${sf.spec.sbs.config}" global="true"  casesensitive="false"/>
    <propertyregex property="i.sf.spec.sbs.tools.config.expanded"   override="true" input="${sf.spec.sbs.tools.config}" regexp="(,)" replace=" -c " defaultValue="${sf.spec.sbs.tools.config}" global="true"  casesensitive="false"/>

    <echo message="INFO Target : ${i.sf.spec.sbs.config.expanded} ${i.sf.spec.sbs.tools.config.expanded}"/>

    <property name="sf.compile.bldmefirst.command.sbsexport" value="sbs EXPORT --ignore-os-detection --export-only -c ${i.sf.spec.sbs.config.expanded} -c ${i.sf.spec.sbs.tools.config.expanded}"/>
    <!-- do bldmefirst stage 1-->
    <for list="${sf.spec.bldmefirst.s60.exports}" delimiter="," param="sf.spec.bldmefirst.s60.export">
      <sequential>
          <echo message="Performing bldmefirst export on @{sf.spec.bldmefirst.s60.export}"/>
          <exec executable="cmd" dir="${build.drive}" failonerror="true" append="true" output="${build.log.dir}/${build.id}_bldmefirst-s60.log">
            <arg value="/c"/>
            <arg value="${sf.compile.bldmefirst.command.sbsexport}" />
            <arg value="-b"/>
            <arg value="${build.drive}/@{sf.spec.bldmefirst.s60.export}/bld.inf"/>
          </exec>  
      </sequential>
    </for>  
  </target>
            

  <!-- workaround until GenXML can merge v2.0.0 fragments -->
  <!--
    This target is effectively a callback, called from compile-main.
    Its responsibility is to convert the set of peices in ref "system.definition.files" into one sys def with absolute paths

    However, in our builds, we know that there will only be one sysdef peice passed in, so that makes things a lot simpler
  -->
  <target name="create-canonical-sysdef-file">
    <fail message="Symbian builds create a canonical system definition from exactly one peice">
      <condition>
        <resourcecount refid="system.definition.files" when="ne" count="1"/>
      </condition>
    </fail>

    <!-- Locate the first/only item referenced -->
    <for param="file">
      <resources refid="system.definition.files"/>
      <sequential>
        <echo message="@{file}"/>
        <!-- Once a property is set, it stays set - bingo! -->
        <property name="sf.first.system.definition" value="@{file}"/>
      </sequential>
    </for>

    <!-- Having located the file, copy it to the final desired location, absoluting tha paths as we go -->
    <copy tofile="${canonical.sysdef.file}" file="${sf.first.system.definition}" overwrite="true" verbose="true">
      <filterchain>
        <replaceregex pattern="bldFile=&quot;os" replace="bldFile=&quot;/sf/os" flags="gi"/>
        <replaceregex pattern="mrp=&quot;os" replace="mrp=&quot;/sf/os" flags="gi"/>
        <replaceregex pattern="bldFile=&quot;mw" replace="bldFile=&quot;/sf/mw" flags="gi"/>
        <replaceregex pattern="mrp=&quot;mw" replace="mrp=&quot;/sf/mw" flags="gi"/>
        <replaceregex pattern="bldFile=&quot;app" replace="bldFile=&quot;/sf/app" flags="gi"/>
        <replaceregex pattern="mrp=&quot;app" replace="mrp=&quot;/sf/app" flags="gi"/>
        <replaceregex pattern="bldFile=&quot;tools" replace="bldFile=&quot;/sf/tools" flags="gi"/>
        <replaceregex pattern="mrp=&quot;tools" replace="mrp=&quot;/sf/tools" flags="gi"/>
        <replaceregex pattern="bldFile=&quot;adapt" replace="bldFile=&quot;/sf/adapt" flags="gi"/>
        <replaceregex pattern="mrp=&quot;adapt" replace="mrp=&quot;/sf/adapt" flags="gi"/>
        <expandproperties/>
      </filterchain>
    </copy>

    <!-- Now also break up the system definition into a set of package definitions that it corresponds to -->
    <exec executable="perl.exe">
        <arg value="${sf.common.config.dir}/tools/split_sysdef.pl"/>
        <arg value="--sysdef=${canonical.sysdef.file}"/>
        <arg value="--outdir=${build.log.dir}/package_definitions"/>
    </exec>

 </target>

  <!--
    == Name: SF-COMPILE
    ==
    == Desc: Override of common sf-compile target defined in
    ==       common\build.xml
    ==
    -->
  <target name="sf-compile">
    <stopwatch name="sf-compile"/>

    <runtarget target="sf-os-compile"/>

    <!-- always run cenrep -->
    <if><equals arg1="${sf.spec.job.name}" arg2="symbian2"/>
      <then>
        <runtarget target="sf-s60-create-cenrep"/>
      </then>
      <else>
        <!-- symbian3+ should use ConE -->
        <runtarget target="sf-s60-cone-cenrep"/>
      </else>
    </if>
    <stopwatch name="sf-compile" action="elapsed"/>
  </target>

  <target name="sf-s60-create-cenrep">
    <echo message="INFO Generating CenRep"/>
    <echo message="Move 'sf.spec.s60.cenrep.export.location' out of the build..."/>
    <property name="sf.spec.s60.cenrep.export.location.1" value="/epoc32/rom/config/confml_data/s60"/>
    <property name="sf.spec.s60.cenrep.export.location.2" value="/epoc32/rom/config/assets"/>

    <if><available file="${build.drive}/${sf.spec.s60.cenrep.export.location.1}" type="dir"/>
      <then>
        <property name="sf.spec.s60.cenrep.export.location" value="${sf.spec.s60.cenrep.export.location.1}"/>
      </then>
      <else>
        <property name="sf.spec.s60.cenrep.export.location" value="${sf.spec.s60.cenrep.export.location.2}"/>
      </else>
    </if>

    <echo message="${helium.dir}/../ConfigurationTool/cli_build.cmd -master_conf s60 -impl ${sf.spec.s60.cenrep.export.location} -confml ${sf.spec.s60.cenrep.export.location} -ignore_errors" />
    <exec executable="${helium.dir}/../ConfigurationTool/cli_build.cmd" dir="${build.drive}" failonerror="false" output="${build.log.dir}/${build.id}_create_cenrep.log">
      <arg value="-master_conf"/>
      <arg value="s60"/>
      <arg value="-impl"/>
      <arg value="${sf.spec.s60.cenrep.export.location}"/>
      <arg value="-confml"/>
      <arg value="${sf.spec.s60.cenrep.export.location}"/>
      <arg value="-ignore_errors"/>
    </exec>

    <if><available  file="${build.drive}/cli_build_error.log" />
      <then>
        <echo message="INFO CenRep error log found, moving to ${build.log.dir}" />
        <move file="${build.drive}/cli_build_error.log" todir="${build.log.dir}" failonerror="false"/>
      </then>
    </if>
  </target>

  <target name="sf-s60-cone-cenrep">
    <!-- TODO: Make this better, as multiple exec calls are a bit clunky -->
    <if>
      <available file="${env.PDT_HOME}/ConE/" type="dir"/>
      <then>
        <echo message="INFO Generating ConE CenRep"/>

        <exec executable="cmd" dir="${build.drive}/epoc32/tools" failonerror="false" output="${build.log.dir}/${build.id}_cenrep.log">
          <arg value="/c"/>
          <arg value="${env.PDT_HOME}/ConE/cone.cmd"/>
          <arg value="generate"/>
          <arg value="-p"/>
          <arg value="\epoc32\rom\config"/>
          <arg value="-c"/>
          <arg value="convert.confml"/>
          <arg value="-o"/>
          <arg value="${build.drive}/epoc32/rom/config"/>
        </exec>

        <exec executable="cmd" dir="${build.drive}/epoc32/tools" failonerror="false" append="true" output="${build.log.dir}/${build.id}_cenrep.log">
          <arg value="/c"/>
          <arg value="${env.PDT_HOME}/ConE/cone.cmd"/>
          <arg value="generate"/>
          <arg value="-p"/>
          <arg value="\epoc32\rom\config"/>
          <arg value="-o"/>
          <arg value="\epoc32\release\winscw\udeb\z"/>
          <arg value="-c"/>
          <arg value="s60_root.confml"/>
          <arg value="-v"/>
          <arg value="5"/>
        </exec>
        
        <exec executable="cmd" dir="${build.drive}/epoc32/tools" failonerror="false" append="true" output="${build.log.dir}/${build.id}_cenrep.log">
          <arg value="/c"/>
          <arg value="${env.PDT_HOME}/ConE/cone.cmd"/>
          <arg value="generate"/>
          <arg value="-p"/>
          <arg value="\epoc32\rom\config"/>
          <arg value="-o"/>
          <arg value="\epoc32\release\winscw\urel\z"/>
          <arg value="-c"/>
          <arg value="s60_root.confml"/>
          <arg value="-v"/>
          <arg value="5"/>
        </exec>

        <exec executable="cmd" dir="${build.drive}/epoc32/tools" failonerror="false" append="true" output="${build.log.dir}/${build.id}_cenrep.log">
          <arg value="/c"/>
          <arg value="${env.PDT_HOME}/ConE/cone.cmd"/>
          <arg value="generate"/>
          <arg value="-p"/>
          <arg value="\epoc32\rom\config"/>
          <arg value="-o"/>
          <arg value="\epoc32\data\z"/>
          <arg value="-c"/>
          <arg value="s60_root.confml"/>
          <arg value="-v"/>
          <arg value="5"/>
        </exec>
        
        <exec executable="cmd" dir="${build.drive}/epoc32/tools" failonerror="false" append="true" output="${build.log.dir}/${build.id}_cenrep.log">
          <arg value="/c"/>
          <arg value="${env.PDT_HOME}/ConE/cone.cmd"/>
          <arg value="generate"/>
          <arg value="-p"/>
          <arg value="\epoc32\rom\config"/>
          <arg value="-o"/>
          <arg value="\epoc32\release\winscw\udeb\z"/>
          <arg value="-c"/>
          <arg value="symbianos_root.confml"/>
          <arg value="-v"/>
          <arg value="5"/>
        </exec>
        
        <exec executable="cmd" dir="${build.drive}/epoc32/tools" failonerror="false" append="true" output="${build.log.dir}/${build.id}_cenrep.log">
          <arg value="/c"/>
          <arg value="${env.PDT_HOME}/ConE/cone.cmd"/>
          <arg value="generate"/>
          <arg value="-p"/>
          <arg value="\epoc32\rom\config"/>
          <arg value="-o"/>
          <arg value="\epoc32\release\winscw\urel\z"/>
          <arg value="-c"/>
          <arg value="symbianos_root.confml"/>
          <arg value="-v"/>
          <arg value="5"/>
        </exec>
        
        <exec executable="cmd" dir="${build.drive}/epoc32/tools" failonerror="false" append="true" output="${build.log.dir}/${build.id}_cenrep.log">
          <arg value="/c"/>
          <arg value="${env.PDT_HOME}/ConE/cone.cmd"/>
          <arg value="generate"/>
          <arg value="-p"/>
          <arg value="\epoc32\rom\config"/>
          <arg value="-o"/>
          <arg value="\epoc32\data\z"/>
          <arg value="-c"/>
          <arg value="symbianos_root.confml"/>
          <arg value="-v"/>
          <arg value="5"/>
        </exec>
        
      </then>
      <else>
        <echo message="WARNING ConE is required to run this target. ConE not found in ${env.PDT_HOME}/ConE/, please update your PDT."/>
      </else>
    </if>
  </target>
    
</project>