Add branch and changeset support for getting source. BOM sources.csv can now be reused directly.
authorShabe Razvi <shaber@symbian.org>
Thu, 09 Jul 2009 15:27:24 +0100
changeset 251 c75afb49c4d3
parent 250 75af1c9cfd87
child 252 52c893932513
Add branch and changeset support for getting source. BOM sources.csv can now be reused directly.
common/build.xml
common/templates/build-info.xml.ftl
common/templates/source-spec.ant.xml.ftl
--- a/common/build.xml	Mon Jul 06 10:58:51 2009 +0100
+++ b/common/build.xml	Thu Jul 09 15:27:24 2009 +0100
@@ -506,7 +506,7 @@
                 project: csv(${build.drive}/output/logs/BOM/project.csv,{separator:',',headers:[loc,dst,rev]})
                 baseline: slicedText(${build.drive}/output/logs/BOM/baseline.txt,{trim})
                 toolsbaseline: slicedText(${build.drive}/output/logs/BOM/toolsbaseline.txt,{trim})
-                sources: csv(${build.drive}/output/logs/BOM/sources.csv,{separator:',',headers:[loc,dst,rev]})              
+                sources: csv(${build.drive}/output/logs/BOM/sources.csv,{separator:',',headers:[loc,dst,type,rev,sysdef]})              
             </data>
         </fmpp>
         <!-- Make a copy in BOM dir -->
@@ -683,7 +683,6 @@
             <arg value="--device-name=ATSINTERFACE EMULATOR on ${env.COMPUTERNAME}"/>
             <arg value="--src=${sf.spec.test.package.location}\smoketest.zip"/>
             <arg value="--dest=${sf.spec.test.package.location}\${sf.spec.test.package.name}"/>
-
         </exec>
         <!-- Now ready to send to ATS3 -->
     </target>   
--- a/common/templates/build-info.xml.ftl	Mon Jul 06 10:58:51 2009 +0100
+++ b/common/templates/build-info.xml.ftl	Thu Jul 09 15:27:24 2009 +0100
@@ -1,4 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
+
+<#assign row = 0 />
+
 <diamonds-build>
   <content>
     <project>
@@ -28,7 +31,10 @@
     <project>
  	  <name>Sources</name>
  	  <#list sources as s>
+	  <#if (row!=0)>
  	  <baseline>${s.loc}#${s.rev}</baseline>
+	  </#if>
+	  <#assign row = row + 1 />
  	  </#list>
     </project>
   </content>
--- a/common/templates/source-spec.ant.xml.ftl	Mon Jul 06 10:58:51 2009 +0100
+++ b/common/templates/source-spec.ant.xml.ftl	Thu Jul 09 15:27:24 2009 +0100
@@ -18,18 +18,34 @@
             <#assign fileset = "${fileset}"  />
         </#if>
         <sequential>
+            <!-- create sf\layer dir  -->
             <delete dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="false"/>
             <mkdir dir="${ant['build.drive']}${pkg_detail.dst}"/>
+            <delete dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="false"/>
+
+            <exec executable="hg" dir="${ant['build.drive']}">
+                <arg value="clone"/>
+                <arg value="-U"/>
+                <arg value="${pkg_detail.source}"/>
+                <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
+            </exec>
+
             <hlm:scm verbose="true" scmUrl="scm:hg:${pkg_detail.source}">
-                <hlm:checkout basedir="${ant['build.drive']}${pkg_detail.dst}"/>
+                <!--hlm:checkout basedir="${ant['build.drive']}${pkg_detail.dst}"/-->
+                <#if "${pkg_detail.type}"=="tag" >
                 <hlm:tags basedir="${ant['build.drive']}${pkg_detail.dst}" reference="hg.tags.id${dollar}{refid}"/>
                 <hlm:update basedir="${ant['build.drive']}${pkg_detail.dst}">
-                    <hlm:latestTag pattern="${pkg_detail.tag}">
+                <hlm:latestTag pattern="${pkg_detail.pattern}">
                         <hlm:tagSet refid="hg.tags.id${dollar}{refid}" />
-                    </hlm:latestTag>
+                </hlm:latestTag>
                 </hlm:update>
+                </#if>
+                <#if "${pkg_detail.type}"== "changeset" || "${pkg_detail.type}"=="branch">
+                <hlm:update basedir="${ant['build.drive']}${pkg_detail.dst}">
+                     <hlm:tag name="${pkg_detail.pattern}"/>
+                </hlm:update>
+                </#if>
             </hlm:scm>
-        
         </sequential>
     </target>
 
@@ -38,26 +54,21 @@
         <sequential>
             
             <!-- record info on source code repo/rev in BOM file  -->
-            <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" outputproperty="sf.sourcesync.${count}.rev">
-                <arg value="identify"/>
-                <arg value="-n"/>
-            </exec>
             <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" outputproperty="sf.sourcesync.${count}.checksum">
                 <arg value="identify"/>
                 <arg value="-i"/>
             </exec>
-            <echo message="dir ${ant['build.drive']}${pkg_detail.dst} : revision ${dollar}{sf.sourcesync.${count}.rev}:${dollar}{sf.sourcesync.${count}.checksum}"/>
+            <echo message="dir ${ant['build.drive']}${pkg_detail.dst} : ${dollar}{sf.sourcesync.${count}.checksum}"/>
             <exec executable="cmd" output="${ant['build.drive']}/output/logs/BOM/sources.csv" append="true">
                 <arg value="/c"/>
                 <arg value="echo"/>
-                <arg value="${pkg_detail.source},${pkg_detail.dst},${dollar}{sf.sourcesync.${count}.rev}:${dollar}{sf.sourcesync.${count}.checksum}"/>
+                <arg value="${pkg_detail.source},${pkg_detail.dst},changeset,${dollar}{sf.sourcesync.${count}.checksum}"/>
             </exec>
-        
         </sequential>
     </target>
 
 
-    <#assign fileset = "${fileset}" + "<fileset dir=\"${ant['build.drive']}${pkg_detail.dst}\" includes=\"${pkg_detail.pattern}\"/>" />       
+    <#assign fileset = "${fileset}" + "<fileset dir=\"${ant['build.drive']}${pkg_detail.dst}\" includes=\"${pkg_detail.sysdef}\"/>" />       
     <#assign sync_list = "${sync_list}" + "<runtarget target=\"sf-prebuild-${count}\"/>\n"/>       
     <#assign bom_list = "${bom_list}" + "<runtarget target=\"sf-bom-info-${count}\"/>\n"/>    
     <#assign count = count + 1 />
@@ -75,7 +86,13 @@
     ${sync_list}
   </parallel>
 
-
+  <echo message="Adding BOM header"/>
+      <exec executable="cmd" output="${ant['build.drive']}/output/logs/BOM/sources.csv" append="true">
+      <arg value="/c"/>
+      <arg value="echo"/>
+      <arg value="source,dst,type,pattern,sysdef,"/>
+  </exec>
+  
   ${bom_list}
 
 </target>