common/build.postbuild.xml
author brendand@symbian.org
Wed, 30 Jun 2010 07:53:54 +0100
changeset 1147 f89d89c04930
parent 1112 befa266a0393
child 1169 5fafe4f9fda8
permissions -rw-r--r--
Replace the qt.conf for the duration of the building of the tests

<?xml version="1.0" encoding="UTF-8"?>
<project name="SF-POSTBUILD" xmlns:hlm="http://www.nokia.com/helium">
    <target name="sf-postbuild" depends="sf-build-roms">
        <stopwatch name="sf-postbuild"/>
        <echo>[SF-POSTBUILD]</echo>
        
        <if><istrue value="${sf.relicense.exported.headers}"/>
        <then>
            <runtarget target="sf-run-sfl-licence-munging"/>
        </then>
        </if>
        
        <parallel>
            <!-- TAG SOURCE CODE -->
            <if>
                <istrue value="${sf.spec.tagafterbuild.enable}" />
                <then>
                    <echo message="Apply tag to the source code used in this build"/>
                    <runtarget target="sf-tag-hg-code"/>
                </then>
            </if>
            
            <!-- Create MD5s -->
            <if>
                <istrue value="${sf.spec.md5.enable}"/>
                <then>
                    <echo message="INFO Creating MD5s"/>
                    <runtarget target="sf-run-evalid"/>
                </then>
            </if>
            
            <!-- Package up the binaries we built -->
            <if>
                <istrue value="${sf.spec.package.bin.enable}"/>
                <then>
                    <stopwatch name="sf-postbuild packaging binaries"/>
                    <echo message="INFO Packaging Binaries"/>
                    <runtarget target="sf-package-binary"/>
    
                    <echo message="INFO Validate Zip files"/>
                    <runtarget target="sf-package-validate"/>
                    <stopwatch name="sf-postbuild packaging binaries" action="elapsed"/>
                </then>
            </if>
            
            <!-- run build analysis tools -->
            <runtarget target="sf-run-analysis"/>

            <if>
                <istrue value="${sf.spec.publish.enable}"/>
                <then>
                    <!-- Generate reports to compare this build to a previous one -->
                    <runtarget target="sf-compare-to-baseline"/>
                </then>
            </if>
        </parallel>
        
        <!-- Generate release_metadata entries for the md5 zips -->
        <antcall target="sf-zip-content">
            <param name="zip.config.file" value="${temp.build.dir}/zip.cfg.xml.ftl"/>
            <param name="zip.target.name" value="md5-just-metadata" />
        </antcall>
 
        <!-- Launch smoketest -->
        <if><istrue value="${sf.spec.test.sendpkg.enable}"/>
            <then>
                <runtarget target="sf-build-smoketestpkg"/>
                <runtarget target="sf-send-testpkg"/>
            </then>
        </if>

        <!-- Launch BC check -->
        <if><istrue value="${sf.spec.bccheck.enable}"/>
            <then>
                <runtarget target="sf-bc-check"/>
            </then>
        </if>

        <!-- copy log files linked to the generation of roms for REE -->
        <runtarget target="sf-copy-rom-logs"/>

        <runtarget target="sf-merge-brag"/>

        <!-- Zip up all the logs -->
        <runtarget target="sf-zip-logs"/>
        
        <if>
            <istrue value="${sf.spec.publish.enable}" />
            <then>
                <echo message="Send links to Diamonds"/>
                <runtarget target="sf-links-to-diamonds"/>
                <echo message="Send BRAG status information to Diamonds"/>
                <runtarget target="sf-brag-to-diamonds"/>
                
                <echo message="Publish log files and reports to ${sf.spec.publish.rootdir}"/>
                <runtarget target="sf-publish"/>
            </then>
        </if>
        <runtarget target="sf-build-summary"/>
        <stopwatch name="sf-postbuild" action="elapsed"/>
    </target>

    <target name="sf-tag-hg-code">
        <!-- To do the tagging, we need to know what tag to use, and who the author is (from hg's perspective) -->
        <fail message="This target needs to have all the details specified, or to be run interactively so it can query the user">
            <condition>
                <and>
                    <isset property="sf.hudson.executor.number"/>
                    <not>
                        <or>
                            <isset property="sf.tagafterbuild.tag"/>
                            <isset property="sf.hg.ui.username"/>
                        </or>
                    </not>
                </and>
            </condition>
        </fail>

        <!-- Ask the user, interactively, what tag to use -->
        <input addproperty="sf.tagafterbuild.tag" message="Enter the tag to apply to the code (eg &quot;PDK_1.0.1&quot;):"/>
        <fail message="No tag supplied">
            <condition>
                <length string="${sf.tagafterbuild.tag}" trim="true" length="0"/>
            </condition>
        </fail>

        <!-- Now get the username sorted out -->
        <exec executable="hg" outputproperty="sf.hg.showconfig.ui.username">
            <arg value="showconfig"/>
            <arg value="ui.username"/>
        </exec>
        <input addproperty="sf.hg.ui.username" message="Enter hg author credentials (eg &quot;Fred Bloggs &lt;fredb@example.org&gt;&quot;) default is" defaultvalue="${sf.hg.showconfig.ui.username}"/>
        <fail message="No author supplied">
            <condition>
                <length string="${sf.hg.ui.username}" trim="true" length="0"/>
            </condition>
        </fail>

        <fmpp sourceFile="${sf.common.config.dir}/templates/tag-hg-code.ant.xml.ftl"
              outputFile="${temp.build.dir}/tag-hg-code.ant.xml">
            <data expandProperties="yes">
                ant: antProperties()
                data: csv(${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}, {separator:','})
            </data>
        </fmpp>
        <ant antfile="${temp.build.dir}/tag-hg-code.ant.xml"/>
    </target>

    <target name="sf-push-hg-tags">
        <!-- To do the pushing, we need to have a set of credentials for the developer.symbian.org site -->
        <fail message="This target needs to have loging credentials specified specified, or to be run interactively so it can query the user">
            <condition>
                <and>
                    <isset property="sf.hudson.executor.number"/>
                    <not>
                        <or>
                            <isset property="sf.symbian.account.username"/>
                            <isset property="sf.symbian.account.password"/>
                        </or>
                    </not>
                </and>
            </condition>
        </fail>

        <input addproperty="sf.symbian.account.username" message="Enter symbian.org username (eg &quot;fredb&quot;)"/>
        <fail message="No author supplied">
            <condition>
                <length string="${sf.hg.ui.username}" trim="true" length="0"/>
            </condition>
        </fail>

        <input addproperty="sf.symbian.account.password" message="Enter symbian.org password (eg &quot;unguessable&quot;)">
            <!-- Ant 1.8 supports secure here, which would be an improvement... -->
            <handler type="default"/>
        </input>
        <fail message="No password supplied">
            <condition>
                <length string="${sf.hg.ui.password}" trim="true" length="0"/>
            </condition>
        </fail>

        <if>
            <not>
                <available file="${build.drive}/tagging" type="dir"/>
            </not>
            <then>
                <!-- No dir with tagged repos in - create them! -->
                <runtarget target="sf-tag-hg-code"/>
            </then>
        </if>

        <fmpp sourceFile="${sf.common.config.dir}/templates/push-hg-tags.ant.xml.ftl"
              outputFile="${temp.build.dir}/push-hg-tags.ant.xml">
            <data expandProperties="yes">
                ant: antProperties()
                data: csv(${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}, {separator:','})
            </data>
        </fmpp>
        <ant antfile="${temp.build.dir}/push-hg-tags.ant.xml"/>
    </target>

    <target name="sf-run-evalid" >
        <delete dir="${build.drive}/output/md5"/>
        <mkdir  dir="${build.drive}/output/md5"/>

        <parallel>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/include output/md5/epoc32_include.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/s60 output/md5/epoc32_s60.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/localisation output/md5/epoc32_localisation.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -x \.sym$ -x ^armv5/udeb -x ^armv5/urel -x ^winscw/udeb -x ^winscw/urel -g epoc32/release output/md5/epoc32_release.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -x \.sym$ -g epoc32/release/armv5/udeb output/md5/epoc32_release_armv5_udeb.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -x \.sym$ -g epoc32/release/armv5/urel output/md5/epoc32_release_armv5_urel.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -x \.sym$ -g epoc32/release/winscw/udeb output/md5/epoc32_release_winscw_udeb.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -x \.sym$ -g epoc32/release/winscw/urel output/md5/epoc32_release_winscw_urel.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/cshlpcmp_template output/md5/epoc32_cshlpcmp_template.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/data output/md5/epoc32_data.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/engdoc output/md5/epoc32_engdoc.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/engineeringtools output/md5/epoc32_engineeringtools.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/gcc output/md5/epoc32_gcc.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/gcc_mingw output/md5/epoc32_gcc_mingw.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/ksa output/md5/epoc32_ksa.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/rom output/md5/epoc32_rom.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/rombuild output/md5/epoc32_rombuild.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/sbs_config output/md5/epoc32_sbs_config.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/sdk_special output/md5/epoc32_sdk_special.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/stdapis output/md5/epoc32_stdapis.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/stubs output/md5/epoc32_stubs.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/tools output/md5/epoc32_tools.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/wins output/md5/epoc32_wins.md5"/>
        </exec>
        <exec executable="cmd" dir="${build.drive}/">
            <arg value="/c"/>
            <arg value="evalid -g epoc32/winscw output/md5/epoc32_winscw.md5"/>
        </exec>
        </parallel>
        <!-- package MD5s directly into epoc32/relinfo location so that its usable out-of-the-box -->
        <mkdir dir="${build.output.dir}/zips/release"/> <!-- Hack to prevent non-existing release dir -->
        <zip destfile="${build.output.dir}/zips/release/build_md5.zip">
            <zipfileset dir="${build.drive}/output/md5/" prefix="epoc32/relinfo"/>
        </zip>
    </target>    
    
    <target name="sf-package-binary" depends="sf-package-postbuild-rnd,sf-merge-manifest">
        <!-- Warning: Reverting to using the He zipper will also revert to a single zip for the binaries:
             would need to update the template and possibly the script that populates it -->
        <!--antcall target="sf-zip-content">
            <param name="zip.config.file" value="${temp.build.dir}/zip.cfg.xml.ftl"/>
            <param name="zip.target.name" value="bin" />
        </antcall-->
        <parallel>
            <sequential>
                <if>
                    <isset property="sf.sdk.header.list.file"/>
                    <then>
                        <property name="sf.epoc32.exclusions.file" value="${sf.sdk.header.list.file}"/>
                    </then>
                </if>
                <property name="sf.epoc32.exclusions.file" value="nul:"/>
                <exec executable="7za" dir="${build.drive}/" output="${build.log.dir}/zip_${build.id}_binaries_epoc32.log">
                    <arg value="a"/>
                    <arg value="-t${sf.spec.package.zip.format}"/>
                    <arg value="-x@${build.log.dir}/rnd_excludefile.txt"/> <!-- rnd content taken from internal hg repos -->
                    <arg value="-x@${sf.spec.prebuilt.excludelist}"/>
                    <arg value="-x@output/temp_build_files/manifest_excludelist.txt"/> <!-- merged list of prebuilt content such as binaries_prebuilt -->
                    <arg value="-x@${sf.epoc32.exclusions.file}"/>
                    <arg value="-x!epoc32\gcc"/>
                    <arg value="-x!epoc32\gcc_mingw"/>
                    <arg value="-x!epoc32\tools"/>
                    <arg value="-x!epoc32\data\buildinfo.txt"/>
                    <arg value="-x!epoc32\data\config\features.dat"/>
                    <arg value="-x!epoc32\data\media"/> <!-- Files created when emulator is used to create comms database - not worth releasing-->
                    <arg value="-x!epoc32\build"/>
                    <arg value="-x!epoc32\release\armv5"/>
                    <arg value="-x!epoc32\release\winscw"/>
                    <arg value="-xr!*.sym"/>
                    <arg value="${build.drive}/output/zips/release/binaries_epoc.zip"/>
                    <arg value="epoc32\"/>
                </exec>
            </sequential>
            
            <if>
                <isset property="sf.sdk.header.list.file"/>
                <then>
                    <exec executable="7za" dir="${build.drive}/" output="${build.log.dir}/zip_${build.id}_binaries_sdk.log">
                        <arg value="a"/>
                        <arg value="-t${sf.spec.package.zip.format}"/>
                        <arg value="-i@${sf.sdk.header.list.file}"/>
                        <arg value="-x@${build.log.dir}/rnd_excludefile.txt"/>
                        <arg value="-x@output/temp_build_files/manifest_excludelist.txt"/>
                        <arg value="-x@${sf.spec.prebuilt.excludelist}"/>
                        <arg value="${build.drive}/output/zips/release/binaries_epoc_sdk.zip"/>
                    </exec>
                    <!-- Check that all the files we want in the SDK are zipped -->
                    <antcall target="sf-log-to-brag">
                        <param name="sf.brag.id" value="SDK"/>
                        <param name="sf.brag.log" value="${build.log.dir}/zip_${build.id}_binaries_sdk.log"/>
                        <param name="sf.brag.phase" value="Postbuild"/>
                        <param name="sf.brag.step" value="Package SDK"/>
                    </antcall>
                    <!-- Generate release_metadata entries for the SDK zip -->
                    <antcall target="sf-zip-content">
                        <param name="zip.config.file" value="${temp.build.dir}/zip.cfg.xml.ftl"/>
                        <param name="zip.target.name" value="bin-sdk-just-metadata" />
                    </antcall>
                </then>
            </if>
            
            <!-- WinsCW binaries, by udeb/urel/lib -->
            <exec executable="7za" dir="${build.drive}/" output="${build.log.dir}/zip_${build.id}_binaries_winscw_udeb.log">
                <arg value="a"/>
                <arg value="-t${sf.spec.package.zip.format}"/>
                <arg value="-x@${build.log.dir}/rnd_excludefile.txt"/>
                <arg value="-x@output/temp_build_files/manifest_excludelist.txt"/>
                <arg value="-x@${sf.spec.prebuilt.excludelist}"/>
                <arg value="-xr!*.sym"/>
                <arg value="-xr!*.lib"/>
                <arg value="${build.drive}/output/zips/release/binaries_winscw_udeb.zip"/>
                <arg value="epoc32\release\winscw\udeb"/>
            </exec>
            <exec executable="7za" dir="${build.drive}/" output="${build.log.dir}/zip_${build.id}_binaries_winscw_urel.log">
                <arg value="a"/>
                <arg value="-t${sf.spec.package.zip.format}"/>
                <arg value="-x@${build.log.dir}/rnd_excludefile.txt"/>
                <arg value="-x@output/temp_build_files/manifest_excludelist.txt"/>
                <arg value="-x@${sf.spec.prebuilt.excludelist}"/>
                <arg value="-xr!*.sym"/>
                <arg value="-xr!*.lib"/>
                <arg value="${build.drive}/output/zips/release/binaries_winscw_urel.zip"/>
                <arg value="epoc32\release\winscw\urel"/>
            </exec>
            <exec executable="7za" dir="${build.drive}/" output="${build.log.dir}/zip_${build.id}_binaries_winscw_lib.log">
                <arg value="a"/>
                <arg value="-t${sf.spec.package.zip.format}"/>
                <arg value="-ir!epoc32/release/winscw/*.lib"/>
                <arg value="-x@${build.log.dir}/rnd_excludefile.txt"/>
                <arg value="-x@output/temp_build_files/manifest_excludelist.txt"/>
                <arg value="-x@${sf.spec.prebuilt.excludelist}"/>
                <arg value="${build.drive}/output/zips/release/binaries_winscw_lib.zip"/>
            </exec>
            
            <!-- ARMv5 binaries, by udeb/urel/lib -->
            <exec executable="7za" dir="${build.drive}/" output="${build.log.dir}/zip_${build.id}_binaries_armv5_udeb.log">
                <arg value="a"/>
                <arg value="-t${sf.spec.package.zip.format}"/>
                <arg value="-x@${build.log.dir}/rnd_excludefile.txt"/>
                <arg value="-x@output/temp_build_files/manifest_excludelist.txt"/>
                <arg value="-x@${sf.spec.prebuilt.excludelist}"/>
                <arg value="-xr!*.sym"/>
                <arg value="${build.drive}/output/zips/release/binaries_armv5_udeb.zip"/>
                <arg value="epoc32\release\armv5\udeb"/>
            </exec>
            <exec executable="7za" dir="${build.drive}/" output="${build.log.dir}/zip_${build.id}_binaries_armv5_urel.log">
                <arg value="a"/>
                <arg value="-t${sf.spec.package.zip.format}"/>
                <arg value="-x@${build.log.dir}/rnd_excludefile.txt"/>
                <arg value="-x@output/temp_build_files/manifest_excludelist.txt"/>
                <arg value="-x@${sf.spec.prebuilt.excludelist}"/>
                <arg value="-xr!*.sym"/>
                <arg value="${build.drive}/output/zips/release/binaries_armv5_urel.zip"/>
                <arg value="epoc32\release\armv5\urel"/>
            </exec>
            <exec executable="7za" dir="${build.drive}/" output="${build.log.dir}/zip_${build.id}_binaries_armv5_lib.log">
                <arg value="a"/>
                <arg value="-t${sf.spec.package.zip.format}"/>
                <arg value="-x@${build.log.dir}/rnd_excludefile.txt"/>
                <arg value="-x@output/temp_build_files/manifest_excludelist.txt"/>
                <arg value="-x@${sf.spec.prebuilt.excludelist}"/>
                <arg value="-xr!*.sym"/>
                <arg value="-ir!epoc32/release/armv5/_*.bin"/> <!-- include bootloaders in common lib zipfile -->
                <arg value="${build.drive}/output/zips/release/binaries_armv5_lib.zip"/>
                <arg value="epoc32\release\armv5\lib"/>
            </exec>
        </parallel>
        
        <runtarget target="sf-package-tools"/>
        <runtarget target="sf-package-prebuilt"/>
        
        <!-- Generate release_metadata entries for the above zips -->
        <antcall target="sf-zip-content">
            <param name="zip.config.file" value="${temp.build.dir}/zip.cfg.xml.ftl"/>
            <param name="zip.target.name" value="bin-just-metadata" />
        </antcall>
    </target>

    <target name="sf-package-postbuild-rnd" >
        <antcall target="sf-zip-content">
            <param name="zip.config.file" value="${temp.build.dir}/zip.cfg.xml.ftl"/>
            <param name="zip.target.name" value="rnd-postbuild" />
        </antcall>
    </target>

    <target name="sf-package-tools" depends="sf-merge-manifest">
        <exec executable="7za" dir="${build.drive}/" output="${build.log.dir}/zip_${build.id}_tools_epoc32.log">
            <arg value="a"/>
            <arg value="-t${sf.spec.package.zip.format}"/>
            <arg value="-x@${build.log.dir}/rnd_excludefile.txt"/>
            <arg value="-x@/output/temp_build_files/manifest_excludelist.txt"/>
            <arg value="-x@${sf.spec.prebuilt.excludelist}"/>
            <arg value="${build.drive}/output/zips/release/tools_epoc.zip"/>
            <arg value="epoc32/tools"/>
            <arg value="epoc32/gcc"/>
            <arg value="epoc32/gcc_mingw"/>
            <arg value="epoc32/data/buildinfo.txt"/>
            <arg value="epoc32/data/config/features.dat"/>
        </exec>
        <antcall target="sf-zip-content">
            <param name="zip.config.file" value="${temp.build.dir}/zip.cfg.xml.ftl"/>
            <param name="zip.target.name" value="tools" />
        </antcall>
    </target>
    
    <target name="sf-package-validate">
        <exec executable="7z" dir="${build.drive}/output/zips" failonerror="false" output="${build.drive}/output/zips/validate.log">
            <arg value="t"/>
            <arg value="*.zip"/>
        </exec>  
        <exec executable="7z" dir="${build.drive}/output/zips/release" failonerror="false" output="${build.drive}/output/zips/release/validate.log">
            <arg value="t"/>
            <arg value="*.zip"/>
        </exec>  
    </target>

    <!-- merge manifests for prebuilt stuff delivered at the start of build process -->
    <target name="sf-merge-manifest">
      <echo message="INFO Build drive is ${build.drive} "/>
      <concat destfile="${build.drive}\output\temp_build_files\manifest_excludelist.txt">
        <fileset dir="${build.drive}" includes="*manifest*" excludes="manifest_excludelist.txt"/>
      </concat>
       
       <!-- touch file to update/create it in the event that there are no manifest* files available 
            as 7z will not be happy being given a non-existent file -->  
      <touch file="${build.drive}\output\temp_build_files\manifest_excludelist.txt"/>
    </target>

    <target name="sf-package-prebuilt" depends="sf-merge-manifest">
    <!-- for each prebuilt manifest* file, repackage -->  

      <for param="manifest">
        <path>
          <fileset dir="${build.drive}\">
            <include name="manifest*.txt"/>
            <exclude name="manifest*restricted*.txt"/> <!-- dont repack restricted content such as testconfigfileparser -->
          </fileset>
        </path>
        <!-- strip manifest_ and .txt extension for matched file -->
        <sequential>
        <propertyregex property="manifest.shortname" override="true" input="@{manifest}" regexp="manifest_(\S+)(.txt)" select="\1" global="true"  casesensitive="false"/>
        <propertyregex property="manifest.fullname"  override="true" input="@{manifest}" regexp="(.*)" select="\1" global="true"  casesensitive="false"/>
        <propertyregex property="manifest.pkgname"   override="true" input="@{manifest}" regexp="manifest_binaries_(\S+)(.txt)" select="\1" global="true"  casesensitive="false"/>

        <echo message="INFO Packaging ${manifest.fullname} into ${manifest.shortname}.zip"/>

        <exec executable="7za" dir="${build.drive}/" output="${build.drive}/zip_${manifest.shortname}.log">
            <arg value="a"/>
            <arg value="-t${sf.spec.package.zip.format}"/>
            <arg value="-i@${manifest.fullname}"/>
            <arg value="${build.drive}/output/zips/release/${manifest.shortname}.zip"/> 
        </exec>

        <!-- merge release metadata -->
        <antcall target="sf-zip-content">
            <param name="zip.config.file"  value="${temp.build.dir}/zip.cfg.xml.ftl"/>
            <param name="zip.target.name"  value="bin-${manifest.pkgname}-metadata" />
            <param name="sf.spec.job.name" value="${manifest.pkgname}" />
        </antcall>
        </sequential>  
      </for>

    </target>
    <!-- runs analysis of missing bins and source -->
    <target name="sf-run-analysis">
        <stopwatch name="sf-run-analysis"/>
        <mkdir dir="${build.log.dir}/analysis"/>
        <parallel>
          <runtarget target="sf-run-analysis-ant"/>
          <runtarget target="sf-run-analysis-raptor"/>
          <runtarget target="sf-run-analysis-yarp"/>
          <runtarget target="sf-run-analysis-whatlog-summary"/>
          <runtarget target="sf-run-analysis-missing-files"/>
        </parallel>
        <if>
          <istrue value="${sf.spec.publish.enable}"/>
            <then>
            <runtarget target="sf-run-analysis-diamonds"/>
            </then>
        </if>
        <stopwatch name="sf-run-analysis" action="elapsed"/>
    </target>

    <target name="sf-run-analysis-ant">    
        <echo message="Running source analysis of ANT output"/>
        <exec executable="perl" dir="${build.log.dir}" failonerror="false" output="${build.log.dir}/analysis/${build.id}_scan_ant.log">
            <arg value="${sf.common.config.dir}/tools/analysis/scan_antlogs.pl"/>
            <arg value="*ant*"/>
            <arg value="*stderr*"/>  <!-- helium 7 splits output into stderr logs, so use them also -->
            <arg value="*sbs_error*"/> 
        </exec>
    </target>

    <target name="sf-run-analysis-raptor">            
      <!-- Cook the processed raptor logs to produce something in the right format for the BRAG system -->
      <mkdir dir="${build.log.dir}/summary/"/>
      <!-- exec executable="perl" output="${build.log.dir}/summary/sbs_BRAG.xml" logError="yes" failonerror="false">
        <arg value="${sf.common.config.dir}/tools/brag/sbsToBRAG.pl"/>
        <arg value="${build.log.dir}/analysis/*_compile_preprocessed.log"/>
      </exec -->
      
      <echo message="Running UH parser on *_compile.log files"/>
      <apply executable="perl" dir="${build.drive}/utilities/uh_parser" failonerror="false" output="${build.log.dir}/analysis/${build.id}_raptorparse.log" parallel="true">
        <arg value="uh.pl"/>
        <arg value="-m"/>
        <arg value="--basedir=${build.log.dir}"/>
        <fileset dir="${build.log.dir}">
          <include name="*_compile.log"/>
          <include name="*_export.log"/>  <!-- for explicit export step -->
          <exclude name="*build_check_compile.log"/>
        </fileset>
      </apply>
          
      <!-- Now iterate through the generated TSVs to sort them and remove duplicates -->
      <for param="tsv">
        <path>
          <fileset dir="${build.log.dir}">
            <include name="releaseables/**/*.tsv"/>
          </fileset>
        </path>
        <sequential>
          <exec executable="perl" input="@{tsv}" output="@{tsv}">
            <arg value="${sf.common.config.dir}/tools/sortUnique.pl"/>
          </exec>
        </sequential>
      </for>

      <!-- Cook the raptor analysis further to produce something in the right format for the BRAG system -->
      <exec executable="perl" output="${build.log.dir}/summary/Uh_BRAG.xml" logError="yes">
        <arg value="${sf.common.config.dir}/tools/brag/uh2brag.pl"/>
        <arg value="--index"/>
        <arg value="${build.log.dir}/html/index.html"/>
      </exec>
      <!-- And copy the XSL so the output can be transformed by a browser -->
      <copy file="${sf.common.config.dir}/tools/brag/brag.xsl" toDir="${build.log.dir}/summary/"/>
    </target>

    <target name="sf-run-analysis-yarp">
      <echo message="Running yarp over *_compile.log files"/>
      <for param="logfile">
        <path>
          <fileset dir="${build.log.dir}">
            <include name="*_compile.log"/>
            <exclude name="*build_check_compile.log"/>
          </fileset>
        </path>
        <sequential>
          <propertyregex override="yes" property="yarpfile"  input="@{logfile}" regexp=".*[\\|\/](.*)_compile\.log" replace="\1_yarp.csv"/>
          <propertyregex override="yes" property="yarpfile_short"  input="${yarpfile}" regexp="[^_]*_[^_]*_[^_]*_(.+)_[^_]*_yarp\.csv" replace="YARP_\1"/>
          <echo message="Yarping @{logfile}..."/>
          <exec executable="perl" dir="${build.drive}" failonerror="false" output="${build.log.dir}/analysis/${yarpfile}.log" append="true">
            <arg value="${sf.common.config.dir}/tools/analysis/yarp.pl"/>
            <arg value="@{logfile}"/>
            <arg value="${build.log.dir}/analysis/${yarpfile}"/>
          </exec>
          <exec executable="cmd" output="${build.drive}/output/logs/analysis/tmp_yarp_files.csv" append="true">
            <arg value="/c"/>
            <arg value="echo"/>
            <arg value="${yarpfile_short},${sf.spec.publish.networkdrive}\${sf.spec.job.name}\builds\${sf.spec.job.codeline}\${build.id}\logs\analysis\${yarpfile},${build.drive}\output\logs\analysis\${yarpfile}"/>
          </exec>
        </sequential>
      </for>
      
      <!-- Cook the yarp analysis further to produce something in the right format for the BRAG system -->
      <mkdir dir="${build.log.dir}/summary/"/>
      <!-- exec executable="perl" output="${build.log.dir}/summary/Yarp_BRAG.xml" logError="yes">
        <arg value="${sf.common.config.dir}/tools/brag/yarpToBRAG.pl"/>
        <arg value="${build.log.dir}/analysis/*_yarp.csv"/>
      </exec -->
      
      <exec executable="perl" dir="${build.drive}" failonerror="false" outputproperty="sf.job.totalyarperrors">
        <arg value="${sf.common.config.dir}/tools/analysis/parse_yarp_files.pl"/>
        <arg value="${build.drive}/output/logs/analysis/tmp_yarp_files.csv"/>
      </exec>
      <echo message="Total yarp errors: ${sf.job.totalyarperrors}"/>
    </target>
    
    <target name="sf-run-analysis-whatlog-summary" >
        <sequential>
          <parallel>
            <runtarget target="sf-run-analysis-list"/>
            <runtarget target="sf-run-analysis-whatlog"/>
          </parallel>
          <runtarget target="sf-run-analysis-whatlog-merge" />
          <parallel>
            <runtarget target="sf-run-analysis-whatlog-package"/>
            <runtarget target="sf-run-analysis-whatlog-collisons"/>
          </parallel>
        </sequential>
    </target>
    
    <target name="sf-run-analysis-list">    
        <echo message="Running list analysis"/>
        <exec executable="perl" dir="${build.log.dir}/analysis" failonerror="false" output="${build.log.dir}/analysis/${build.id}_list_results.log">
            <arg value="${sf.common.config.dir}/tools/analysis/parselistdirs.pl"/>
            <arg value="..\"/>
        </exec>
    </target>

    <target name="sf-run-analysis-whatlog">    
        <echo message="Running whatlog analysis"/>
        <exec executable="perl" dir="${build.log.dir}/analysis" failonerror="false" output="${build.log.dir}/analysis/${build.id}_what_results.csv">
            <arg value="${sf.common.config.dir}/tools/analysis/parsewhatlog.pl"/>
            <arg value="..\"/>
        </exec>
    </target>

    <target name="sf-run-analysis-whatlog-merge" >        
        <echo message="Running summary analysis"/>
        <exec executable="perl" dir="${build.log.dir}/analysis" failonerror="false" output="${build.log.dir}/analysis/${build.id}_summary.log">
            <arg value="${sf.common.config.dir}/tools/analysis/merge_csv.pl"/>
            <arg value="${build.id}_what_results.csv"/>
            <arg value="${build.id}_list_results.log"/>
            <arg value="${build.drive}/output/zips/release/binaries_epoc_additional.zip"/>
        </exec>
    </target>
    
    <target name="sf-run-analysis-whatlog-package" >        
        <exec executable="perl" dir="${build.log.dir}/analysis" failonerror="false" output="${build.log.dir}/analysis/${build.id}_analysecomponents.log">
            <arg value="${sf.common.config.dir}/tools/analysis/analyse_components.pl"/>
            <arg value="${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}"/>
            <arg value="${build.id}_what_results.csv_results.csv"/>
            <arg value="${sf.project.location}/sysdefs/system_model_os.xml"/>
            <arg value="${sf.project.location}/sysdefs/system_model_s60.xml"/>
        </exec>
    </target>
    
    <target name="sf-run-analysis-whatlog-collisons" >        
        <echo message="Running collision analysis"/>
        <exec executable="perl" dir="${build.drive}" failonerror="false" output="${build.log.dir}/analysis/${build.id}_collisions.log">
            <arg value="${sf.common.config.dir}/tools/analysis/find_collisions.pl"/>
            <arg value="${build.log.dir}/analysis/${build.id}_what_results.csv"/>
        </exec>
    </target>
    
    <target name="sf-run-analysis-diamonds">
      <if>
        <istrue value="${sf.spec.publish.enable}"/>
        <then>
          <echo>[SF-RUN-ANALYSIS-DIAMONDS]</echo>
          <echo message="Translate \output\logs\html\index.html into a Diamonds file"/>
          <exec executable="perl" dir="${build.drive}">
            <arg value="${sf.common.config.dir}/tools/uh2diamonds.pl"/>
          </exec>
          <echo message="Send ${build.log.dir}/diamonds_uh.xml to Diamonds"/>
          <exec executable="python">
            <arg value="${sf.common.config.dir}/tools/brag/send_xml_to_diamonds.py"/>
            <arg value="-u"/>
            <arg value="http://${diamonds.host}${diamonds.build.id}"/>
            <arg value="-f"/>
            <arg value="${build.log.dir}/diamonds_uh.xml"/>
          </exec>
        </then>
      </if>
    </target>
    
    <target name="sf-links-to-diamonds">
      <fmpp sourceFile="${sf.common.config.dir}/diamonds/linksForDiamonds.xml.ftl" outputFile="${build.log.dir}/linksForDiamonds.xml">
        <data expandProperties="yes">
          ant: antProperties()
        </data>
      </fmpp>
      <!-- Send the data to the server -->
      <exec executable="python">
        <arg value="${sf.common.config.dir}/tools/brag/send_xml_to_diamonds.py"/>
        <arg value="-u"/>
        <arg value="http://${diamonds.host}${diamonds.build.id}"/>
        <arg value="-f"/>
        <arg value="${build.log.dir}/linksForDiamonds.xml"/>
      </exec>
    </target>

    <target name="sf-merge-brag">
        <!-- Merge all our bits of XML together -->
        <exec executable="perl" output="${build.log.dir}/summary/_BRAG.xml" logError="true">
            <arg value="${sf.common.config.dir}/tools/mergeXML.pl"/>
            <arg value="--xsl=brag.xsl"/>
            <arg value="--merge=buildStatus,phase(name),step(name),failures(level)"/>
            <arg value="${build.log.dir}/summary/*?_BRAG.xml"/>
        </exec>
    </target>

    <target name="sf-brag-to-diamonds">
        <!-- Run XSL transform to create file to send to diamonds -->
        <java jar="${sf.common.config.dir}/sysdefdowngrade/xalan-j_2_7_1/xalan.jar" fork="true">
            <arg value="-IN"/>
            <arg value="${build.log.dir}/summary/_BRAG.xml"/>
            <arg value="-XSL"/>
            <arg value="${sf.common.config.dir}/tools/brag/bragForDiamonds.xsl"/>
            <arg value="-OUT"/>
            <arg value="${temp.build.dir}/bragForDiamonds.xml"/>
        </java>
        <if>
            <istrue value="${sf.spec.publish.enable}"/>
            <then>
                <!-- Make sure that the summary directory is available to display the BRAG link -->
                <mkdir  dir="${publish.dir}/summary/"/>
                <copy todir="${publish.dir}/summary/" preservelastmodified="true" failonerror="false">
                   <fileset dir="${build.log.dir}/summary/"><include name="*.*"/></fileset>
                </copy>

                <!-- Try to obtain the diamonds ID for this build -->
                <if>
                    <not><isset property="diamonds.build.id"/></not>
                    <then>
                        <property file="${build.log.dir}/diamonds_build_id.properties"/> <!-- This will fail silently -->
                    </then>
                </if>
                <if>
                    <isset property="diamonds.build.id"/>
                    <then>
                        <!-- Send the data to the server -->
                        <exec executable="python">
                            <arg value="${sf.common.config.dir}/tools/brag/send_xml_to_diamonds.py"/>
                            <arg value="-u"/>
                            <arg value="http://${diamonds.host}${diamonds.build.id}"/>
                            <arg value="-f"/>
                            <arg value="${temp.build.dir}/bragForDiamonds.xml"/>
                        </exec>
                    </then>
                    <else>
                        <echo message="diamonds.build.id is not known - unable to push any build specific information to diamonds server"/>
                    </else>
                </if>
            </then>
        </if>
    </target>

    <target name="sf-check-utilities-dir">
        <available property="sf-utilities-available" file="${build.drive}/utilities" type="dir"/>
    </target>

    <target name="sf-compare-to-baseline" depends="sf-diamondize-bom,sf-check-utilities-dir" if="sf-utilities-available">
        <property name="sf.releasenotes.wiki.txt" value="${build.log.dir}/releaseNotes.wiki.txt"/>
        <delete file="${sf.releasenotes.wiki.txt}"/>
        <!-- FCL Usage and Changesets -->
        <exec executable="perl" dir="${build.drive}" output="${sf.releasenotes.wiki.txt}">
            <arg value="-I"/>
            <arg value="${sf.common.config.dir}/tools/lib"/>
            <arg value="${build.drive}/utilities/releaseAutomation/releaseNotes.pl"/>
            <arg value="--sources=${build.log.dir}/BOM/sources.csv"/>
            <arg value="--baseline=${sf.previous.pdk.tag}"/>
        </exec>
        <!-- Package Comparison and FCL Usage -->
        <exec executable="perl" dir="${sf.spec.sourcesync.sourcespecdir}" output="${sf.releasenotes.wiki.txt}" append="true">
            <arg value="${build.drive}/utilities/releaseAutomation/packageComparison.pl"/>
            <arg value="--sources=${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}"/>
            <arg value="--sysdef=${sf.spec.sourcesync.sourcespecdir}/sysdefs/system_model.xml"/>
            <arg value="--sysdef=${sf.spec.sourcesync.sourcespecdir}/sysdefs/system_model_os.xml"/>
            <arg value="--sysdef=${sf.spec.sourcesync.sourcespecdir}/sysdefs/system_model_s60.xml"/>
            <arg value="--baseline=${sf.previous.pdk.tag}"/>
        </exec>
        <!-- Mercurial comparison -->
        <echo file="${sf.releasenotes.wiki.txt}" append="true">== Mercurial Comparison ==${line.separator}${line.separator}</echo>
        <if>
            <isset property="sf.previous.pdk.tag"/>
            <then>
                <echo file="${sf.releasenotes.wiki.txt}" append="true">The Mercurial changes from Nokia were delivered as a bulk update based on '''XXXXXXXXXXXXXXXXXXXXXX'''.${line.separator}${line.separator}List of the Mercurial changes (files added/removed/modified) between ${sf.previous.pdk.tag} and PDK '''XXXXX''' - [[Media:XXXX.txt]].${line.separator}${line.separator}A short study of the results concentrating on the added and removed files has identified these significant package changes:${line.separator}${line.separator}</echo>
                <if>
                    <istrue value="${sf.spec.sourcesync.archive}"/>
                    <then>
                        <echo file="${sf.releasenotes.wiki.txt}" append="true">'''Information cannot be derived as source was synced with archive option'''"${line.separator}${line.separator}</echo>
                    </then>
                    <else>
                        <exec executable="perl" dir="${build.drive}/" output="${sf.releasenotes.wiki.txt}" append="true">
                            <arg value="${build.drive}/utilities/releaseAutomation/mercurialComparison.pl"/>
                            <arg value="${build.log.dir}/BOM/build-info.xml"/>
                            <arg value="${sf.previous.pdk.tag}"/>
                            <arg value="${build.log.dir}/mercurialComparison.tsv"/>
                        </exec>
                    </else>
                </if>
            </then>
            <else>
                <echo file="${sf.releasenotes.wiki.txt}" append="true">'''Information cannot be provided as the tag for the previous PDK was not provided to the build'''"${line.separator}${line.separator}</echo>
            </else>
        </if>
        
        <!-- Code churn -->
        <!-- TODO? -->
        <fixcrlf file="${sf.releasenotes.wiki.txt}"/>
    </target>

    <!-- package all logs into zipfile for publishing -->
    <target name="sf-zip-logs" >
        <if>
            <istrue value="${sf.spec.logs.zip.enable}"/>
            <then>
                <mkdir dir="${build.output.dir}/zips/release"/> <!-- workaround for when there's no other releaseables, just the logs -->
                <zip destfile="${build.output.dir}/zips/release/build_logs.zip" basedir="${build.drive}"> 
                    <include name="output/logs/**"/>
                    <exclude name="output/logs/BC/**"/>
                    <exclude name="output/logs/BOM/**"/>
                    <exclude name="output/logs/deliverables/**"/>
                    <exclude name="output/logs/releaseables/**"/>
                </zip>
                <!-- workaround for the time when when 'sf-run-analysis-raptor' has not been run -->
                <mkdir dir="${build.drive}/output/logs/releaseables"/>
				<if>
	                <available file="${build.drive}/output/logs/package_definitions" type="dir"/>
	                <then>
		                <zip destfile="${build.output.dir}/zips/release/build_BOM.zip">
	            	        <zipfileset dir="${build.drive}/output/logs/BOM" prefix="build_info/logs/BOM"/>
	        	            <zipfileset dir="${build.drive}/output/logs/releaseables" prefix="build_info/logs/releaseables"/>
	    	                <zipfileset dir="${build.drive}/output/logs" prefix="build_info/logs/BOM">
		                        <include name="envinfo.txt"/>
	                    	</zipfileset>
	                    	<zipfileset dir="${build.drive}/output/logs/package_definitions" prefix="build_info/package_definitions"/>
	                	</zip>
	                </then>
	                <else>
	                	<zip destfile="${build.output.dir}/zips/release/build_BOM.zip">
	            	        <zipfileset dir="${build.drive}/output/logs/BOM" prefix="build_info/logs/BOM"/>
	        	            <zipfileset dir="${build.drive}/output/logs/releaseables" prefix="build_info/logs/releaseables"/>
	    	                <zipfileset dir="${build.drive}/output/logs" prefix="build_info/logs/BOM">
		                        <include name="envinfo.txt"/>
	                    	</zipfileset>
	                	</zip>
	                </else>
	            </if>
                <antcall target="sf-zip-content">
                    <param name="zip.config.file" value="${temp.build.dir}/zip.cfg.xml.ftl"/>
                    <param name="zip.target.name" value="info-just-metadata" />
                </antcall>
            </then>
        </if>
     </target>
    
    <target name="sf-publish" depends="prep-publish">
        <copy todir="${publish.dir}" preservelastmodified="true" failonerror="false">
           <fileset dir="${build.output.dir}/zips/release/"><include name="build_*.zip"/></fileset>
        </copy>
        <mkdir dir="${publish.dir}/html"/>
        <copy todir="${publish.dir}/html" preservelastmodified="true" failonerror="false">
           <fileset dir="${build.log.dir}/html"><include name="*.html"/></fileset>
        </copy>
        <mkdir dir="${publish.dir}/BC"/>
        <copy todir="${publish.dir}/BC" preservelastmodified="true" failonerror="false">
           <fileset dir="${build.log.dir}/BC/">
               <include name="BBCResults.xsl"/>
               <include name="headers_report.xml"/>
               <include name="libraries_report.xml"/>
           </fileset>
        </copy>
        <mkdir dir="${publish.dir}/ats_reports"/>
        <copy file="${sf.common.config.dir}/tools/ats/report_dummy.html" tofile="${publish.dir}/ats_reports/index.html" failonerror="false"/>
    </target>

    <!-- TODO: Make this work for package builds once we have sysmodel story worked out -->
    <target name="sf-run-analysis-missing-files" if="sf.spec.checkbuild">
    <!-- splitbuild is only set for Platform builds -->
       <if><istrue value="${sf.spec.splitbuild}"/>
       <then>
            <if><istrue value="${sf.spec.os.skipbuild}" />
                <then><echo message="Skipping OS file check"/></then>
                <else><runtarget target="sf-check-missing-os-files"/></else>
            </if>

            <if><istrue value="${sf.spec.s60.skipbuild}" />
                <then><echo message="Skipping S60 file check"/></then>
                <else><runtarget target="sf-check-missing-s60-files"/></else>
            </if>
       </then>
       <else>
            <runtarget target="sf-check-missing-os-files"/>
       </else>
    </if>
    </target>
    
    <target name="sf-check-missing-os-files" depends="sf-compile-options">
        <hlm:argSet id="sbs.check.tools.var">
            <hlm:arg name="config" value="${sf.spec.sbs.tools.config}" />
            <hlm:arg name="run-check" value="true" />
        </hlm:argSet>
     
        <hlm:argSet id="sbs.check.main.var">
            <hlm:arg name="config" value="${sf.spec.sbs.config}" />
            <hlm:arg name="run-check" value="true" />
        </hlm:argSet>     
        <antcall target="compile-main" inheritAll="false" inheritRefs="true">
            <param name="build.system" value="${sf.spec.build.system}" />
            <param name="sysdef.configurations.list" value="${sf.spec.os.sysdef.clean.configurations.list}" />
            <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
            <param name="build.id" value ="sbs_check"/>
            <reference refid="sbs.check.tools.var" torefid="sbs.var" />
            <reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
            <reference refid="sf.spec.os.system.definition.files" torefid="system.definition.files" />
        </antcall> 
        <if><istrue value="${sf.os.compile.iterate}"/>
          <then>
            <for list="${sf.spec.sbs.config}" delimiter="," param="sf.spec.check.splitconfig">
              <sequential>
                <echo message="INFO [Iterative check] @{sf.spec.check.splitconfig}"/>
                <hlm:argSet id="sbs.check.iterate.main.var">
                    <hlm:arg name="config" value="@{sf.spec.check.splitconfig}" />
                    <hlm:arg name="run-check" value="true" />
                </hlm:argSet>     
  
                <antcall target="compile-main" inheritAll="false" inheritRefs="true">
                    <param name="build.system" value="${sf.spec.build.system}" />
                    <param name="sysdef.configurations.list" value="${sf.spec.os.sysdef.clean.configurations.list}" />
                    <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
                    <param name="build.id" value ="sbs_check"/>
                    <reference refid="sbs.check.iterate.main.var" torefid="sbs.var" />
                    <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
                    <reference refid="sf.spec.os.system.definition.files" torefid="system.definition.files" />
                </antcall>
              </sequential>
            </for>
          </then>
          <else>
          <antcall target="compile-main" inheritAll="false" inheritRefs="true">
            <param name="build.system" value="${sf.spec.build.system}" />
            <param name="sysdef.configurations.list" value="${sf.spec.os.sysdef.clean.configurations.list}" />
            <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
            <param name="build.id" value ="sbs_check"/>
            <reference refid="sbs.check.main.var" torefid="sbs.var" />
            <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
            <reference refid="sf.spec.os.system.definition.files" torefid="system.definition.files" />
          </antcall>
        </else>
      </if> 
    </target>

    <target name="sf-check-missing-s60-files" depends="sf-compile-options">
    
        <hlm:argSet id="sbs.check.tools.var">
                <hlm:arg name="config" value="${sf.spec.sbs.tools.config}" />
                <hlm:arg name="run-check" value="true" />
        </hlm:argSet>
     
        <hlm:argSet id="sbs.check.main.var">
                <hlm:arg name="config" value="${sf.spec.sbs.config}" />
                <hlm:arg name="run-check" value="true" />
        </hlm:argSet>     
        <antcall target="compile-main" inheritAll="false" inheritRefs="true">
            <param name="build.system" value="${sf.spec.build.system}" />
            <param name="sysdef.configurations.list" value="${sf.spec.s60.sysdef.clean.configurations.list}" />
            <param name="sf.spec.sysdef.version" value ="${sf.spec.s60.sysdef.version}"/>
            <param name="build.id" value ="sbs_check"/>
            <reference refid="sbs.check.tools.var" torefid="sbs.var" />
            <reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
            <reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
        </antcall> 
        <antcall target="compile-main" inheritAll="false" inheritRefs="true">
            <param name="build.system" value="${sf.spec.build.system}" />
            <param name="sysdef.configurations.list" value="${sf.spec.s60.sysdef.clean.configurations.list}" />
            <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
            <param name="build.id" value ="sbs_check"/>
            <reference refid="sbs.check.main.var" torefid="sbs.var" />
            <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
            <reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
        </antcall>
        
    </target>
    
    <target name="sf-create-public-PDK" depends="sf-prebuild,sf-run-sfl-licence-munging" >
        <if>
            <istrue value="${sf.spec.md5.enable}"/>
            <then>
                <echo message="INFO Creating MD5s"/>
                <runtarget target="sf-run-evalid"/>
            </then>
        </if>
        
        <!-- Package up the binaries we built -->
        <if>
            <istrue value="${sf.spec.package.bin.enable}"/>
            <then>
                <echo message="INFO Packaging Binaries"/>
                <runtarget target="sf-package-binary"/>

                <echo message="INFO Validate Zip files"/>
                <runtarget target="sf-package-validate"/>
            </then>
        </if>
        <runtarget target="sf-merge-brag"/>
        <runtarget target="sf-zip-logs"/>
                
        <if>
            <istrue value="${sf.spec.publish.enable}" />
            <then>
                <echo message="Send links to Diamonds"/>
                <runtarget target="sf-links-to-diamonds"/>
                <echo message="Send BRAG status information to Diamonds"/>
                <runtarget target="sf-brag-to-diamonds"/>
                
                <echo message="Publish log files and reports to ${sf.spec.publish.rootdir}"/>
                <runtarget target="sf-publish"/>
            </then>
        </if>
    </target>

    <target name="sf-run-sfl-licence-munging" depends="sf-check-utilities-dir" if="sf-utilities-available">    
        <echo message="Running SFL Licence Munging writing log to ${build.log.dir}"/>
        <stopwatch name="munge" action="start"/>
        <exec executable="perl" dir="${build.drive}" failonerror="false" output="${build.log.dir}/postbuild_sfl-licence_munging_results.log">
          <arg value="${build.drive}/utilities/williamr/convert_to_eula.pl"/>
        </exec>
        <stopwatch name="munge" action="total"/>
    </target>

    <target name="sf-copy-rom-logs">
        <property name="sf.rombuild.dir" value="${build.drive}/epoc32/rom/"/>
        <!-- copy log files for each variant we have -->
        <echo message="build.log.dir= ${build.log.dir}"/>
        <echo message="sf.rombuild.dir= ${sf.rombuild.dir}"/>
        <echo message="sf.spec.referenceroms.variant= ${sf.spec.referenceroms.variant}"/>
        
        <copy todir="${build.log.dir}" preservelastmodified="true" failonerror="false">
            <fileset dir="${sf.rombuild.dir}/${sf.spec.referenceroms.variant}/"><include name="*ROMBUILD.LOG"/></fileset>
        </copy>
        
        <copy todir="${build.log.dir}" preservelastmodified="true" failonerror="false">
            <fileset dir="${sf.rombuild.dir}/${sf.spec.referenceroms.variant}/"><include name="*rom.oby"/></fileset>
        </copy>
    </target>

    <target name="sf-build-roms">
        <if>
            <istrue value="${sf.spec.referenceroms.createimages.enable}" />
            <then>
                <echo message="INFO Building iMaker configurations"/>
                <runtarget target="build-roms"/>
            </then>
        </if>    
    </target>

    <!-- Transform BRAG xslt and display status at the end of the build -->
    <target name="sf-build-summary">
    <delete dir="${build.drive}/output/logs/summary/">
      <include name="**/*.html"/>
    </delete>
     <xslt basedir="${build.drive}/output/logs/summary" destdir="${temp.build.dir}" extension=".html" style="brag.xsl"/>	
    <loadfile srcFile="${temp.build.dir}/_BRAG.html" property="sf.brag.status">
    <filterchain>
      <linecontainsregexp>
        <regexp pattern="(BLACK|RED|AMBER|GREEN)"/>
      </linecontainsregexp>
	  <trim/>
      <striplinebreaks/>
      <deletecharacters chars="\&gt;\&lt;\h2\h1\/"/>
    </filterchain>
    </loadfile>	
    <echo message="BRAG STATUS: [${sf.brag.status}] - full build details available at ${build.drive}\output\logs\summary\_BRAG.xml"/>
	</target>

</project>