common/templates/source-spec.ant.xml.ftl
changeset 892 24ecf67cba71
parent 890 41f3579ef67e
child 893 f4d702959f07
equal deleted inserted replaced
891:6c56420d1006 892:24ecf67cba71
     5 <#assign sync_list = "" />
     5 <#assign sync_list = "" />
     6 <#assign bom_list  = "" />
     6 <#assign bom_list  = "" />
     7 <#assign change_list  = "" />
     7 <#assign change_list  = "" />
     8 <#assign dollar = "$"/>
     8 <#assign dollar = "$"/>
     9 <#assign count = 0 />
     9 <#assign count = 0 />
    10 <#if ("${ant['sf.spec.sourcesync.archive']}")?? && "${ant['sf.spec.sourcesync.archive']}" == "true">
       
    11   <#assign fast_sync = true />
       
    12 <#else>
       
    13   <#assign fast_sync = false />
       
    14 </#if>
       
    15 <#if ("${ant['sf.spec.sourcesync.bug419']}")?? && "${ant['sf.spec.sourcesync.bug419']}" == "true">
       
    16   <#assign bug419 = true />
       
    17 <#else>
       
    18   <#assign bug419 = false />
       
    19 </#if>
       
    20 
    10 
    21 <#list data as csv_file>
    11 <#list data as csv_file>
    22   <#list csv_file as pkg_detail>
    12   <#list csv_file as pkg_detail>
    23     <target name="sf-prebuild-${count}">
    13     <target name="sf-prebuild-${count}">
    24         <sequential>
    14         
    25             <!-- create sf\layer dir  -->
    15         <!-- Create sf\layer dir on build dir -->
    26             <mkdir dir="${ant['build.drive']}${pkg_detail.dst}"/>
    16         <mkdir dir="${ant['build.drive']}${pkg_detail.dst}"/>
    27             <delete dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="false" />
    17         <delete dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true" />
    28             <!-- Don't use hg archive with tags, as we can have wildcards in the tags... -->
    18         
    29             <#if fast_sync && ("${pkg_detail.type}"!="tag") > 
    19         <if>
    30               <!-- Identify the version on the cache first -->
    20             <istrue value="${dollar}{sf.spec.sourcesync.usecache}"/>
    31               <exec executable="hg" dir="${pkg_detail.source}" outputproperty="sf.sourcesync.${count}.checksum">
    21             <then>
    32                   <arg value="identify"/>
    22                 <!-- Work out cache location from source location -->
    33                   <arg value="-i"/>
    23                 <propertyregex property="sf.spec.sourcesync.cachelocation.${count}" input="${pkg_detail.source}" regexp="^http://developer.symbian.org/" casesensitive="false" replace="${dollar}{sf.spec.sourcesync.cachelocation}/Live/"/>
    34                   <arg value="-r"/>
    24 		<propertyregex property="sf.spec.sourcesync.cachelocation.${count}" input="${pkg_detail.source}" regexp="^${ant['sf.spec.sourcesync.local.development.area']}/" casesensitive="false" replace="${dollar}{sf.spec.sourcesync.cachelocation}/LocalDev/"/>
    35                   <arg value="${pkg_detail.pattern}"/>
    25             </then>
    36               </exec>
    26         </if>
    37               <!-- hg archive on the version we found -->
    27 	
    38               <exec executable="hg" dir="${pkg_detail.source}">
    28         <if>
    39                   <arg value="archive"/>
    29             <and>
    40                   <arg value="-r"/>
    30                 <isset property="sf.spec.sourcesync.cachelocation.${count}"/>
    41                   <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/>
    31                 <available file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}" type="dir"/>
    42                   <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
    32             </and>
    43               </exec>
    33             <then>
    44             <#else>
    34                 <!-- Package in cache already -->
    45 	    <exec executable="hg" dir="${ant['build.drive']}/">
    35 		<!-- Clone null revision from source to get the right default repo -->
    46                 <arg value="clone"/>
    36                 <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true">
    47                 <arg value="-U"/>
    37                     <arg value="clone"/>
    48                 <arg value="${pkg_detail.source}"/>
    38                     <arg value="-r"/>
    49                 <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
    39                     <arg value="null"/>
    50             </exec>
    40                     <arg value="${pkg_detail.source}"/>
    51             
    41                     <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
    52             <#if bug419 >
    42                 </exec>
    53               <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" outputproperty="sf.sourcesync.${count}.checksum">
    43                 <echo message="Pull from ${dollar}{sf.spec.sourcesync.cachelocation.${count}} to ${ant['build.drive']}${pkg_detail.dst}"/>
    54                   <arg value="identify"/>
    44                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}/" failonerror="true">
    55                   <arg value="-i"/>
    45                     <arg value="pull"/>
    56                   <arg value="-r"/>
    46                     <arg value="-f"/>
    57                   <arg value="${pkg_detail.pattern}"/>
    47                     <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
    58               </exec>
    48                 </exec>
    59               <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}">
    49                 <echo message="Pull from ${pkg_detail.source} to ${ant['build.drive']}${pkg_detail.dst}"/>
    60                   <arg value="update"/>
    50                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true">
    61                   <arg value="-r"/>
    51                     <arg value="pull"/>
    62                   <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/>
    52                     <arg value="${pkg_detail.source}"/>
    63               </exec>            
    53                 </exec>
    64             <#else>
    54                 <!-- Update to required revision -->
    65             <hlm:scm verbose="true" scmUrl="scm:hg:${pkg_detail.source}">
    55                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true">
    66                 <!--hlm:checkout basedir="${ant['build.drive']}${pkg_detail.dst}"/-->
    56                     <arg value="update"/>
    67                 <#if "${pkg_detail.type}"=="tag" >
    57                     <arg value="-r"/>
    68                 <hlm:tags basedir="${ant['build.drive']}${pkg_detail.dst}" reference="hg.tags.id${dollar}{refid}"/>
    58                     <arg value="${pkg_detail.pattern}"/>
    69                 <hlm:update basedir="${ant['build.drive']}${pkg_detail.dst}">
    59                 </exec>
    70                 <hlm:latestTag pattern="${pkg_detail.pattern}">
    60                 <!-- Record the changeset selected, for the BOM -->
    71                         <hlm:tagSet refid="hg.tags.id${dollar}{refid}" />
       
    72                 </hlm:latestTag>
       
    73                 </hlm:update>
       
    74                 </#if>
       
    75                 <#if "${pkg_detail.type}"== "changeset" || "${pkg_detail.type}"=="branch">
       
    76                 <hlm:update basedir="${ant['build.drive']}${pkg_detail.dst}">
       
    77                      <hlm:tag name="${pkg_detail.pattern}"/>
       
    78                 </hlm:update>
       
    79                 </#if>
       
    80             </hlm:scm>
       
    81             </#if>
       
    82                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" outputproperty="sf.sourcesync.${count}.checksum">
    61                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" outputproperty="sf.sourcesync.${count}.checksum">
    83                 <arg value="identify"/>
    62                     <arg value="identify"/>
    84                 <arg value="-i"/>
    63                     <arg value="-i"/>
    85             </exec>
    64                 </exec>
    86           </#if>  
    65                 <forget>
    87         </sequential>
    66                     <echo message="Push from ${ant['build.drive']}${pkg_detail.dst} to ${dollar}{sf.spec.sourcesync.cachelocation.${count}} in background"/>
       
    67                     <nice newpriority="1"/>
       
    68                     <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="false">
       
    69                         <arg value="push"/>
       
    70                         <arg value="-f"/>
       
    71                         <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
       
    72                     </exec>
       
    73                 </forget>
       
    74             </then>
       
    75             <else>
       
    76                 <echo message="Clone from ${pkg_detail.source} to ${ant['build.drive']}${pkg_detail.dst}"/>
       
    77                 <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true">
       
    78                     <arg value="clone"/>
       
    79                     <arg value="-U"/>
       
    80                     <arg value="${pkg_detail.source}"/>
       
    81                     <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
       
    82                 </exec>
       
    83                 <!-- Update to required version -->
       
    84                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true">
       
    85                     <arg value="update"/>
       
    86                     <arg value="-r"/>
       
    87                     <arg value="${pkg_detail.pattern}"/>
       
    88                 </exec>
       
    89                 <!-- Record the changeset selected, for the BOM -->
       
    90                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" outputproperty="sf.sourcesync.${count}.checksum">
       
    91                     <arg value="identify"/>
       
    92                     <arg value="-i"/>
       
    93                 </exec>
       
    94                 <if>
       
    95                     <isset property="sf.spec.sourcesync.cachelocation.${count}"/>
       
    96                     <then>
       
    97                         <forget>
       
    98                             <nice newpriority="1"/>
       
    99                             <!-- Init cache -->
       
   100                             <mkdir dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
       
   101                             <delete dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}" failonerror="true" />
       
   102                             <echo message="Initialise cache at ${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
       
   103                             <!-- Clone source to get the right default repo -->
       
   104                             <exec executable="hg" dir="${ant['build.drive']}/" failonerror="false">
       
   105                                 <arg value="clone"/>
       
   106                                 <arg value="-r"/>
       
   107                                 <arg value="null"/>
       
   108                                 <arg value="${pkg_detail.source}"/>
       
   109                                 <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
       
   110                             </exec>
       
   111                             <echo message="Push from ${ant['build.drive']}${pkg_detail.dst} to ${dollar}{sf.spec.sourcesync.cachelocation.${count}} in background"/>
       
   112                             <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="false">
       
   113                                 <arg value="push"/>
       
   114                                 <arg value="-f"/>
       
   115                                 <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
       
   116                             </exec>
       
   117                         </forget>
       
   118                     </then>
       
   119                 </if>
       
   120             </else>
       
   121         </if>
    88     </target>
   122     </target>
    89     
   123     
    90     <target name="sf-bom-info-${count}">
   124     <target name="sf-bom-info-${count}">
    91         <!-- record info on source code repo/rev in BOM file  -->
   125         <!-- record info on source code repo/rev in BOM file  -->
    92         <echo file="${ant['build.drive']}/output/logs/BOM/sources.csv" append="true" message="${pkg_detail.source},${pkg_detail.dst},changeset,${dollar}{sf.sourcesync.${count}.checksum},${pkg_detail.sysdef}${dollar}{line.separator}"/>
   126         <echo file="${ant['build.drive']}/output/logs/BOM/sources.csv" append="true" message="${pkg_detail.source},${pkg_detail.dst},changeset,${dollar}{sf.sourcesync.${count}.checksum},${pkg_detail.sysdef}${dollar}{line.separator}"/>
   101                 </exec>
   135                 </exec>
   102             </then>
   136             </then>
   103         </if>
   137         </if>
   104         <echo message="Writing BOM changes since ${dollar}{sf.previous.pdk.tag} for ${pkg_detail.dst}" />
   138         <echo message="Writing BOM changes since ${dollar}{sf.previous.pdk.tag} for ${pkg_detail.dst}" />
   105         <echo file="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true" message="${dollar}{line.separator}${pkg_detail.source}${dollar}{line.separator}${pkg_detail.dst}${dollar}{line.separator}${dollar}{line.separator}" />
   139         <echo file="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true" message="${dollar}{line.separator}${pkg_detail.source}${dollar}{line.separator}${pkg_detail.dst}${dollar}{line.separator}${dollar}{line.separator}" />
   106             <#if fast_sync > 
   140             <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" output="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true">
   107               <exec executable="hg" dir="${pkg_detail.source}" output="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true">
       
   108             <#else>      		  
       
   109               <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" output="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true">
       
   110             </#if>
       
   111                 <arg value="log"/>
   141                 <arg value="log"/>
   112                 <arg value="-r"/>
   142                 <arg value="-r"/>
   113                 <arg value="${dollar}{sf.sourcesync.${count}.checksum}:${dollar}{sf.previous.pdk.tag}"/>
   143                 <arg value="${dollar}{sf.sourcesync.${count}.checksum}:${dollar}{sf.previous.pdk.tag}"/>
   114                 <#if "${pkg_detail.type}"=="branch">
   144                 <#if "${pkg_detail.type}"=="branch">
   115                 <arg value="-b"/>
   145                 <arg value="-b"/>
   130         <fileset dir="${dollar}{sf.common.config.dir}/sysdefs" includes="*.sysdef.xml"/>
   160         <fileset dir="${dollar}{sf.common.config.dir}/sysdefs" includes="*.sysdef.xml"/>
   131         ${fileset}
   161         ${fileset}
   132     </path>
   162     </path>
   133     
   163     
   134     <target name="all">
   164     <target name="all">
   135         <parallel threadsPerProcessor="1">
   165         <parallel threadsPerProcessor="1" failonany="true">
   136             ${sync_list}
   166             ${sync_list}
   137         </parallel>
   167         </parallel>
   138         
   168         
   139         <echo message="Adding BOM header"/>
   169         <echo message="Adding BOM header"/>
   140         <mkdir dir="${ant['build.drive']}/output/logs/BOM/"/>
   170         <mkdir dir="${ant['build.drive']}/output/logs/BOM/"/>