common/templates/tag-hg-code.ant.xml.ftl
author DarioS@UK-DarioS.symbian.int
Wed, 08 Apr 2009 15:35:55 +0100
changeset 54 24d7d3a8a2f2
parent 42 b6e2360f1ab4
child 55 4b303c38b677
permissions -rw-r--r--
Added try/catch around the tagging, so that the build doesn't fail if tag gives an error

<?xml version="1.0"?>
<project name="SF-TAG-HG-CODE" default="all" xmlns:hlm="http://www.nokia.com/helium">

<#assign target_depends = "" />
<#assign count = 0 />

<#list data as pkg_detail>
    <target name="sf-tag-hg-code-${count}">
        <sequential>
        
          <trycatch> <!-- build must not fail if this command gives an error -->
            <try>
              <hlm:scm verbose="true" scmUrl="scm:hg:${pkg_detail.source}">
                <hlm:tag basedir="${ant['sf.spec.job.drive']}${pkg_detail.dst}" name="${ant['sf.tagafterbuild.tag']}" level="normal"/>
              </hlm:scm>
            </try>
            <catch>
              <echo message="WARNING: failed to tag code with label '${ant['sf.tagafterbuild.tag']}' (does the tag already exist?)"/>
            </catch>
          </trycatch>
          
        </sequential>
    </target>
    
    <#if (count == 0) >
    				<#assign target_depends = "${target_depends}" + "sf-tag-hg-code-${count}" />
    </#if>
    <#if (count > 0) >
            <#assign target_depends ="${target_depends}" + ","+"sf-tag-hg-code-${count}"/>
    </#if>
    
    <#assign count = count + 1 />
</#list>

<target name="all" depends="${target_depends}"/>

</project>



<trycatch>
    <try>
 
        <scm ....>
            <tag ....>
        </scm>
    </try>
    <catch>
        <echo>Fail to tag: &lt;catch&gt;.</echo>
    </catch>
</trycatch>