Added try/catch around the tagging, so that the build doesn't fail if tag gives an error
authorDarioS@UK-DarioS.symbian.int
Wed, 08 Apr 2009 15:35:55 +0100
changeset 44 24d7d3a8a2f2
parent 43 e782ed26b791
child 45 4b303c38b677
Added try/catch around the tagging, so that the build doesn't fail if tag gives an error
common/templates/tag-hg-code.ant.xml.ftl
--- a/common/templates/tag-hg-code.ant.xml.ftl	Wed Apr 08 13:37:02 2009 +0100
+++ b/common/templates/tag-hg-code.ant.xml.ftl	Wed Apr 08 15:35:55 2009 +0100
@@ -7,9 +7,18 @@
 <#list data as pkg_detail>
     <target name="sf-tag-hg-code-${count}">
         <sequential>
-          <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>
+        
+          <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>
     
@@ -25,4 +34,18 @@
 
 <target name="all" depends="${target_depends}"/>
 
-</project>
\ No newline at end of file
+</project>
+
+
+
+<trycatch>
+    <try>
+ 
+        <scm ....>
+            <tag ....>
+        </scm>
+    </try>
+    <catch>
+        <echo>Fail to tag: &lt;catch&gt;.</echo>
+    </catch>
+</trycatch>
\ No newline at end of file